Skip to content

Commit 9d5abca

Browse files
meastyshaneahmedpre-commit-ci[bot]aacicJiaqi-Lv
authored
⬆️ Upgrade Zarr to v3+ Compatibility (#904)
## ✅ Summary - Enables compatibility with Zarr v3+ - Simplifies error handling across Zarr versions - Removes deprecated storage backends and APIs - Lays groundwork for full Zarr v3 migration This PR updates TIAToolbox to support **Zarr v3+**, addressing breaking changes introduced in Zarr ≥ 3.0 and aligning internal APIs, storage handling, and error handling accordingly. --- Zarr v3 removed `zarr.errors.FSPathExistNotDir`. In Zarr ≥ 3.0, equivalent failure modes now raise standard Python exceptions (e.g. `FileNotFoundError`). To avoid fragile version-specific logic: - Removed checks for specific Zarr exception types - Replaced them with generic exception handling that works consistently across Zarr versions --- ## 🔧 Key changes ### Dependency updates - 🆙 Upgrade to: - `zarr >= 3.0.8` - `tifffile >= 2025.5.21` ### Zarr API & storage migration - Refactor `zarr.core.Array` → `zarr.Array` - Replace `zarr.DirectoryStore` with `zarr.storage.LocalStore` - Remove `ngff.sqlitestore` (Zarr v3 no longer supports `zarr.SQLiteStore`) - Replace `canvas_zarr.store.path` with `canvas_zarr.store.root` - Ensure Zarr paths explicitly use string keys (`key / str(i)` instead of `key / i`) ### Dask & array handling - Remove unsupported `object_codec` usage in `dask.to_zarr` - Update `zarr.resize` calls to use tuple inputs - Replace `output.items()` with `output.members()` --- ## ⚠️ Known limitations & follow‑ups Zarr v3 removes or significantly changes several APIs still used by TIAToolbox, including: - `zarr.LRUStoreCache` - `zarr.DirectoryStore` - `zarr.SQLiteStore` While this PR resolves immediate incompatibilities and enables Zarr v3 usage, **additional refactoring will be required** to fully replace or redesign components that depend on these removed features. In addition, **full compatibility with `tifffile` depends on upstream Zarr v3 support**, and some workflows may remain limited until that stabilises. 📖 For a detailed overview of breaking changes, see the official Zarr v3 migration guide: https://zarr.readthedocs.io/en/latest/user-guide/v3_migration.html --------- Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Aleksandar Acic <32873451+aacic@users.noreply.github.com> Co-authored-by: Jiaqi Lv <lvjiaqi9@gmail.com>
1 parent 3ca1599 commit 9d5abca

26 files changed

Lines changed: 856 additions & 283 deletions

.github/workflows/mypy-type-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
4848
- name: Perform type checking
4949
run: |
50-
mypy --install-types --non-interactive --follow-imports=silent \
50+
mypy --install-types --non-interactive --follow-imports=skip --ignore-missing-imports \
5151
tiatoolbox/__init__.py \
5252
tiatoolbox/__main__.py \
5353
tiatoolbox/type_hints.py \

requirements/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ scipy>=1.8
3030
shapely>=2.0.0
3131
SimpleITK>=2.2.1
3232
sphinx>=5.3.0, <9.0.0
33-
tifffile>=2022.10.10, <=2025.5.10
33+
tifffile>=2025.5.21
3434
timm>=1.0.3
3535
torch>=2.5.0
3636
torchvision>=0.15.0
3737
tqdm>=4.64.1
3838
transformers>=4.51.1
3939
umap-learn>=0.5.3
4040
wsidicom>=0.18.0
41-
zarr>=2.13.3, <3.0.0
41+
zarr>=3.0.8

0 commit comments

Comments
 (0)