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