-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpyproject.toml
More file actions
278 lines (249 loc) · 8.72 KB
/
pyproject.toml
File metadata and controls
278 lines (249 loc) · 8.72 KB
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
[build-system]
requires = ["poetry-core>=2.2.0"]
build-backend = "poetry.core.masonry.api"
[project]
name = "nrtk"
version = "1.0.3"
description = "Natural Robustness Toolkit (NRTK) is a platform for generating validated, sensor-specific perturbations and transformations used to evaluate the robustness of computer vision models."
license = "Apache-2.0"
readme = "README.md"
authors = [{name = "Kitware, Inc.", email = "nrtk@kitware.com"}]
requires-python = ">=3.10,<3.14"
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Unix',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
]
dependencies = [
"lazy-loader>=0.4",
# Python capped to <3.14 because of:
# https://stackoverflow.com/questions/77431252/why-doesnt-poetry-select-the-good-version-of-my-dependency
# CVE-2021-34141 (numpy < 1.26)
"numpy>=1.26",
"smqtk-classifier>=0.20.0",
"smqtk-core>=0.21",
"smqtk-detection>=0.23.0",
"smqtk-image-io>=0.18.0",
"tqdm>=4.66.3", # GHSA-g7vv-2v7x-gj9p
"pycocotools>=2.0.10",
"setuptools>=78.1.1",
"typing-extensions>=4.5.0",
]
[project.urls]
Documentation = "https://nrtk.readthedocs.io/"
[project.scripts]
nrtk-perturber = "nrtk.entrypoints:nrtk_perturber_cli"
[project.entry-points."smqtk_plugins"]
# Add implementation sub-module exposure here.
"nrtk.impls.perturb_image.photometric.blur" = "nrtk.impls.perturb_image.photometric.blur"
"nrtk.impls.perturb_image.photometric.enhance" = "nrtk.impls.perturb_image.photometric.enhance"
"nrtk.impls.perturb_image.photometric.noise" = "nrtk.impls.perturb_image.photometric.noise"
"nrtk.impls.perturb_image" = "nrtk.impls.perturb_image"
"nrtk.impls.perturb_image.geometric.random" = "nrtk.impls.perturb_image.geometric.random"
"nrtk.impls.perturb_image.environment" = "nrtk.impls.perturb_image.environment"
"nrtk.impls.perturb_image.generative" = "nrtk.impls.perturb_image.generative"
"nrtk.impls.perturb_image.optical" = "nrtk.impls.perturb_image.optical"
"nrtk.impls.perturb_image.optical.otf" = "nrtk.impls.perturb_image.optical.otf"
"nrtk.impls.perturb_image_factory" = "nrtk.impls.perturb_image_factory"
[project.optional-dependencies]
graphics = ["opencv-python>=4.8.1.78"] # CVE-2023-4863
headless = ["opencv-python-headless>=4.8.1.78"] # CVE-2023-4863
pybsm = ["pybsm>=0.14.3"]
maite = [
"maite>=0.9.2,<0.10.0",
]
tools = [
"kwcoco>=0.2.18",
"Pillow>=12.1.1", # GHSA-cfh3-3jmp-rvhc
"click>=8.0.0",
"fastapi>=0.110.0",
"uvicorn>=0.29.0",
"pydantic>=2.6.4",
"pydantic-settings>=2.2.1",
"python-json-logger>=3.0.0",
]
skimage = [
"scikit-image>=0.20; python_version < '3.12'",
"scikit-image>=0.22; python_version >= '3.12'"
]
pillow = ["Pillow>=12.1.1"] # GHSA-cfh3-3jmp-rvhc
albumentations = ["nrtk-albumentations>=2.2.1"]
waterdroplet = ["scipy>=1.10.0", "numba>=0.56.4"]
diffusion = [
"torch>=2.6.0", # GHSA-53q9-r3pm-6pq6
"diffusers>=0.21.0",
"accelerate>=0.20.0",
"Pillow>=12.1.1", # GHSA-cfh3-3jmp-rvhc
"transformers>=4.53.0", # CVE-2025-6921
"protobuf>=6.33.5", # GHSA-8qvm-5x2c-j2w7, CVE-2026-0994
]
[tool.poetry]
# Poetry-specific configuration
packages = [{include = "nrtk", from="src"}]
[dependency-groups]
# Linting
linting = [
"ruff>=0.15.0,<0.16.0",
"types-setuptools>=65.6.0.1",
"sphinx-lint>=1.0.0",
"types-requests>=2.31.0.10",
# required for pre-commit hook
"pre-commit>=2.20",
"pyright[nodejs]>=1.1.320,<1.1.409",
]
# Docs
docs = [
"Sphinx>=5.3.0",
"sphinx-copybutton>=0.5.2,<0.6.0",
"pydata-sphinx-theme>=0.16.1",
"sphinx-prompt>=1.5.0",
"sphinx-click>=5.0.0",
"sphinx-design>=0.6.1",
"sphinx-datatables>=0.3.1,<0.4.0",
"livereload>=2.6.3",
"myst-nb>=1.1.2,<2.0.0",
]
# Testing
tests = [
# pytest unittesting
"pytest>=7.2.0",
"pytest-cov>=4.0.0", # reports code coverage
"pytest-xdist>=3.8.0", # allows -n auto|# to be used to run pytests in parallel
"syrupy>=5.0.0", # required for snapshot/regression testing
"Pillow>=12.1.1", # GHSA-cfh3-3jmp-rvhc # required for custom conftest.py fixtures
"responses>=0.25.0", # rquired to test FastAPI (used by entrypoint app)
"httpx>=0.22.0", # required by starlette.testclient.TestClient (optional dep of starlette, not installed by default)
]
[tool.pytest.ini_options]
addopts = [
"-lv", # Show local in trace-backs.
"--tb=long", # Trace-back print mode.
"--cov=./src/nrtk", # Cover our package specifically
"--cov=./tests", # Also cover our tests for dead spots
"--cov-report=term", # Coverage report to terminal
"--cov-report=xml:coverage.xml", # for external tool reporting
"--snapshot-warn-unused", # Prevent test failure when skipping tests
]
# NOTE: --doctest-modules removed from addopts. To run doctests, use:
# pytest --doctest-modules src/nrtk
# Doctests require optional dependencies to be installed.
testpaths = [
"tests",
]
doctest_optionflags = [
"NORMALIZE_WHITESPACE",
"IGNORE_EXCEPTION_DETAIL",
]
markers = [
"core: Run tests that only require core functionality",
"opencv: Run tests that require the graphics or headless extra",
"albumentations: Run tests that require the albumentations extra",
"waterdroplet: Run tests that require the waterdroplet extra",
"notebooks: Run notebook-related tests (pyright checks)",
"pillow: Run tests that require the pillow extra",
"skimage: Run tests that require the skimage extra",
"diffusion: Run tests that require the diffusion extra",
"pybsm: Run tests that require the pybsm extra",
"maite: Run tests that require the maite extra",
"tools: Run tests that require the tools extra",
"optional: Run all tests except notebooks",
]
[tool.coverage.run]
omit = [
"src/nrtk/utils/_extras.py",
"src/nrtk/utils/_extras.yml",
]
[tool.ruff]
# Exclude content as appropriate.
extend-exclude = [
"__pycache__",
"scripts",
"docs/_build",
"docs/_implementations",
# Webinar notebooks are live-coded demo material; they intentionally relax
# library conventions (e.g. mAP domain naming, env-var cells before imports,
# narrative-driven class stubs without docstrings) and are excluded rather
# than littered with per-rule noqa directives.
"docs/tutorials/webinars",
".tox",
".dev",
]
line-length = 120
indent-width = 4
# Assume Python 3.10
target-version = "py310"
extend-include = ["*.ipynb"]
[tool.ruff.lint]
select = [
"F", "E", "W", "C90", "I", "N", "D", "UP",
"YTT", "ANN", "S", "BLE", "B", "A", "COM", "C4", "T10", "ISC", "ICN", "PLR0917", "PYI", "PT", "Q",
"RSE", "RET", "SLF", "SIM", "TID252", "ARG", "FIX", "PD", "FLY", "NPY", "RUF027",
"RUF100", "PERF", "UP045", "RUF013"
]
preview = true # needed for RUF027
explicit-preview-rules = true
# From program suggested config
ignore = ["C416"]
external = ["FKA100"]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.per-file-ignores]
"**/*tests/*.py" = [
"S101", # Allow asserts in tests
"SLF001", # Allow private member access for introspection in tests
"D100", "D101", "D102", "D103", "D104", "D105", "D107", # Allow missing docstring in test dir
"PLR0917" # Allow more than one positional arg in tests
]
"docs/examples/*.ipynb" = [
"PLR0917" # Allow more than one positional arg in notebooks
]
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true # Allow Any for *args and **kwargs
[tool.ruff.lint.isort]
known-first-party = ["nrtk"]
[tool.ruff.lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds 5.
max-complexity = 5
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.pycodestyle]
max-doc-length = 120
[tool.ruff.lint.pylint]
max-positional-args = 1
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = "dynamic"
[tool.pyright]
pythonVersion = "3.10"
reportMissingImports = "warning"
typeCheckingMode = "standard"
include = [
"src/nrtk",
"tests",
"scripts",
"docs",
]
exclude = [
"**/__pycache__",
"docs/_build",
"docs/_implementations",
".tox",
".dev",
]
[tool.poetry2conda]
name = "conda-test"
channels = ["conda-forge", "defaults"]