File size: 5,464 Bytes
2acaa40
44657b5
e32094c
44657b5
2acaa40
44657b5
2acaa40
 
 
 
 
 
 
44657b5
 
2acaa40
 
 
 
 
44657b5
 
 
 
 
 
 
 
 
 
2acaa40
 
16d905e
2acaa40
 
 
 
 
e6a25a6
2acaa40
16d905e
84568d7
 
2acaa40
 
 
6237d61
2acaa40
 
 
 
 
 
 
 
 
 
 
 
 
 
6237d61
 
2acaa40
 
 
76be2fc
2acaa40
 
 
 
0926049
2acaa40
6237d61
2acaa40
e6a25a6
2acaa40
 
 
 
 
 
 
 
6237d61
2acaa40
 
6237d61
 
2acaa40
 
6237d61
44657b5
2acaa40
 
 
 
 
 
 
 
 
84568d7
2acaa40
dd60608
 
44657b5
e6a25a6
 
 
2acaa40
258f9e2
2acaa40
258f9e2
 
 
44657b5
0926049
 
44657b5
0926049
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360d0c5
 
0926049
 
 
 
 
 
 
 
360d0c5
0926049
 
 
 
 
 
 
 
 
 
 
16d905e
 
 
0926049
 
16d905e
 
 
 
 
 
 
 
44657b5
84568d7
 
 
 
 
 
 
44657b5
 
84568d7
 
 
22bc712
44657b5
 
22bc712
 
 
 
 
 
 
 
 
 
 
 
d78583d
 
 
 
 
 
 
 
 
 
 
 
 
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
[project]
name = "docling-serve"
version = "0.5.1"  # DO NOT EDIT, updated automatically
description = "Running Docling as a service"
license = {text = "MIT"}
authors = [
    {name="Michele Dolfi", email="[email protected]"},
    {name="Guillaume Moutier", email="[email protected]"},
    {name="Anil Vishnoi", email="[email protected]"},
    {name="Panos Vagenas", email="[email protected]"},
    {name="Panos Vagenas", email="[email protected]"},
    {name="Christoph Auer", email="[email protected]"},
    {name="Peter Staar", email="[email protected]"},
]
maintainers = [
    {name="Michele Dolfi", email="[email protected]"},
    {name="Anil Vishnoi", email="[email protected]"},
    {name="Panos Vagenas", email="[email protected]"},
    {name="Christoph Auer", email="[email protected]"},
    {name="Peter Staar", email="[email protected]"},
]
readme = "README.md"
classifiers = [
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
    # "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "Typing :: Typed",
    "Programming Language :: Python :: 3"
]
requires-python = ">=3.10"
dependencies = [
    "docling~=2.25.1",
    "fastapi[standard]~=0.115",
    "httpx~=0.28",
    "pydantic~=2.10",
    "pydantic-settings~=2.4",
    "python-multipart>=0.0.14,<0.1.0",
    "typer~=0.12",
    "uvicorn[standard]>=0.29.0,<1.0.0",
    "websockets~=14.0",
]

[project.optional-dependencies]
ui = [
    "gradio~=5.9"
]
tesserocr = [
    "tesserocr~=2.7"
]
rapidocr = [
    "rapidocr-onnxruntime~=1.4; python_version<'3.13'",
    "onnxruntime~=1.7",
]
cpu = [
  "torch>=2.6.0",
  "torchvision>=0.21.0",
]
cu124 = [
  "torch>=2.6.0",
  "torchvision>=0.21.0",
]

[dependency-groups]
dev = [
    "mypy~=1.11",
    "pre-commit-uv~=4.1",
    "pytest~=8.3",
    "pytest-asyncio~=0.24",
    "pytest-check~=2.4",
    "python-semantic-release~=7.32",
    "ruff>=0.9.6",
]

[tool.uv]
package = true
conflicts = [
  [
    { extra = "cpu" },
    { extra = "cu124" },
  ],
]

[tool.uv.sources]
torch = [
  { index = "pytorch-cpu", extra = "cpu" },
  { index = "pytorch-cu124", extra = "cu124" },
]
torchvision = [
  { index = "pytorch-cpu", extra = "cpu" },
  { index = "pytorch-cu124", extra = "cu124" },
]

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[[tool.uv.index]]
name = "pytorch-cu124"
url = "https://download.pytorch.org/whl/cu124"
explicit = true

[tool.setuptools.packages.find]
include = ["docling_serve*"]
namespaces = true

[project.scripts]
docling-serve = "docling_serve.__main__:main"

[project.urls]
Homepage = "https://github.com/docling-project/docling-serve"
# Documentation = "https://ds4sd.github.io/docling"
Repository = "https://github.com/docling-project/docling-serve"
Issues = "https://github.com/docling-project/docling-serve/issues"
Changelog = "https://github.com/docling-project/docling-serve/blob/main/CHANGELOG.md"

[tool.ruff]
target-version = "py310"
line-length = 88
respect-gitignore = true

# extend-exclude = [
#     "tests",
# ]

[tool.ruff.format]
skip-magic-trailing-comma = false

[tool.ruff.lint]
select = [
    # "B",  # flake8-bugbear
    "C",  # flake8-comprehensions
    "C9",  # mccabe
    # "D",  # flake8-docstrings
    "E",  # pycodestyle errors (default)
    "F",  # pyflakes (default)
    "I",  # isort
    "PD", # pandas-vet
    "PIE", # pie
    # "PTH", # pathlib
    "Q",  # flake8-quotes
    # "RET", # return
    "RUF", # Enable all ruff-specific checks
    # "SIM", # simplify
    "S307", # eval
    # "T20",  # (disallow print statements) keep debugging statements out of the codebase
    "W",  # pycodestyle warnings
    "ASYNC", # async
    "UP", # pyupgrade
]

ignore = [
    "E501",  # Line too long, handled by ruff formatter
    "D107", # "Missing docstring in __init__",
    "F811", # "redefinition of the same function"
    "PL", # Pylint
    "RUF012", # Mutable Class Attributes
    "UP007", # Option and Union
]

#extend-select = []

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401"]
"tests/*.py" = ["ASYNC"] # Disable ASYNC check for tests

[tool.ruff.lint.mccabe]
max-complexity = 15

[tool.ruff.lint.isort.sections]
"docling" = ["docling", "docling_core"]

[tool.ruff.lint.isort]
combine-as-imports = true
section-order = [
  "future",
  "standard-library",
  "third-party",
  "docling",
  "first-party",
  "local-folder",
]

[tool.mypy]
pretty = true
# strict = true
no_implicit_optional = true
plugins = "pydantic.mypy"
python_version = "3.10"

[[tool.mypy.overrides]]
module = [
    "easyocr.*",
    "tesserocr.*",
    "rapidocr_onnxruntime.*",
    "requests.*",
]
ignore_missing_imports = true

[tool.pytest.ini_options]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
minversion = "8.2"
testpaths = [
    "tests",
]
addopts = "-rA --color=yes --tb=short --maxfail=5"
markers = [
"asyncio",
]

[tool.semantic_release]
# for default values check:
# https://github.com/python-semantic-release/python-semantic-release/blob/v7.32.2/semantic_release/defaults.cfg

version_source = "tag_only"
branch = "main"

# configure types which should trigger minor and patch version bumps respectively
# (note that they must be a subset of the configured allowed types):
parser_angular_allowed_types = "build,chore,ci,docs,feat,fix,perf,style,refactor,test"
parser_angular_minor_types = "feat"
parser_angular_patch_types = "fix,perf"