Skip to content

Enable write to existing zarr store#2366

Open
joshua-gould wants to merge 2 commits intoscverse:mainfrom
joshua-gould:write-zarr-store
Open

Enable write to existing zarr store#2366
joshua-gould wants to merge 2 commits intoscverse:mainfrom
joshua-gould:write-zarr-store

Conversation

@joshua-gould
Copy link
Copy Markdown
Contributor

Added ability for write_zarr to accept a zarr group

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.95%. Comparing base (c9d6046) to head (90bcc92).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/anndata/experimental/backed/_io.py 25.00% 3 Missing ⚠️

❌ Your project check has failed because the head coverage (58.95%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (c9d6046) and HEAD (90bcc92). Click for more details.

HEAD has 9 uploads less than BASE
Flag BASE (c9d6046) HEAD (90bcc92)
12 3
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2366       +/-   ##
===========================================
- Coverage   87.35%   58.95%   -28.41%     
===========================================
  Files          49       49               
  Lines        7784     7776        -8     
===========================================
- Hits         6800     4584     -2216     
- Misses        984     3192     +2208     
Files with missing lines Coverage Δ
src/anndata/_core/anndata.py 62.84% <ø> (-20.51%) ⬇️
src/anndata/_io/specs/registry.py 82.77% <100.00%> (-12.09%) ⬇️
src/anndata/_io/zarr.py 69.41% <100.00%> (-10.36%) ⬇️
src/anndata/experimental/backed/_io.py 37.25% <25.00%> (-59.11%) ⬇️

... and 28 files with indirect coverage changes

Copy link
Copy Markdown
Contributor

@ilan-gold ilan-gold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshua-gould Awesome feature - could you look at

if k == "/":
if isinstance(store, ZarrGroup):
from zarr.core.sync import sync
sync(store.store.clear())
else:
store.clear()
elif k in store:
del store[k]
. This is just some old behavior that was never updated but I think this should be relaxed to just clear out all subgroups/keys instead of blindly clearing the entire store. I'm concerned about writing to an existing group but then you end up deleting all of its contents even those in "parent" groups

Other than that, this looks good to me!

Added additional tests for overwriting existing zarr and writing to separate groups in a single zarr
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