Skip to content

Adapt tests that use zarr to work on zarr < 3 and zarr > 3.2.0 - #8943

Merged
brisvag merged 4 commits into
napari:mainfrom
psobolewskiPhD:fix_zarr3_2_tests
May 11, 2026
Merged

brisvag merged 4 commits into
napari:mainfrom
psobolewskiPhD:fix_zarr3_2_tests

Conversation

@psobolewskiPhD

@psobolewskiPhD psobolewskiPhD commented May 1, 2026 •

Copy link
Copy Markdown
Member

References and relevant issues

Closes: #8938

Description

In zarr 3.2.0 some things from zarr < 3 that were deprecated have been removed affecting the way we create test data. See:
zarr-developers/zarr-python#3901
and
zarr-developers/zarr-python#3902

In this PR I implement checks whether using zarr > 3 or not and based on that use the correct argument and method, because zarr 3.0.0 dropped support for py310 that we still test napari on.
Note: These changes are for the arrays we create in tests, not reading itself.

Once we drop py310 support we can switch to just the zarr > 3 API.

@psobolewskiPhD
psobolewskiPhD requested a review from a team as a code owner May 1, 2026 23:02
@github-actions github-actions Bot added the tests Something related to our tests label May 1, 2026
@psobolewskiPhD psobolewskiPhD added the maintenance PR with maintance changes, label May 1, 2026
@psobolewskiPhD psobolewskiPhD added this to the 0.7.1 milestone May 1, 2026
@psobolewskiPhD

Copy link
Copy Markdown
Member Author

OK, so zarr > 3 requires python > 3.10, hence the test failure in the initial 3.10 test, so reconciling this will be a nuisance 😔

@TimMonko

TimMonko commented May 4, 2026

Copy link
Copy Markdown
Member

Instead of reconciling perhaps we skip these on 3.10? Path of least resistance given its just tests and the py3.10 zarr pin prevents grabbing anything that would break them anyways

We could also just drop 3.10 😜

@Czaki

Czaki commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Maybe just have two copies of tests and run them depending on zarr version?

What is compatibility of zarr 2.0 vs 3.0? Are there plugins depending on zarr 2.0?

@Czaki

Czaki commented May 5, 2026

Copy link
Copy Markdown
Collaborator

As we just made a change and use auto-milestone on merge, I remove the milestone from this PR.

@Czaki

Czaki commented May 6, 2026

Copy link
Copy Markdown
Collaborator

@psobolewskiPhD What did you think about my proposition?

@psobolewskiPhD

Copy link
Copy Markdown
Member Author

I don't know. I don't have any answers for you.

@Czaki

Czaki commented May 6, 2026

Copy link
Copy Markdown
Collaborator

I don't know. I don't have any answers for you.

We will not drop python 3.10 before 0.7.1 it is too big change for assumed release date.

So what you suggest. Should I make my own PR?

@TimMonko

TimMonko commented May 6, 2026

Copy link
Copy Markdown
Member

I don't know. I don't have any answers for you.

We will not drop python 3.10 before 0.7.1 it is too big change for assumed release date.

So what you suggest. Should I make my own PR?

Push here or make a PR and we can move them through quickly.

@psobolewskiPhD

Copy link
Copy Markdown
Member Author

@Czaki what do you think of the solution i just pushed? works for me locally and it's simple enough I think with the docstring/comments?

@codecov

codecov Bot commented May 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.44%. Comparing base (1599f94) to head (21e0deb).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8943      +/-   ##
==========================================
+ Coverage   93.43%   93.44%   +0.01%     
==========================================
  Files         706      706              
  Lines       65227    65233       +6     
==========================================
+ Hits        60942    60955      +13     
+ Misses       4285     4278       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

`create_array` is not part of zarr < 3 API.
Once napari drops py310, this can be removed in favor of just `create_array`.
"""
if hasattr(group, 'create_array'):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I usually prefer to check package version, but this excellent doc string should be enough to spot what code need to be updated.

@Czaki Czaki changed the title [zarr 3.2.0] Stop using removed method "create_dataset" and argument "zarr_version" in our tests [zarr 3.2.0] Start using create_array instead create_dataset in test for zarr 3+ May 8, 2026
@Czaki Czaki added the ready to merge Last chance for comments! Will be merged in ~24h label May 8, 2026
@Czaki

Czaki commented May 8, 2026

Copy link
Copy Markdown
Collaborator

@psobolewskiPhD I tried to update title, but maybe you will have better idea. It will be nice to update description too.

@psobolewskiPhD psobolewskiPhD changed the title [zarr 3.2.0] Start using create_array instead create_dataset in test for zarr 3+ Adapt tests that use zarr to work on zarr < 3 and zarr > 3.2.0 May 8, 2026

@brisvag brisvag left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, this is pretty minimal and does not block releases and lets us take our time with dropping py310.

@brisvag
brisvag merged commit 0ba5be8 into napari:main May 11, 2026
47 checks passed
@github-actions github-actions Bot added this to the 0.7.1 milestone May 11, 2026
@github-actions github-actions Bot removed the ready to merge Last chance for comments! Will be merged in ~24h label May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance PR with maintance changes, tests Something related to our tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[test-bot] pip install --pre is failing

4 participants