1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 poetry-core,
9
10 # dependencies
11 docling-core,
12 huggingface-hub,
13 jsonlines,
14 numpy,
15 opencv-python-headless,
16 pillow,
17 pydantic,
18 safetensors,
19 torch,
20 torchvision,
21 tqdm,
22 transformers,
23
24 # tests
25 datasets,
26 pytestCheckHook,
27 writableTmpDirAsHomeHook,
28}:
29
30buildPythonPackage rec {
31 pname = "docling-ibm-models";
32 version = "3.4.3";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "docling-project";
37 repo = "docling-ibm-models";
38 tag = "v${version}";
39 hash = "sha256-EcBlvb6UNHe2lZFBuC4eSa6Ka82HRNnsQqK/AQuPvoA=";
40 };
41
42 build-system = [
43 poetry-core
44 ];
45
46 dependencies = [
47 docling-core
48 huggingface-hub
49 jsonlines
50 numpy
51 opencv-python-headless
52 pillow
53 pydantic
54 safetensors
55 torch
56 torchvision
57 tqdm
58 transformers
59 ];
60
61 pythonRelaxDeps = [
62 "jsonlines"
63 "numpy"
64 "transformers"
65 ];
66
67 pythonImportsCheck = [
68 "docling_ibm_models"
69 ];
70
71 nativeCheckInputs = [
72 datasets
73 pytestCheckHook
74 writableTmpDirAsHomeHook
75 ];
76
77 disabledTests = [
78 # Requires network access
79 "test_code_formula_predictor" # huggingface_hub.errors.LocalEntryNotFoundError
80 "test_figure_classifier" # huggingface_hub.errors.LocalEntryNotFoundError
81 "test_layoutpredictor"
82 "test_readingorder"
83 "test_tf_predictor"
84 ];
85
86 meta = {
87 changelog = "https://github.com/DS4SD/docling-ibm-models/blob/${src.tag}/CHANGELOG.md";
88 description = "Docling IBM models";
89 homepage = "https://github.com/DS4SD/docling-ibm-models";
90 license = lib.licenses.mit;
91 maintainers = with lib.maintainers; [ drupol ];
92 };
93}