Skip to content

Conversation

melonora
Copy link
Collaborator

@melonora melonora commented Sep 17, 2025

This PR provides initial support for Zarr v3 in SpatialData. These changes include the following:

  • To support the newer Zarr v3 versions, Python support for version 3.10 had to be dropped.
  • the use of the format argument for writing operations will be deprecated in version 0.7.0 as format is a Python builtin,
    Please use sdata_formats instead, argument type stays the same.
  • All functions and arguments that were marked for deprecation prior to the current SpatialData version now have been deprecated, vastly reducing the number of warnings for the user.
  • Added option of reconsolidating metadata before reading SpatialData. This is added because if SpatialData is written with consolidated metadata and this metadata gets corrupted, the zarr store cannot be opened. Setting reconsolidate_metadata to True when reading, will rewrite the consolidated metadata store after which is then should be possible to open the zarr store again.
  • If a SpatialData zarr store is read and detected to be stored in the old format, a warning is given to the user. Users can silence this with this PR only when they rewrite the SpatialData object to a new location. In a next PR, we will enable rewriting solely the metadata if possible (if the user did not store using sharding).

melonora and others added 28 commits September 10, 2025 17:41
* refactor read_zarr

* remove unneccesary checks
* refactor read_zarr

* remove unneccesary checks

* emit warning with old spatialdata storage version detected
@melonora
Copy link
Collaborator Author

@falexwolf @Zethson @BioinfoTongLI, waiting for small review of last few commits from Luca. PR description states most of the user facing changes, but should not be too different.

I noticed that right now the formats can only be imported from private module. I will move these to the public API and provide docs in a future PR soon. @falexwolf or @Zethson does this PR now still work with all your workflows?

Copy link

codecov bot commented Sep 17, 2025

Codecov Report

❌ Patch coverage is 91.92913% with 41 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.12%. Comparing base (3f01688) to head (5521a2a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/spatialdata/_io/_utils.py 61.70% 18 Missing ⚠️
src/spatialdata/_io/io_raster.py 91.17% 6 Missing ⚠️
src/spatialdata/models/models.py 81.48% 5 Missing ⚠️
src/spatialdata/_io/format.py 96.11% 4 Missing ⚠️
src/spatialdata/_io/io_shapes.py 92.85% 3 Missing ⚠️
src/spatialdata/_io/io_zarr.py 96.25% 3 Missing ⚠️
src/spatialdata/_core/spatialdata.py 98.87% 1 Missing ⚠️
src/spatialdata/_io/io_points.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #985      +/-   ##
==========================================
- Coverage   92.36%   92.12%   -0.25%     
==========================================
  Files          48       48              
  Lines        7416     7469      +53     
==========================================
+ Hits         6850     6881      +31     
- Misses        566      588      +22     
Files with missing lines Coverage Δ
src/spatialdata/__init__.py 96.42% <100.00%> (ø)
src/spatialdata/_core/_deepcopy.py 98.36% <100.00%> (ø)
src/spatialdata/_core/_elements.py 92.13% <100.00%> (-0.18%) ⬇️
src/spatialdata/_core/concatenate.py 92.12% <100.00%> (+0.12%) ⬆️
src/spatialdata/_core/operations/_utils.py 96.00% <100.00%> (ø)
src/spatialdata/_core/operations/aggregate.py 94.31% <100.00%> (ø)
src/spatialdata/_core/operations/rasterize_bins.py 93.79% <100.00%> (+0.04%) ⬆️
src/spatialdata/_core/operations/vectorize.py 93.08% <ø> (ø)
src/spatialdata/_core/query/relational_query.py 91.50% <100.00%> (+0.37%) ⬆️
src/spatialdata/_core/query/spatial_query.py 95.65% <ø> (-0.11%) ⬇️
... and 16 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants