-
Notifications
You must be signed in to change notification settings - Fork 680
/
pyproject.toml
325 lines (282 loc) · 9.72 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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# SETUP CONFIGURATION. #
[build-system]
requires = ["setuptools>=64.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "anomalib"
dynamic = ["version"]
readme = "README.md"
description = "anomalib - Anomaly Detection Library"
requires-python = ">=3.10"
license = { file = "LICENSE" }
authors = [{ name = "Intel OpenVINO" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development :: Libraries",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# REQUIREMENTS #
dependencies = [
"omegaconf>=2.1.1",
"rich>=13.5.2",
"jsonargparse[signatures]>=4.27.7",
"docstring_parser", # CLI help-formatter
"rich_argparse", # CLI help-formatter
"lightning-utilities",
]
[project.optional-dependencies]
core = [
"av>=10.0.0",
"einops>=0.3.2",
"freia>=0.2",
"imgaug==0.4.0",
"kornia>=0.6.6",
"matplotlib>=3.4.3",
"opencv-python>=4.5.3.56",
"pandas>=1.1.0",
"timm",
"lightning>=2.2",
"torch>=2",
"torchmetrics>=1.3.2",
# NOTE: open-clip-torch throws the following error on v2.26.1
# torch.onnx.errors.UnsupportedOperatorError: Exporting the operator
# 'aten::_native_multi_head_attention' to ONNX opset version 14 is not supported
"open-clip-torch>=2.23.0,<2.26.1",
]
openvino = ["openvino>=2024.0", "nncf>=2.10.0", "onnx>=1.16.0"]
vlm = ["ollama", "openai", "python-dotenv","transformers"]
loggers = [
"comet-ml>=3.31.7",
"gradio>=4",
"tensorboard",
"wandb>=0.12.17,<=0.15.9",
"mlflow >=1.0.0",
]
notebooks = ["gitpython", "ipykernel", "ipywidgets", "notebook"]
docs = [
"myst-parser",
"nbsphinx",
"pandoc",
"sphinx",
"sphinx_autodoc_typehints",
"sphinx_book_theme",
"sphinx-copybutton",
"sphinx_design",
]
test = [
"pre-commit",
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-sugar",
"coverage[toml]",
"tox",
]
full = ["anomalib[core,openvino,loggers,notebooks, vlm]"]
dev = ["anomalib[full,docs,test]"]
[project.scripts]
anomalib = "anomalib.cli.cli:main"
[tool.setuptools.dynamic]
version = { attr = "anomalib.__version__" }
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# RUFF CONFIGURATION #
[tool.ruff]
# Enable preview features
preview = true
# Enable rules
lint.select = [
"F", # Pyflakes (`F`)
"E", # pycodestyle error (`E`)
"W", # pycodestyle warning (`W`)
"C90", # mccabe (`C90`)
"I", # isort (`I`)
"N", # pep8-naming (`N`)
"D", # pydocstyle (`D`)
"UP", # pyupgrade (`UP`)
"YTT", # flake8-2020 (`YTT`)
"ANN", # flake8-annotations (`ANN`)
"S", # flake8-bandit (`S`)
"BLE", # flake8-blind-except (`BLE`)
"FBT", # flake8-boolean-trap (`FBT`)
"B", # flake8-bugbear (`B`)
"A", # flake8-builtins (`A`)
"COM", # flake8-commas (`COM`)
"CPY", # flake8-copyright (`CPY`)
"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`)
"ERA", # eradicate (`ERA`)
"PD", # pandas-vet (`PD`)
"PGH", # pygrep-hooks (`PGH`)
"PL", # pylint (`PL`)
"TRY", # tryceratos (`TRY`)
"FLY", # flynt (`FLY`)
"NPY", # NumPy-specific rules (`NPY`)
"PERF", # Perflint (`PERF`)
"RUF", # Ruff-specific rules (`RUF`)
# "FURB", # refurb (`FURB`) - ERROR: Unknown rule selector: `FURB`
# "LOG", # flake8-logging (`LOG`) - ERROR: Unknown rule selector: `LOG`
]
lint.ignore = [
# pydocstyle
"D107", # Missing docstring in __init__
# pylint
"PLR0913", # Too many arguments to function call
"PLR2004", # consider replacing with a constant variable
"PLR0912", # Too many branches
"PLR0915", # Too many statements
# NOTE: Disable the following rules for now.
"A004", # import is shadowing a Python built-in
"A005", # Module is shadowing a Python built-in
"B909", # Mutation to loop iterable during iteration
"PLC2701", # Private name import
"PLC0415", # import should be at the top of the file
"PLR0917", # Too many positional arguments
"E226", # Missing whitespace around arithmetic operator
"E266", # Too many leading `#` before block comment
"F822", # Undefined name `` in `__all__`
"PGH004", # Use specific rule codes when using 'ruff: noqa'
"PT001", # Use @pytest.fixture over @pytest.fixture()
"PLR6104", # Use `*=` to perform an augmented assignment directly
"PLR0914", # Too many local variables
"PLC0206", # Extracting value from dictionary without calling `.items()`
"PLC1901", # can be simplified
"RUF021", # Parenthesize the `and` subexpression
"RUF022", # Apply an isort-style sorting to '__all__'
"S404", # `subprocess` module is possibly insecure
# End of disable rules
# flake8-annotations
"ANN101", # Missing-type-self
"ANN002", # Missing type annotation for *args
"ANN003", # Missing type annotation for **kwargs
# flake8-bandit (`S`)
"S101", # Use of assert detected.
# flake8-boolean-trap (`FBT`)
"FBT001", # Boolean positional arg in function definition
"FBT002", # Boolean default value in function definition
# flake8-datatimez (`DTZ`)
"DTZ005", # The use of `datetime.datetime.now()` without `tz` argument is not allowed
# flake8-fixme (`FIX`)
"FIX002", # Line contains TODO, consider resolving the issue
]
# Allow autofix for all enabled rules (when `--fix`) is provided.
lint.fixable = ["ALL"]
lint.unfixable = []
# 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",
]
# Same as Black.
line-length = 120
# Allow unused variables when underscore-prefixed.
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Assume Python 3.10.
target-version = "py310"
# Allow imports relative to the "src" and "tests" directories.
src = ["src", "tests"]
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 15
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.flake8-copyright]
notice-rgx = """
# Copyright \\(C\\) (\\d{4}(-\\d{4})?) Intel Corporation
# SPDX-License-Identifier: Apache-2\\.0
"""
[tool.ruff.lint.per-file-ignores]
"notebooks/**/*" = ["CPY001"]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# MYPY CONFIGURATION. #
[tool.mypy]
ignore_missing_imports = true
show_error_codes = true
[[tool.mypy.overrides]]
module = ["torch.*", "wandb.*"]
follow_imports = "skip"
follow_imports_for_stubs = true
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# BANDIT CONFIGURATION #
[tool.bandit]
skips = ["B101"]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# PYTEST CONFIGURATION #
[tool.pytest.ini_options]
addopts = ["--strict-markers", "--strict-config", "--showlocals", "-ra"]
testpaths = "tests"
pythonpath = "src"
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# COVERAGE CONFIGURATION #
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise NotImplementedError",
"if TYPE_CHECKING:",
"@abstractmethod",
"pass",
"raise ImportError",
"raise ValueError",
"except ImportError:",
]
[tool.coverage.paths]
source = ["src", ".tox/*/site-packages"]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# NBQA CONFIGURATION #
[tool.nbqa.addopts]
ruff = ["--ignore=E402"]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# LINK CHECKER CONFIGURATION #
[tool.md_dead_link_check]
exclude_links = [
"https://github.com/openvinotoolkit/anomalib/settings/actions/runners/new",
"https://openvinotoolkit.github.io/anomalib/*", # Remove it after publish documentation
]
exclude_files = ["docs/*"]
force_get_requests_for_links = ["https://secure.ethicspoint.com/*"]