Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
293 lines (263 loc) · 11.9 KB
/
Copy pathpyproject.toml
File metadata and controls
293 lines (263 loc) · 11.9 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
[build-system]
requires = ["setuptools>=77", "wheel", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"
[project]
name = "konfai"
dynamic = ["version"]
description = "A declarative execution engine for reproducible medical-imaging workflows"
readme = "README.md"
license = "Apache-2.0"
license-files = ["LICENSE"]
requires-python = ">=3.11"
authors = [
{ name = "Valentin Boussot", email = "boussot.v@gmail.com" }
]
keywords = ["deep learning", "medical imaging", "workflow", "streaming", "YAML", "PyTorch", "reproducibility"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dependencies = [
# 2.3 is the first torch with the unsigned dtypes: a uint16 store (what microscopy writes) reaches
# torch.from_numpy on the read route, and torch.uint16 is named where a label map's sign is read.
# 2.5 is the first with torch.serialization.safe_globals, which konfai_apps.bundle loads a run's checkpoint under.
"torch>=2.5",
"tqdm",
# 2.0: np._core and np.dtypes, the numpy types konfai_apps.bundle lets through for a checkpoint's numpy scalars.
"numpy>=2",
"ruamel.yaml",
"psutil",
# Published weights (apps) are .safetensors: read and written without pickle.
"safetensors"
]
[project.urls]
Homepage = "https://github.com/fideus-labs/KonfAI"
Repository = "https://github.com/fideus-labs/KonfAI"
Issues = "https://github.com/fideus-labs/KonfAI/issues"
License = "https://www.apache.org/licenses/LICENSE-2.0"
[project.scripts]
konfai = "konfai.main:main"
konfai-cluster = "konfai.main:cluster"
[project.optional-dependencies]
itk = ["SimpleITK>=2.0"]
hdf5 = ["h5py"]
monitoring = ["nvidia-ml-py"]
tensorboard = ["tensorboard"]
imaging = ["SimpleITK>=2.0", "h5py", "pydicom", "zarr>=3", "ngff-zarr>=0.49", "dask"]
vtk = ["vtk"]
lpips = ["lpips"]
smp = ["segmentation-models-pytorch"]
cluster = ["submitit"]
dicom = ["pydicom"]
omezarr = ["zarr>=3", "ngff-zarr>=0.49", "dask"]
# Reading a dataset root from S3: s3fs is the fsspec implementation, aiohttp the transport
# aiobotocore drives it over. fsspec itself already comes with the OME-Zarr extra, through dask.
s3 = ["s3fs", "aiohttp"]
export = ["onnx", "onnxruntime", "onnxscript"]
# `konfai <WORKFLOW> --check`: a config against its JSON Schema (konfai.config_schema.config_errors).
check = ["jsonschema"]
# MONAI Bundles (konfai.bundle) and the MONAI networks the docs wrap (monai.networks.nets:UNet).
monai = ["monai"]
all = [
"konfai[itk]",
"konfai[hdf5]",
"konfai[monitoring]",
"konfai[tensorboard]",
"konfai[vtk]",
"konfai[lpips]",
"konfai[cluster]",
"konfai[dicom]",
"konfai[omezarr]",
"konfai[s3]",
"konfai[export]",
"konfai[check]",
"konfai[smp]",
# The IMPACT criteria download their feature extractors from the Hub; imported lazily,
# and their refusal names this extra.
"huggingface_hub"
]
dev = [
"SimpleITK>=2.0",
"h5py",
"pydicom",
"zarr>=3",
"ngff-zarr[validate]>=0.49",
"dask",
"scikit-image",
"onnx",
"onnxruntime",
"onnxscript",
"jsonschema",
"nvidia-ml-py",
"tensorboard",
"pytest",
"pytest-cov",
"pytest-xdist",
"jsonschema",
"pre-commit",
"ruff==0.15.2",
"mypy",
"build",
"types-requests",
# The docs toolchain: keep in sync with docs/requirements.txt (the RTD list).
"sphinx>=7.0",
"shibuya",
"myst-parser",
"sphinx-autodoc-typehints",
"sphinx-copybutton",
"sphinx-togglebutton",
"sphinx-tabs",
"sphinxcontrib-mermaid"
]
[tool.setuptools_scm]
tag_regex = "^v(?P<version>.*)$"
local_scheme = "no-local-version"
[tool.setuptools.packages.find]
# "konfai.*" (with the dot) keeps namespace subpackages such as konfai.models.* while NOT matching
# the sibling "konfai-apps" directory (hyphen), which the old "konfai*" glob wrongly bundled into the
# published wheel. Keep the default namespaces=true so PEP 420 packages (konfai/models) ship.
include = ["konfai", "konfai.*"]
exclude = ["apps*", "konfai-apps*"]
[tool.setuptools.package-data]
# Ship the declarative model catalog (konfai/models/yaml/*.yml) and the PEP 561 marker in the wheel.
"konfai" = ["py.typed"]
"konfai.models.yaml" = ["*.yml"]
[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-arm64", "win-64"]
[tool.pixi.pypi-dependencies]
# The dev extra IS the dev environment: one list, so `pixi run check` and CI (`pip install -e
# ".[dev]"`) exercise the same dependencies. Only twine and submitit are pixi-only additions.
konfai = { path = ".", editable = true, extras = ["dev"] }
[tool.pixi.dependencies]
python = ">=3.11,<3.14"
pip = "*"
[tool.pixi.environments]
default = { solve-group = "default" }
dev = { features = ["dev"], solve-group = "default" }
lint = { features = ["lint"], no-default-feature = true, solve-group = "default" }
docs = { features = ["default", "docs"], solve-group = "default" }
# ---------------------------------------------------------------------------
# Feature: dev
# ---------------------------------------------------------------------------
[tool.pixi.feature.dev.pypi-dependencies]
twine = "*"
submitit = "*"
[tool.pixi.feature.dev.tasks]
test = { cmd = "pytest -n auto --dist loadfile tests/", env = { OMP_NUM_THREADS = "1" }, description = "Run the test suite (one torch thread per worker: 8x faster on a 24-core box)" }
test-fast = { cmd = 'pytest -n auto --dist loadfile -m "not slow and not integration" tests/', env = { OMP_NUM_THREADS = "1" }, description = "Run the test suite without slow oracle and integration tests" }
test-apps = { cmd = "pytest konfai-apps/tests", env = { OMP_NUM_THREADS = "1" }, description = "Run the konfai-apps test suite" }
test-cov = { cmd = "pytest -n auto --dist loadfile --cov=konfai --cov-report=term-missing tests/", env = { OMP_NUM_THREADS = "1" }, description = "Run tests with coverage" }
lint = { cmd = "ruff check konfai konfai-apps/konfai_apps konfai-mcp/konfai_mcp konfai-studio/konfai_studio apps tests examples benchmarks docs", description = "Lint source code" }
format = { cmd = "ruff format konfai konfai-apps/konfai_apps konfai-mcp/konfai_mcp konfai-studio/konfai_studio apps tests examples benchmarks docs", description = "Format source code" }
format-check = { cmd = "ruff format --check konfai konfai-apps/konfai_apps konfai-mcp/konfai_mcp konfai-studio/konfai_studio apps tests examples benchmarks docs", description = "Check formatting without modifying files" }
typecheck = { cmd = "python -m mypy konfai konfai-apps/konfai_apps konfai-mcp/konfai_mcp konfai-studio/konfai_studio", description = "Type-check all packages ([tool.mypy] governs; real stubs in use)" }
build = { cmd = "python -m build", description = "Build sdist and wheel" }
perf-check = { cmd = "python benchmarks/perf/perf_check.py", description = "Run the perf series on a quiet machine and compare it to this host's committed baseline (benchmarks/perf/baselines)" }
check = { depends-on = ["lint", "format-check", "test", "test-apps"], description = "Run all quality checks" }
# ---------------------------------------------------------------------------
# Feature: lint
# ---------------------------------------------------------------------------
[tool.pixi.feature.lint.dependencies]
python = ">=3.11,<3.14"
[tool.pixi.feature.lint.pypi-dependencies]
ruff = "==0.15.2"
pre-commit = "*"
[tool.pixi.feature.lint.tasks]
pre-commit-install = { cmd = "pre-commit install --hook-type pre-commit --hook-type commit-msg", description = "Install pre-commit and commit-msg hooks" }
pre-commit-run = { cmd = "pre-commit run --all-files", description = "Run pre-commit hooks on all repository files" }
# ---------------------------------------------------------------------------
# Feature: docs
# ---------------------------------------------------------------------------
[tool.pixi.feature.docs.dependencies]
python = ">=3.11,<3.14"
[tool.pixi.feature.docs.pypi-dependencies]
sphinx = ">=7.0"
shibuya = "*"
myst-parser = "*"
sphinx-autodoc-typehints = "*"
sphinx-copybutton = "*"
sphinx-togglebutton = "*"
sphinx-tabs = "*"
sphinxcontrib-mermaid = "*"
[tool.pixi.feature.docs.tasks]
build-docs = { cmd = "make html", cwd = "docs", description = "Build Sphinx documentation" }
dev-docs = { cmd = "sphinx-autobuild docs/source docs/_build/html", description = "Live-reload docs during development" }
# ---------------------------------------------------------------------------
# Ruff (replaces black + flake8 + isort)
# ---------------------------------------------------------------------------
[tool.ruff]
line-length = 120
src = ["konfai", "konfai-apps/konfai_apps"]
# The demo notebooks are left out: formatting would rewrite the cell layout they were written with.
extend-exclude = ["*.ipynb"]
[tool.ruff.lint]
select = ["E", "F", "W", "B", "I", "UP", "C4", "RUF"]
extend-ignore = ["E501", "B006", "B008"]
# ---------------------------------------------------------------------------
# Pytest
# ---------------------------------------------------------------------------
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q"
markers = [
"slow: marks tests as slow (deselect with -m 'not slow')",
"integration: marks integration tests",
]
filterwarnings = [
# SimpleITK's GetImageFromArray/GetArrayViewFromImage assigns array.shape in place
# (SimpleITK/extra.py), which NumPy 2.5 deprecated: ~1000 copies per heavy file run bury every
# other warning. Drop this once the SimpleITK floor ships a reshape-based fix.
"ignore:Setting the shape on a NumPy array has been deprecated:DeprecationWarning:SimpleITK",
]
# ---------------------------------------------------------------------------
# Mypy
# ---------------------------------------------------------------------------
[tool.mypy]
ignore_missing_imports = true
check_untyped_defs = true
# No `python_version`: mypy analyses as the interpreter it runs on, which is the only version whose
# stubs are installed. Pinning it to the floor of `requires-python` makes mypy refuse to parse
# NumPy's stubs (they use `type` statements) and a parse error inside a dependency stops the whole
# analysis. Syntax newer than 3.11 is caught by ruff instead, which infers its target from
# `requires-python` (rule set `UP`).
# ---------------------------------------------------------------------------
# Commitizen
# ---------------------------------------------------------------------------
[tool.commitizen]
name = "cz_conventional_commits"
# The git tag is the only place a version exists -- setuptools_scm derives the package version from
# it, and `scm` makes Commitizen read it from there too. No version string is committed anywhere, so
# none can drift from the tag that built the wheel.
version_provider = "scm"
tag_format = "v$version"
annotated_tag = true
changelog_file = "CHANGELOG.md"
# The changelog IS the release notes: the publish workflow renders one version's section and posts it
# as the GitHub Release body, so a released version is never described in two places that disagree.
update_changelog_on_bump = true
# Conventional Commits' own changelog set: feat, fix, refactor, perf and breaking changes -- what a
# reader of this package gets that they did not have. `docs`, `test`, `ci` and `chore` are out. They
# could be let in, but only by shipping a Commitizen plugin to widen `commit_parser` (a class
# attribute, not a setting), and a package to maintain is a steep price for two more bullet points.
change_type_order = [
"💥 Breaking changes",
"✨ Features",
"🐛 Bug Fixes",
"⚡ Performance",
"♻️ Refactoring",
]
[tool.commitizen.change_type_map]
"BREAKING CHANGE" = "💥 Breaking changes"
feat = "✨ Features"
fix = "🐛 Bug Fixes"
perf = "⚡ Performance"
refactor = "♻️ Refactoring"