Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
353 lines (315 loc) · 12.9 KB
/
Copy pathpyproject.toml
File metadata and controls
353 lines (315 loc) · 12.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
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
# https://peps.python.org/pep-0517/
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
# https://hatch.pypa.io/latest/config/metadata/
[tool.hatch.version]
source = "vcs"
# read more about configuring hatch at:
# https://hatch.pypa.io/latest/config/build/
[tool.hatch.build.targets.wheel]
packages = ["src/ngio"]
# https://peps.python.org/pep-0621/
[project]
name = "ngio"
dynamic = ["version"]
description = "Next Generation file format IO"
readme = "README.md"
requires-python = ">=3.11"
license = { text = "BSD-3-Clause" }
authors = [{ name = "Lorenzo Cerrone", email = "lorenzo.cerrone@uzh.ch" }]
# https://pypi.org/classifiers/
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Typing :: Typed",
]
# add your package dependencies here
# Every floor below is exercised by the `test-min-deps` CI leg, which installs
# exactly these versions. Do not lower one without re-running that leg.
dependencies = [
"numpy>=2.0", # zarr 3.1.6 requires numpy>=2
"filelock>=3.12",
# `zarr>3` excluded 3.0.0 itself. ngio needs `WrapperStore` and the
# `is_group_listable` behaviour, both of which land in 3.1.6.
"zarr>=3.1.6",
"scipy>=1.14", # first release supporting numpy 2
# Below 2025.3 `NgioStore.sync_fs_and_path` returns an async filesystem and
# zarr's FsspecStore rejects it.
"fsspec>=2025.3",
# Floor: `settings.auto_shard_zarr_v3` (used by the AnnData backend) appears
# in 0.12.5. Upper cap is deliberate: `_anndata_utils.py` imports six private
# anndata symbols and vendors a copy of its zarr reader.
"anndata>=0.12.5,<0.14.0",
"pydantic>=2.11.5", # required by ome-zarr-models
"pandas>=2.2.2", # first 2.2.x supporting numpy 2 on py3.11
"aiohttp>=3.9",
"dask[array]>=2025.12", # 2025.11.0 raises to_zarr's rechunk PerformanceWarning
# "xarray", still not used
"ome-zarr-models>=1.4", # `ValidTransform` was added in 1.4
"pooch>=1.8",
"polars>=1.0",
"pyarrow>=16", # 15 caps numpy<2
"pillow>=10",
]
# https://peps.python.org/pep-0621/#dependencies-optional-dependencies
# "extras" (e.g. for `pip install .[test]`)
[project.optional-dependencies]
# S3 streaming, as advertised in the README. Without this extra `s3fs` only
# arrives transitively via `test`, so following the README raises ImportError.
# The floor is not cosmetic: `refresh_s3fs_config` runs at import of
# `ngio.utils._zarr_utils` and calls `s3fs.set_custom_error_handler`, which was
# added in s3fs 2026.2.0. With an older s3fs installed, `import ngio` raises
# AttributeError.
s3 = ["s3fs>=2026.2.0"]
test = [
"pytest",
"pytest-cov",
"pytest-xdist",
"scikit-image",
"boto3",
# aiomoto brings moto[server] + s3fs + fsspec + pyarrow, and caps
# aiobotocore<=3.7.0 / moto<=5.2.1 so the universal solve can't backtrack
# s3fs to the ancient 0.4.2 (see error_report.md).
"aiomoto[pandas]",
]
dev = [
"zarrs",
"Pympler",
"napari",
"pyqt5",
"matplotlib",
"notebook",
"ty",
"pdbpp", # https://github.com/pdbpp/pdbpp
"prek", # drop-in pre-commit replacement, see .pre-commit-config.yaml
"rich", # https://github.com/Textualize/rich
"ruff",
"scikit-image",
] # add anything else you like to have in your dev environment here
docs = [
"ruff",
"zensical",
"mkdocstrings[python]",
"mkdocs-autorefs",
"markdown-exec[ansi]",
# Was only transitive via mkdocs-material, which Zensical replaces.
"pymdown-extensions",
"griffe-typingdoc",
"scikit-image",
"matplotlib",
"tabulate",
"rich",
]
# `mike` is deliberately NOT listed above: Zensical needs the maintainers' fork, which is
# only installable from git, and a PEP 508 direct reference in optional-dependencies would
# make ngio unpublishable to PyPI. It lives in the pixi docs feature instead.
[project.urls]
homepage = "https://github.com/BioVisionCenter/ngio"
repository = "https://github.com/BioVisionCenter/ngio"
# Entry points
# https://peps.python.org/pep-0621/#entry-points
# same as console_scripts entry point
# [project.scripts]
# ngio-cli = "ngio:main_cli"
# [project.entry-points."some.group"]
# tomatoes = "ngio:main_tomatoes"
# https://docs.astral.sh/ruff
[tool.ruff]
line-length = 88
target-version = "py311"
src = ["src"]
# https://docs.astral.sh/ruff/rules
[tool.ruff.lint]
select = [
"E", # style errors
"W", # style warnings
"F", # flakes
"D", # pydocstyle
"I", # isort
"UP", # pyupgrade
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"A001", # flake8-builtins
"RUF", # ruff-specific rules
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
]
ignore = [
"D401", # First line should be in imperative mood (remove to opt in)
]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["D"]
# Doc snippets are split into sections that are rendered as standalone code blocks,
# so each section repeats the imports it needs.
"docs/snippets/**/*.py" = ["D", "E402", "F811", "I001"]
[tool.ruff.lint.pydocstyle]
convention = "google"
# https://docs.astral.sh/ruff/formatter/
[tool.ruff.format]
docstring-code-format = true
# https://docs.astral.sh/ty
[tool.ty.environment]
python = ".pixi/envs/dev"
[tool.ty.rules]
unresolved-import = "warn"
# https://docs.pytest.org/
[tool.pytest.ini_options]
minversion = "8.0"
testpaths = ["tests"]
# `tests.performance` is imported as a PEP 420 namespace package by its own
# modules, which needs the repo root importable.
pythonpath = ["."]
filterwarnings = [
"error",
"ignore::zarr.errors.ZarrUserWarning", # required for anndata
"ignore::anndata._warnings.ImplicitModificationWarning", # anndata internal index coercion
"ignore::UserWarning:anndata._io.zarr", # anndata zarr v2→v3 migration notice
# anndata<=0.13.4 reads the `future.infer_string` option that pandas 3.1
# deprecated (Pandas4Warning). Fixed upstream but unreleased
# (scverse/anndata#2672); drop once the floor is an anndata that has it.
# Message-only: the Pandas4Warning class does not exist in pandas 2.x.
"ignore:The 'future.infer_string' option is deprecated",
# Windows only: every atomic_* call warns that its lock is best-effort there.
# Global rather than per-test, so a new atomic_* test cannot forget it and
# break the Windows jobs. The `warns_on_windows` tests assert the warning
# explicitly via pytest.warns, which overrides this filter.
"ignore:ngio's file lock is not exclusive on Windows",
# Announces a coming default under a caller who did not pick one: today
# `max_workers` on every plate-wide fan-out, and `mode` on every pyramid
# consolidation small enough for the in-memory path. Global rather than
# per-test: the suite exercises those paths from dozens of places and ngio's
# own tests are not the audience for the notice. `test_max_workers_default.py`
# and `test_pyramid.py::test_consolidate_warns_*` assert them explicitly via
# pytest.warns, which overrides this filter.
"ignore::ngio.utils._warnings.NgioFutureWarning",
]
addopts = [
"-vv",
"--color=yes",
]
markers = [
"network: test requires internet access (deselect with '-m \"not network\"')",
]
# https://coverage.readthedocs.io/
[tool.coverage.run]
source = ["ngio"]
# The concurrency tests run their workers in real subprocesses, so without this
# every line they exercise — the file lock, `atomic_add_image` — would read as
# uncovered. pytest-cov combines the per-process data files.
concurrency = ["multiprocessing"]
parallel = true
[tool.coverage.report]
show_missing = true
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"@overload",
"except ImportError",
"\\.\\.\\.",
"raise NotImplementedError()",
"pass",
]
# https://github.com/mgedmin/check-manifest#configuration
# add files that you want check-manifest to explicitly ignore here
# (files that are in the repo but shouldn't go in the package)
# https://github.com/crate-ci/typos
[tool.typos.default.extend-words]
# Acronyms
OME = "OME"
FO = "FO"
# Surname
Comparin = "Comparin"
# clipPath id in the detection figure of docs/getting_started/6_iterators.md
odf = "odf"
[tool.check-manifest]
ignore = [
".pre-commit-config.yaml",
".ruff_cache/**/*",
".github/**/*",
"docs/**/*",
"pixi.lock",
"mkdocs.yml",
"CHANGELOG.md",
"tests/**/*",
]
[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["osx-arm64", "linux-64", "win-64"]
[tool.pixi.pypi-dependencies]
ngio = { path = ".", editable = true }
[tool.pixi.feature.dev.dependencies]
python = ">=3.11,<3.12"
[tool.pixi.feature.dev.tasks]
lint = "prek run --all-files"
[tool.pixi.feature.py11.dependencies]
python = ">=3.11,<3.12"
[tool.pixi.feature.py12.dependencies]
python = ">=3.12,<3.13"
[tool.pixi.feature.py13.dependencies]
python = ">=3.13,<3.14"
[tool.pixi.feature.py14.dependencies]
python = ">=3.14,<3.15"
[tool.pixi.feature.docs.pypi-dependencies]
# Zensical's versioning story is a fork of mike that is not published to PyPI.
# Kept here rather than in [project.optional-dependencies] so ngio itself stays
# publishable (PyPI rejects direct URL references).
mike = { git = "https://github.com/squidfunk/mike.git" }
[tool.pixi.feature.docs.tasks]
serve_docs = "zensical serve"
# --strict matters: without it `zensical build` exits 0 and prints "No issues found"
# even when markdown-exec code blocks raised, silently publishing tracebacks.
# --clean avoids reusing cached HTML from a previous (possibly broken) build.
build_docs = "zensical build --clean --strict"
# Drops the generated stores but keeps the downloaded archives cached in ./data.
# `data/tmp` is the shared staging dir `download_ome_zarr_dataset` extracts through; an
# interrupted build can leave a half-extracted dataset there, and every later build then
# fails with "Expected one directory to be extracted, got 2". Clearing it is the fix.
clean_docs_data = "rm -rf ./data/tmp ./data/*.zarr"
snip_quickstart = "python docs/snippets/getting_started/quickstart.py > /dev/null"
snip_get_started = "python docs/snippets/getting_started/get_started.py > /dev/null"
snip_masked_images = "python docs/snippets/getting_started/masked_images.py > /dev/null"
snip_iterators = "python docs/snippets/getting_started/iterators.py > /dev/null"
snip_hcs = "python docs/snippets/getting_started/hcs.py > /dev/null"
snip_create_ome_zarr = "python docs/snippets/tutorials/create_ome_zarr.py > /dev/null"
snip_image_processing = "python docs/snippets/tutorials/image_processing.py > /dev/null"
snip_image_segmentation = "python docs/snippets/tutorials/image_segmentation.py > /dev/null"
snip_stitching = "python docs/snippets/tutorials/stitching.py > /dev/null"
snip_object_detection = "python docs/snippets/tutorials/object_detection.py > /dev/null"
snip_feature_extraction = "python docs/snippets/tutorials/feature_extraction.py > /dev/null"
snip_distributed_processing = "python docs/snippets/tutorials/distributed_processing.py > /dev/null"
snip_hcs_exploration = "python docs/snippets/tutorials/hcs_exploration.py > /dev/null"
# Must stay sequential: `download_ome_zarr_dataset` stages every extraction through a
# single shared `<download_dir>/tmp` that it wipes on entry, so two scripts downloading
# at once clobber each other. (`depends-on` would run them in parallel.)
test_snippets = """
python docs/snippets/getting_started/quickstart.py > /dev/null &&
python docs/snippets/getting_started/get_started.py > /dev/null &&
python docs/snippets/getting_started/masked_images.py > /dev/null &&
python docs/snippets/getting_started/iterators.py > /dev/null &&
python docs/snippets/getting_started/hcs.py > /dev/null &&
python docs/snippets/tutorials/create_ome_zarr.py > /dev/null &&
python docs/snippets/tutorials/image_processing.py > /dev/null &&
python docs/snippets/tutorials/image_segmentation.py > /dev/null &&
python docs/snippets/tutorials/stitching.py > /dev/null &&
python docs/snippets/tutorials/object_detection.py > /dev/null &&
python docs/snippets/tutorials/feature_extraction.py > /dev/null &&
python docs/snippets/tutorials/distributed_processing.py > /dev/null &&
python docs/snippets/tutorials/hcs_exploration.py > /dev/null
"""
[tool.pixi.environments]
default = { solve-group = "default" }
docs = { features = ["docs"], solve-group = "py11" }
# test envs
test11 = { features = ["py11", "test"], solve-group = "py11" }
test12 = { features = ["py12", "test"], solve-group = "py12" }
test13 = { features = ["py13", "test"], solve-group = "py13" }
test14 = { features = ["py14", "test"], solve-group = "py14" }
# dev env
dev = { features = ["dev", "test"], solve-group = "py11" }
test = { features = ["test"], solve-group = "py11" }