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