1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
{
lib,
buildPythonPackage,
fetchFromGitHub,
pythonOlder,
# build-system
flit-core,
# docs
sphinxHook,
sphinx-rtd-theme,
myst-parser,
# propagates
typing-extensions,
# optionals
cryptography,
pillow,
# tests
fpdf2,
pytestCheckHook,
pytest-timeout,
}:
buildPythonPackage rec {
pname = "pypdf";
version = "6.6.0";
pyproject = true;
src = fetchFromGitHub {
owner = "py-pdf";
repo = "pypdf";
tag = version;
# fetch sample files used in tests
fetchSubmodules = true;
hash = "sha256-C1ZFqqLFtxWOuLUT7KFSfWIE6a9xDPCFtOakzYP4NMY=";
};
outputs = [
"out"
"doc"
];
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "--disable-socket" ""
'';
build-system = [ flit-core ];
nativeBuildInputs = [
sphinxHook
sphinx-rtd-theme
myst-parser
];
dependencies = lib.optionals (pythonOlder "3.11") [ typing-extensions ];
optional-dependencies = rec {
full = crypto ++ image;
crypto = [ cryptography ];
image = [ pillow ];
};
pythonImportsCheck = [ "pypdf" ];
nativeCheckInputs = [
(fpdf2.overridePythonAttrs { doCheck = false; }) # avoid reference loop
pytestCheckHook
pytest-timeout
]
++ optional-dependencies.full;
disabledTestMarks = [
# don't access the network
"enable_socket"
];
meta = {
description = "Pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files";
homepage = "https://github.com/py-pdf/pypdf";
changelog = "https://github.com/py-pdf/pypdf/blob/${src.tag}/CHANGELOG.md";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ javaes ];
};
}
|