-
-
Notifications
You must be signed in to change notification settings - Fork 367
Parametrize Array with v2/v3 metadata #3304
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
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3304 +/- ##
==========================================
+ Coverage 61.89% 61.95% +0.06%
==========================================
Files 85 86 +1
Lines 10153 10170 +17
==========================================
+ Hits 6284 6301 +17
Misses 3869 3869
🚀 New features to boost your workflow:
|
53da48a to
d9e50d2
Compare
bbabb9b to
a168b6c
Compare
9c3938f to
2807003
Compare
2807003 to
5e56f56
Compare
| from zarr.core.array import Array, AsyncArray | ||
| from zarr.core.metadata.v2 import ArrayV2Metadata | ||
| from zarr.core.metadata.v3 import ArrayV3Metadata |
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.
these imports will prevent zarr.core.array from using anything defined in zarr.types, is that intentional?
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.
(outside of a type-checking context, I mean)
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.
thinking more about this, I think as long as everything in zarr.types is imported exclusively in if TYPE_CHECKING blocks, then there's no risk of circular imports. we would only have circular imports if we tried to work with types as values outside of type-checking, for example using get_args(ZarrFormat). We can always avoid this by defining a typed constant value somewhere else in the codebase.
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.
I certinaly didn't think about this! So neither intentional or unintentional. I'm not sure I see a better solution, but open to suggestions.
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.
What was the problem that necessitated defining type aliases in the top-level types file? I wonder if there's another way to solve that. This is my only concern about this PR btw, we can get it in soon after this is resolved
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.
I think there wasn't a problem, and this was a choice 😄 - the circular import mess seems a good reason to move these out and next to the array/group classes. Might be a little while until I find time, so someone else is very free to finish this PR off if I don't get there first.
|
I think these changes are good, as they make it easier to track the v2-ness of v3-ness of the But since this PR changes the cc @zarr-developers/core-devs |
2a34f73 to
6e33956
Compare
ping @zarr-developers/core-devs |
|
this looks good to me, I'm going to merge it as soon as everything is green, thanks for the work here @dstansby |
|
@dstansby I pushed some fixes to merge conflicts, let me know those changes are OK |
|
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
It has been a longstanding bugbear of mine that there's no easy way to specify a v2 or v3 array type. This especially came up in the context of #3257, which deals specifically with v2/v3 arrays.
This PR ads type parametrization to the
Arrayclass.After this PR, there is lots of improvements to adding overloads to functions and methods that could be made, but to keep review easier I'd like to leave that for a follow up PR.