evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / development / python-modules / layoutparser / default.nix
blobe6c5fcda855c89e155da94124f76cc9511e7faf9
2   lib,
3   buildPythonPackage,
4   fetchFromGitHub,
5   # build inputs
6   numpy,
7   opencv-python,
8   scipy,
9   pandas,
10   pillow,
11   pyyaml,
12   iopath,
13   pdfplumber,
14   pdf2image,
15   google-cloud-vision,
16   pytesseract,
17   torch,
18   torchvision,
19   effdet,
20   # check inputs
21   pytestCheckHook,
23 let
24   pname = "layoutparser";
25   version = "0.3.4";
26   optional-dependencies = {
27     ocr = [
28       google-cloud-vision
29       pytesseract
30     ];
31     gcv = [ google-cloud-vision ];
32     tesseract = [ pytesseract ];
33     layoutmodels = [
34       torch
35       torchvision
36       effdet
37     ];
38     effdet = [
39       torch
40       torchvision
41       effdet
42     ];
43     # paddledetection = [ paddlepaddle ]
44   };
46 buildPythonPackage {
47   inherit pname version;
48   format = "setuptools";
50   src = fetchFromGitHub {
51     owner = "Layout-Parser";
52     repo = "layout-parser";
53     rev = "refs/tags/v${version}";
54     hash = "sha256-qBzcIUmgnGy/Xn/B+7UrLrRhCvCkapL+ymqGS2sMVgA=";
55   };
57   propagatedBuildInputs = [
58     numpy
59     opencv-python
60     scipy
61     pandas
62     pillow
63     pyyaml
64     iopath
65     pdfplumber
66     pdf2image
67   ];
69   pythonImportsCheck = [ "layoutparser" ];
71   nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.ocr;
73   disabledTests = [
74     "test_PaddleDetectionModel" # requires paddlepaddle not yet packaged
75     # requires detectron2 not yet packaged
76     "test_Detectron2Model"
77     "test_AutoModel"
78     # requires effdet (disable for now until effdet builds on darwin)
79     "test_EffDetModel"
80     # problems with google-cloud-vision
81     # AttributeError: module 'google.cloud.vision' has no attribute 'types'
82     "test_gcv_agent"
83     "test_viz"
84     #  - Failed: DID NOT RAISE <class 'ImportError'>
85     "test_when_backends_are_not_loaded"
86   ];
88   disabledTestPaths = [
89     "tests_deps/test_only_detectron2.py" # requires detectron2 not yet packaged
90     "tests_deps/test_only_effdet.py" # requires effdet (disable for now until effdet builds on darwin)
91     "tests_deps/test_only_paddledetection.py" # requires paddlepaddle not yet packaged
92   ];
94   optional-dependencies = optional-dependencies;
96   meta = with lib; {
97     description = "Unified toolkit for Deep Learning Based Document Image Analysis";
98     homepage = "https://github.com/Layout-Parser/layout-parser";
99     changelog = "https://github.com/Layout-Parser/layout-parser/releases/tag/v${version}";
100     license = licenses.asl20;
101     maintainers = with maintainers; [ happysalada ];
102   };