1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, jupyterlab
5, nbexec
6, pandas
7, pandas-stubs
8, pdfminer-six
9, pillow
10, pytest-parallel
11, pytestCheckHook
12, pythonOlder
13, types-pillow
14, wand
15}:
16
17buildPythonPackage rec {
18 pname = "pdfplumber";
19 version = "0.10.3";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchFromGitHub {
25 owner = "jsvine";
26 repo = "pdfplumber";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-fd/4I6jjc0Wz2+XHGXAGg0Am3Dmw9R2ZX7nymIj/UnA=";
29 };
30
31 postPatch = ''
32 substituteInPlace setup.cfg \
33 --replace "--cov=pdfplumber --cov-report xml:coverage.xml --cov-report term" ""
34 '';
35
36 propagatedBuildInputs = [
37 pdfminer-six
38 pillow
39 wand
40 ];
41
42 preCheck = ''
43 export HOME=$(mktemp -d)
44 '';
45
46 nativeCheckInputs = [
47 jupyterlab
48 nbexec
49 pandas
50 pandas-stubs
51 pytest-parallel
52 pytestCheckHook
53 types-pillow
54 ];
55
56 pythonImportsCheck = [
57 "pdfplumber"
58 ];
59
60 disabledTests = [
61 # flaky
62 "test__repr_png_"
63 ];
64
65 disabledTestPaths = [
66 # Tests requires pypdfium2
67 "tests/test_display.py"
68 # Tests require Ghostscript
69 "tests/test_repair.py"
70 ];
71
72 meta = with lib; {
73 description = "Plumb a PDF for detailed information about each char, rectangle, line, et cetera — and easily extract text and tables";
74 homepage = "https://github.com/jsvine/pdfplumber";
75 changelog = "https://github.com/jsvine/pdfplumber/releases/tag/v${version}";
76 license = licenses.mit;
77 maintainers = with maintainers; [ happysalada ];
78 };
79}