23 pname = "layoutparser";
25 optional-dependencies = {
26 ocr = [ google-cloud-vision pytesseract ];
27 gcv = [ google-cloud-vision ];
28 tesseract = [ pytesseract ];
29 layoutmodels = [ torch torchvision effdet ];
30 effdet = [ torch torchvision effdet ];
31 # paddledetection = [ paddlepaddle ]
35 inherit pname version;
36 format = "setuptools";
38 src = fetchFromGitHub {
39 owner = "Layout-Parser";
40 repo = "layout-parser";
41 rev = "refs/tags/v${version}";
42 hash = "sha256-qBzcIUmgnGy/Xn/B+7UrLrRhCvCkapL+ymqGS2sMVgA=";
46 substituteInPlace setup.py \
47 --replace "opencv-python" "opencv"
50 propagatedBuildInputs = [
62 pythonImportsCheck = [
68 ] ++ optional-dependencies.ocr;
71 "test_PaddleDetectionModel" # requires paddlepaddle not yet packaged
72 # requires detectron2 not yet packaged
73 "test_Detectron2Model"
75 # requires effdet (disable for now until effdet builds on darwin)
77 # problems with google-cloud-vision
78 # AttributeError: module 'google.cloud.vision' has no attribute 'types'
81 # - Failed: DID NOT RAISE <class 'ImportError'>
82 "test_when_backends_are_not_loaded"
86 "tests_deps/test_only_detectron2.py" # requires detectron2 not yet packaged
87 "tests_deps/test_only_effdet.py" # requires effdet (disable for now until effdet builds on darwin)
88 "tests_deps/test_only_paddledetection.py" # requires paddlepaddle not yet packaged
91 passthru.optional-dependencies = optional-dependencies;
94 description = "A unified toolkit for Deep Learning Based Document Image Analysis";
95 homepage = "https://github.com/Layout-Parser/layout-parser";
96 changelog = "https://github.com/Layout-Parser/layout-parser/releases/tag/v${version}";
97 license = licenses.asl20;
98 maintainers = with maintainers; [ happysalada ];