-
Notifications
You must be signed in to change notification settings - Fork 445
/
Copy pathpyproject.toml
311 lines (273 loc) · 9.38 KB
/
pyproject.toml
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# SETUP CONFIGURATION. #
[build-system]
requires = [
"setuptools>=61",
"wheel",
"Cython~=0.29.32",
]
build-backend = "setuptools.build_meta"
[project]
name = "otx"
dynamic = ["version"]
description = "OpenVINO™ Training Extensions: Train, Evaluate, Optimize, Deploy Computer Vision Models via OpenVINO™"
readme = "README.md"
requires-python = ">=3.10"
license = {file = "LICENSE"}
authors = [
{ name = "OpenVINO™ Training Extensions Contributors" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Cython",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dependencies = [
"datumaro==1.6.0rc1",
"omegaconf",
"rich>=13.5.2",
"jsonargparse==4.27.1",
"psutil", # Mem cache needs system checks
"ftfy",
"regex",
"importlib_resources",
"docstring_parser", # CLI help-formatter
"rich_argparse", # CLI help-formatter
]
[project.optional-dependencies]
dev = [
"tox==4.4.5",
"pre-commit==2.20.0",
"pylint",
"pytest",
"coverage",
"pytest-timeout",
"pytest-mock",
"pytest-csv",
"pytest-cov",
"mlflow==2.8.1", # For regression test
"py-cpuinfo==9.0.0", # For regression test
]
docs = [
"furo",
"myst-parser",
"sphinx==5.3.0",
"pydata-sphinx-theme==0.12.0",
"sphinx-tabs",
"sphinx-panels",
"sphinx-copybutton==0.5.0",
"sphinx-autoapi",
"sphinxemoji",
"nbsphinx",
]
base = [
"torch==2.1.1",
"lightning==2.1.2",
"pytorchcv",
"timm",
"openvino==2023.3.0",
"openvino-dev==2023.3.0",
"openvino-model-api==0.1.9",
"onnx==1.15.0",
"onnxconverter-common==1.14.0",
"nncf==2.8.1",
]
mmlab = [
"mmdet==3.2.0",
"mmpretrain==1.1.1",
"mmsegmentation==1.2.1",
"mmaction2==1.2.0",
"mmdeploy==1.3.*",
# Without the pip cache, oss2 will sometimes install to a lower version. This is related to the installation of the mmlab library.
# This causes an error when training the mm model, so fix the version first.
"oss2==2.17.0",
]
[project.scripts]
otx = "otx.cli:main"
[project.urls]
Documentation = "https://openvinotoolkit.github.io/training_extensions/"
Repository = "https://github.com/openvinotoolkit/training_extensions/"
[tool.setuptools.dynamic]
version = {attr = "otx.__version__"}
[tool.setuptools]
include-package-data = true
[tool.setuptools.packages.find]
where = ["src"]
include = ["otx*"]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# CI CONFIGURATION. #
[tool.cibuildwheel]
build = "cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# COVERAGE CONFIGURATION. #
[tool.coverage.paths]
source = [
"src",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# MYPY CONFIGURATION. #
[tool.mypy]
python_version = "3.10"
ignore_missing_imports = true
show_error_codes = true
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# RUFF CONFIGURATION #
[tool.ruff]
# Enable rules
select = [
"F", # Pyflakes (`F`)
# Enable all `pydocstyle` rules, limiting to those that adhere to the
# Google convention via `convention = "google"`, below.
"D", # pydocstyle (`D`)
"E", # pycodestyle error (`E`)
"W", # pycodestyle warning (`W`)
"I", # isort (`I`)
"PL", # pylint (`PL`)
"C90", # mccabe (`C90`)
"N", # pep8-naming (`N`)
"UP", # pyupgrade (`UP`)
"YTT", # flake8-2020 (`YTT`)
"ANN", # flake8-annotations (`ANN`)
"S", # flake8-bandit (`S`)
# "BLE", # flake8-blind-except (`BLE`) -> Need to discuss new exception structure
"B", # flake8-bugbear (`B`)
"A", # flake8-builtins (`A`)
"COM", # flake8-commas (`COM`)
# "CPY", # flake8-copyright (`CPY`) -> Rules included in the preview version of RUFF. It may be added in the future, but for now, disable it.
"C4", # flake8-comprehensions (`C4`)
"DTZ", # flake8-datatimez (`DTZ`)
"T10", # flake8-debugger (`T10`)
"EM", # flake8-errmsg (`EM`)
"FA", # flake8-future-annotations (`FA`)
"ISC", # flake8-implicit-str-concat (`ISC`)
"ICN", # flake8-import-conventions (`ICN`)
"PIE", # flake8-pie (`PIE`)
"PT", # flake8-pytest-style (`PT`)
"RSE", # flake8-raise (`RSE`)
"RET", # flake8-return (`RET`)
"SLF", # flake8-self (`SLF`)
"SIM", # flake8-simplify (`SIM`)
"TID", # flake8-tidy-imports (`TID`)
"TCH", # flake8-type-checking (`TCH`)
"INT", # flake8-gettext (`INT`)
"ARG", # flake8-unsused-arguments (`ARG`)
"PTH", # flake8-use-pathlib (`PTH`)
"TD", # flake8-todos (`TD`)
"FIX", # flake8-fixme (`FIX`)
# "LOG", # flake8-logging (`LOG`) -> Rules included in the preview version of RUFF. It may be added in the future, but for now, disable it.
"ERA", # eradicate (`ERA`)
"PD", # pandas-vet (`PD`)
"PGH", # pygrep-hooks (`PGH`)
"TRY", # tryceratos (`TRY`)
"FLY", # flynt (`FLY`)
"NPY", # NumPy-specific rules (`NPY`)
"PERF", # Perflint (`PERF`)
# "FURB", # refurb (`FURB`) -> Rules included in the preview version of RUFF. It may be added in the future, but for now, disable it.
"RUF", # Ruff-specific rules (`RUF`)
]
ignore = [
# pydocstyle
# On top of the Google convention, disable `D417`, which requires
# documentation for every function parameter.
"D417", # Missing argument descriptions in the docstring
"D107", # Missing docstring in `__init__`
"D105", # Missing docstring in magic method
# flake8-annotations
"ANN101", # Missing-type-self
"ANN002", # Missing type annotation for *args
"ANN003", # Missing type annotation for **kwargs
"ANN102", # Missing type annotation for `cls` in classmethod
"ANN204", # Missing return type annotation for special method `__init__`
"ARG002", # Unused method argument -> some function cannot use argument
# flake8-type-checking
"TCH001", # typing-only-first-party-import, Sometimes this causes an incorrect error.
# flake8-fixme
"FIX002", # line-contains-todo
]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
# fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
# unfixable = [
# "F401", # disable autofix for unused imports
# ]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"tests/assets",
"src/otx/algo/**/mmdeploy/",
# it will be cleaned up later
"src/otx/algo/classification/backbones/*",
"for_developers/helpers.py",
# Ruff complains it but don't know how to fix since it literally showed no useful logs.
# https://github.com/openvinotoolkit/training_extensions/actions/runs/7176557723/job/19541622452?pr=2718#step:5:170
"tests/regression/*.py",
]
# Same as Black.
line-length = 120
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# minimum target version
target-version = "py38"
[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 20
[tool.ruff.pylint]
allow-magic-value-types = ["str", "bytes", "int", "float"]
max-args = 20
max-branches = 50
max-statements = 150
max-returns = 10
[tool.ruff.per-file-ignores]
# Declare an additional exclude rule for test code
"tests/**/*.py" = [
"S101", # pytest-style allows `assert` statements in tests.
"SLF001", # We sometimes need to inspect private functions for testing.
"TCH003", # It doesn't seem necessary to use TYPE_CHECKING in tests.
"PT004", # fixture ignore type returning.
"E501", # Test skips lines that are too long.
"ANN001", # Skip annotation type hint in test codes
"ANN201", # Skip return type hint in test codes
"D", # Test skips missing docstring argument with magic (fixture) methods.
]
"src/otx/**/*.py" = [
"ERA001",
]
# See https://github.com/openvinotoolkit/training_extensions/actions/runs/7109500350/job/19354528819?pr=2700
"src/otx/core/config/**/*.py" = [
"UP007"
]
[tool.ruff.pydocstyle]
convention = "google"
[tool.pytest.ini_options]
# TODO: Add cpu when OTX can run integration test parallelly for each task.
markers = [
"gpu: mark tests which require NVIDIA GPU device",
# "cpu: mark tests which require CPU device",
]