-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathpyproject.toml
More file actions
425 lines (393 loc) · 12.2 KB
/
Copy pathpyproject.toml
File metadata and controls
425 lines (393 loc) · 12.2 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
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
[build-system]
requires = [
"setuptools",
"wheel",
"versioneer[toml]",
"more-itertools>=8.0",
"ninja",
"packaging",
"torch>=2.8.0",
"numpy>=1.24,<3.0",
"backports.tarfile" # see https://github.com/Project-MONAI/MONAI/issues/8791
]
build-backend = "setuptools.build_meta"
[project]
name = "monai"
description = "AI Toolkit for Healthcare Imaging"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.10"
license = { text = "Apache License 2.0" }
authors = [{ name = "MONAI Consortium", email = "monai.contact@gmail.com" }]
classifiers = [
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Intended Audience :: Healthcare Industry",
"Programming Language :: C++",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Typing :: Typed",
]
dependencies = [
"torch>=2.8.0",
"numpy>=1.24,<3.0"
]
dynamic = ["version"]
[project.urls]
Homepage = "https://project-monai.github.io/"
Documentation = "https://monai.readthedocs.io/"
"Bug Tracker" = "https://github.com/Project-MONAI/MONAI/issues"
"Source Code" = "https://github.com/Project-MONAI/MONAI"
[project.optional-dependencies]
# All dependencies are included here except some omitted for compatibility. Testing dependencies are typically not
# needed and so present only in "testing". Ensure requirement changes in other lists are reflected here as well.
all = [
"clearml>=1.10.0rc0",
"cucim-cu12; platform_system == 'Linux' and python_version <= '3.10'",
"cucim-cu13; platform_system == 'Linux' and python_version >= '3.11'",
"einops",
"filelock<3.12.0",
"fire",
"gdown>=4.7.3",
"h5py",
"huggingface_hub",
"imagecodecs; platform_system == 'Linux' or platform_system == 'Darwin'",
"itk>=5.2",
"jsonschema",
"lmdb",
"lpips==0.1.4",
"matplotlib>=3.6.3",
"MetricsReloaded @ git+https://github.com/Project-MONAI/MetricsReloaded@monai-support",
"mlflow>=2.12.2,<3.13",
"nibabel",
"ninja",
"nni; platform_system == 'Linux' and 'arm' not in platform_machine and 'aarch' not in platform_machine",
"nvidia-ml-py",
"onnx_graphsurgeon",
"onnx>=1.13.0",
"onnxruntime; python_version <= '3.10'",
"onnxscript",
"openslide-bin",
"openslide-python",
"optuna",
"pandas",
"pillow!=8.3.0",
"polygraphy",
"psutil",
"pyamg>=5.0.0,<5.3.0",
"pybind11",
"pydicom",
"pynrrd",
"pytorch-ignite",
"pyyaml",
"requests",
"segment_anything @ git+https://github.com/facebookresearch/segment-anything.git@6fdee8f2727f4506cfbbe553e23b895e27956588",
"scikit-image>=0.19.0",
"scipy>=1.12.0",
"tensorboard>=2.12.0",
"tensorboardX",
"tifffile; platform_system == 'Linux' or platform_system == 'Darwin'",
"torchio",
"torchvision",
"tqdm>=4.47.0",
"transformers>=4.53.0, <5.0",
"zarr"
]
clearml = ["clearml>=1.10.0rc0"]
cucim = [
"cucim-cu12; platform_system == 'Linux' and python_version <= '3.10'",
"cucim-cu13; platform_system == 'Linux' and python_version >= '3.11'"
]
cupy = ["cupy-cuda13x!=14.1.0"] # not in all, the choice between cuda12x and cuda13x that can't be resolved here
einops = ["einops"]
fire = ["fire"]
gdown = ["gdown>=4.7.3"]
h5py = ["h5py"]
huggingface_hub = ["huggingface_hub"]
hyena = ["nvsubquadratic>=0.1.1", "omegaconf", "einops"] # omitted from all for compatibility
ignite = ["pytorch-ignite"]
imagecodecs = ["imagecodecs; platform_system == 'Linux' or platform_system == 'Darwin'"]
itk = ["itk>=5.2"]
jsonschema = ["jsonschema"]
lmdb = ["lmdb"]
lpips = ["lpips==0.1.4"]
matplotlib = ["matplotlib>=3.6.3"]
metrics_reloaded = ["MetricsReloaded @ git+https://github.com/Project-MONAI/MetricsReloaded@monai-support"]
mlflow = ["mlflow>=2.12.2,<3.13"]
nibabel = ["nibabel"]
nni = [
"nni; platform_system == 'Linux' and 'arm' not in platform_machine and 'aarch' not in platform_machine",
"filelock<3.12.0" # https://github.com/microsoft/nni/issues/5523
]
onnx = ["onnx>=1.13.0", "onnxruntime; python_version <= '3.10'", "onnx_graphsurgeon", "onnxscript"]
openslide = ["openslide-python", "openslide-bin"]
optuna = ["optuna"]
pandas = ["pandas"]
pillow = ["pillow!=8.3.0"] # https://github.com/python-pillow/Pillow/issues/5571
polygraphy = ["polygraphy"]
psutil = ["psutil"]
pyamg = ["pyamg>=5.0.0,<5.3.0"]
pybind11 = ["pybind11"]
pydicom = ["pydicom"]
pynrrd = ["pynrrd"]
pynvml = ["nvidia-ml-py"]
pyyaml = ["pyyaml"]
requests = ["requests"]
segment_anything = ["segment_anything @ git+https://github.com/facebookresearch/segment-anything.git@6fdee8f2727f4506cfbbe553e23b895e27956588"]
scipy = ["scipy>=1.12.0"]
skimage = ["scikit-image>=0.19.0"]
tensorboard = ["tensorboard>=2.12.0"] # https://github.com/Project-MONAI/MONAI/issues/7434
tensorboardX = ["tensorboardX"]
tifffile = ["tifffile; platform_system == 'Linux' or platform_system == 'Darwin'"]
torchio = ["torchio"]
torchvision = ["torchvision"]
tqdm = ["tqdm>=4.47.0"]
transformers = ["transformers>=4.53.0, <5.0"] # 5.x references torch.float8_e8m0fnu absent in older PyTorch builds
zarr = ["zarr"]
# these dependencies are for testing/building only, they aren't needed for regular use so don't appear in "all"
testing = [
"black>=26.3.1",
"coverage>=5.5",
"isort>=5.1,<6,!=6.0.0",
"mccabe",
"packaging",
"parameterized",
"pep8-naming",
"pre-commit",
"pycodestyle",
"pyflakes",
"pyrefly>=1.0.0",
"ruff>=0.14.11,<0.15",
"tomli", # used in print_dependencies.py for Python<3.11
"typeguard<3", # https://github.com/microsoft/nni/issues/5457
"types-PyYAML",
"types-setuptools"
]
[tool.setuptools]
license-files = ["LICENSE"]
[tool.setuptools.dynamic]
version = {attr = "monai.__version__"}
[tool.versioneer]
VCS = "git"
style = "pep440"
versionfile_source = "monai/_version.py"
versionfile_build = "monai/_version.py"
tag_prefix = ""
parentdir_prefix = ""
[tool.isort]
known_first_party = ["monai"]
profile = "black"
line_length = 120
skip = [".git", ".eggs", "venv", ".venv", "versioneer.py", "_version.py", "conf.py", "monai/__init__.py"]
skip_glob = ["*.pyi"]
add_imports = ["from __future__ import annotations"]
append_only = true
[tool.mypy]
ignore_missing_imports = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = false
warn_return_any = true
strict_equality = true
show_column_numbers = true
show_error_codes = true
pretty = false
warn_unused_configs = true
extra_checks = true
exclude = ["venv/"]
[[tool.mypy.overrides]]
module = ["versioneer", "monai._version", "monai.eggs"]
ignore_errors = true
[[tool.mypy.overrides]]
module = ["monai.*"]
check_untyped_defs = true
disallow_untyped_decorators = true
[[tool.mypy.overrides]]
module = [
"monai._extensions.*",
"monai.apps.*",
"monai.auto3dseg.*",
"monai.bundle.*",
"monai.config.*",
"monai.engines.*",
"monai.fl.*",
"monai.handlers.*",
"monai.inferers.*",
"monai.losses.*",
"monai.metrics.*",
"monai.optimizers.*",
"monai.utils.*",
"monai.visualize.*"
]
disallow_incomplete_defs = true
[tool.coverage.run]
concurrency = ["multiprocessing"]
source = ["."]
data_file = ".coverage/.coverage"
omit = ["setup.py"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]
show_missing = true
skip_covered = true
[tool.coverage.xml]
output = "coverage.xml"
[tool.black]
line-length = 120
target-version = ['py310']
skip-magic-trailing-comma = true
include = '\.pyi?$'
exclude = '''
(
/(
# exclude a few common directories in the root of the project
\.eggs
| \.git
| \.hg
| \.tox
| \.venv
| \.mypy_cache
| \.pytype
| venv
| _build
| buck-out
| build
| dist
)/
# also separately exclude a file named versioneer.py
| versioneer.py
| monai/_version.py
)
'''
[tool.pycln]
all = true
exclude = "monai/bundle/__main__.py"
[tool.ruff]
line-length = 120
target-version = "py310"
[tool.ruff.lint]
select = [
"B", # flake8-bugbear - https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
"C90", # mccabe (complexity) - https://docs.astral.sh/ruff/rules/#mccabe-c90
"E", # pycodestyle errors - https://docs.astral.sh/ruff/rules/#error-e
"F", # pyflakes - https://docs.astral.sh/ruff/rules/#pyflakes-f
"N", # pep8-naming - https://docs.astral.sh/ruff/rules/#pep8-naming-n
"PIE", # flake8-pie - https://docs.astral.sh/ruff/rules/#flake8-pie-pie
"TID", # flake8-tidy-imports - https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid
"W", # pycodestyle warnings - https://docs.astral.sh/ruff/rules/#warning-w
"NPY", # NumPy specific rules
"UP", # pyupgrade
"RUF100", # aka yesqa
]
extend-ignore = [
"E741", # ambiguous variable name
"F401", # unused import
"NPY002", # numpy-legacy-random
"E203", # whitespace before ':' (pycodestyle)
"E501", # line too long (pycodestyle)
"C408", # unnecessary collection call (flake8-comprehensions)
"N812", # lowercase imported as non lowercase (pep8-naming)
"B023", # function uses loop variable (flake8-bugbear)
"B905", # zip() without an explicit strict= parameter (flake8-bugbear)
"B028", # no explicit stacklevel keyword argument found (flake8-bugbear)
]
[tool.ruff.lint.per-file-ignores]
"tests/**" = [
"B018",
"C901",
"N999",
"N801"
]
"monai/apps/detection/utils/ATSS_matcher.py" = [
"N999"
]
[tool.ruff.lint.mccabe]
max-complexity = 50 # todo lower this treshold when yesqa id replaced with Ruff's RUF100
[tool.pytype]
# Space-separated list of files or directories to exclude.
exclude = ["versioneer.py", "_version.py"]
# Space-separated list of files or directories to process.
inputs = ["monai"]
# Keep going past errors to analyze as many files as possible.
keep_going = true
# Run N jobs in parallel.
jobs = 8
# All pytype output goes here.
output = ".pytype"
# Paths to source code directories, separated by ':'.
pythonpath = "."
# Check attribute values against their annotations.
check_attribute_types = true
# Check container mutations against their annotations.
check_container_types = true
# Check parameter defaults and assignments against their annotations.
check_parameter_types = true
# Check variable values against their annotations.
check_variable_types = true
# Comma or space separated list of error names to ignore.
disable = ["pyi-error"]
# Report errors.
report_errors = true
# Experimental: Infer precise return types even for invalid function calls.
precise_return = true
# Experimental: solve unknown types to label with structural types.
protocols = true
# Experimental: Only load submodules that are explicitly imported.
strict_import = false
[tool.pyrefly]
# Check only the monai package
project-includes = ["monai/"]
# Exclude auto-generated and vendored files
project-excludes = [
"**/venv/**",
"**/.venv/**",
"versioneer.py",
"monai/_version.py",
]
# Match CI environment
python-version = "3.10"
python-platform = "linux"
# "legacy" preset provides a smooth migration from previous type checkers
preset = "legacy"
# Check unannotated defs (previously enforced in mypy config)
check-unannotated-defs = true
[tool.pyrefly.errors]
# Ignore missing imports
missing-import = "ignore"
# Suppress unused-ignore warnings
unused-ignore = "ignore"
# Suppress implicit-import globally (MONAI style uses lazy imports)
implicit-import = "ignore"
# Downgrade errors in unannotated/dynamic code to warnings
# (pre-existing issues, not new — will fix incrementally)
bad-assignment = "warn"
bad-return = "warn"
bad-argument-type = "warn"
invalid-annotation = "ignore"
not-iterable = "warn"
not-callable = "warn"
bad-index = "warn"
# Pre-existing errors not flagged by previous type checkers
# Suppress for a smooth migration; fix incrementally
missing-attribute = "ignore"
bad-override = "ignore"
no-matching-overload = "ignore"
unsupported-operation = "ignore"
unnecessary-type-conversion = "ignore"
missing-module-attribute = "ignore"
not-a-type = "ignore"
invalid-yield = "ignore"
deprecated = "ignore"