-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zarr v3 #404
base: master
Are you sure you want to change the base?
Zarr v3 #404
Conversation
Fixes TypeError: Unsupported type for store_like: 'LocalPath'
for more information, see https://pre-commit.ci
Zarr v3 is not supported on python 3.9 or 3.10. I'll remove them from the build... Build on python 3.12 is failing tests with:
|
This pull request has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/ome-zarr-py-development-status/104671/4 |
@will-moore: what's the next step here? |
I have 4 failing tests which I don't really understand:
All are from
But this PR was really just an investigation into what were the API changes of zarr-python v3 and what is needed for us to consume it. This PR has no support for OME-Zarr v0.5 and I'm not sure what that would look like yet. It may be that there's no value in this PR on it's own, without v0.5 support. Any and all reviews and feedback on this PR as it stands would be great to hear, especially an idea about the underlying cause of those failing tests. We also have to wait for zarr-python v3 release! |
Plates also looking good:
cc @joshmoore |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #404 +/- ##
==========================================
- Coverage 85.45% 85.14% -0.32%
==========================================
Files 13 13
Lines 1540 1548 +8
==========================================
+ Hits 1316 1318 +2
- Misses 224 230 +6 ☔ View full report in Codecov by Sentry. |
@joshmoore can you have a look at this now? See updated description. Thx. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few general comments and one or two more pointed ones (especially around dimension separator). In general, though, I think this is looking good. Thanks, @will-moore.
@@ -60,7 +60,7 @@ def matches(self, metadata: dict) -> bool: # pragma: no cover | |||
raise NotImplementedError() | |||
|
|||
@abstractmethod | |||
def init_store(self, path: str, mode: str = "r") -> FSStore: | |||
def init_store(self, path: str, mode: str = "r") -> RemoteStore: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be | LocalStore
as well?
self.__store: RemoteStore = ( | ||
path | ||
if isinstance(path, RemoteStore) | ||
else loader.init_store(self.__path, mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would also checking for LocalStore here work?
@@ -104,7 +132,7 @@ def path(self) -> str: | |||
return self.__path | |||
|
|||
@property | |||
def store(self) -> FSStore: | |||
def store(self) -> RemoteStore: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure why this isn't also | LocalStore
@@ -67,16 +70,41 @@ def __init_metadata(self) -> None: | |||
""" | |||
Load the Zarr metadata files for the given location. | |||
""" | |||
self.zarray: JSONDict = self.get_json(".zarray") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can get_json()
now be deprecated?
compressor=options.get("compressor", zarr.storage.default_compressor), | ||
dimension_separator=group._store._dimension_separator, | ||
compressor=options.pop( | ||
"compressor", Blosc(cname="zstd", clevel=5, shuffle=Blosc.SHUFFLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit has been duplicated several times. Might be worth putting it in a single (overridable location) so that the TODO can be more easily fixed here but also be end users who don't want to wait for a release.
@@ -13,6 +13,7 @@ | |||
"id": "blosc", | |||
"shuffle": 1 | |||
}, | |||
"dimension_separator": "/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This surprises me. We really should be able to pass with and without this metadata. (Two tests?)
and storage_options_list | ||
and array_constructor == da.array | ||
): | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pytest's skip
functionality here so this is clearer in the output
Otherwise, I don't immediately have an idea what's going on.
Also just tried out the branch to see if it fixes #231 and 👍 (Previously pasted error was from an older version of dask) |
Updated with #346. |
This updates ome-zarr-py to use zarr-python v3 but doesn't include support for writing Zarr v3 (OME-Zarr v0.5).
However, it does add support for reading OME-Zarr v0.5 (e.g. for use by napari-ome-zarr).
There were 4 tests that I have disabled as I couldn't understand exactly why they were failing.
4 failing tests are:
These tests were passing before
* 109f71f6 (HEAD) Refactors v2 codec handling (#2425)
(zarr-developers/zarr-python#2425)In several places I've hard-coded
zarr_version=2
. This works because you can dozarr.open_group(store=self.__store, path="/", zarr_version=2)
inparse_url()
to create a group to write into, or find a group to read from without specifying whether you expect the group to already exist.Without the
zarr_version=2
, zarr will createzarr.json
if the mode of the store isw
.NB: I have another PR (in progress) to add support for writing OME-Zarr v0.5 at #413
Fixes #404