ps3-disc-dumper: 3.2.3 -> 4.2.5, .NET 6 -> 9 (#361506)
[NixPkgs.git] / pkgs / development / python-modules / pypdf / default.nix
blob9666821f8692a60d4e11a653c5b52a03272d44dd
2   lib,
3   buildPythonPackage,
4   fetchFromGitHub,
5   fetchpatch2,
6   pythonOlder,
8   # build-system
9   flit-core,
11   # docs
12   sphinxHook,
13   sphinx-rtd-theme,
14   myst-parser,
16   # propagates
17   typing-extensions,
19   # optionals
20   cryptography,
21   pillow,
23   # tests
24   fpdf2,
25   pytestCheckHook,
26   pytest-timeout,
29 buildPythonPackage rec {
30   pname = "pypdf";
31   version = "5.1.0";
32   pyproject = true;
34   disabled = pythonOlder "3.8";
36   src = fetchFromGitHub {
37     owner = "py-pdf";
38     repo = "pypdf";
39     rev = "refs/tags/${version}";
40     # fetch sample files used in tests
41     fetchSubmodules = true;
42     hash = "sha256-ziJTYl7MQUCE8US0yeiq6BPDVbBsxWhti0NyiDnKtfE=";
43   };
45   outputs = [
46     "out"
47     "doc"
48   ];
50   postPatch = ''
51     substituteInPlace pyproject.toml \
52       --replace-fail "--disable-socket" ""
53   '';
55   build-system = [ flit-core ];
57   nativeBuildInputs = [
58     sphinxHook
59     sphinx-rtd-theme
60     myst-parser
61   ];
63   dependencies = lib.optionals (pythonOlder "3.11") [ typing-extensions ];
65   optional-dependencies = rec {
66     full = crypto ++ image;
67     crypto = [ cryptography ];
68     image = [ pillow ];
69   };
71   pythonImportsCheck = [ "pypdf" ];
73   nativeCheckInputs = [
74     (fpdf2.overridePythonAttrs { doCheck = false; }) # avoid reference loop
75     pytestCheckHook
76     pytest-timeout
77   ] ++ optional-dependencies.full;
79   pytestFlagsArray = [
80     # don't access the network
81     "-m"
82     "'not enable_socket'"
83   ];
85   meta = with lib; {
86     description = "Pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files";
87     homepage = "https://github.com/py-pdf/pypdf";
88     changelog = "https://github.com/py-pdf/pypdf/blob/${src.rev}/CHANGELOG.md";
89     license = licenses.bsd3;
90     maintainers = with maintainers; [ javaes ];
91   };