Uh oh!
There was an error while loading. Please reload this page.
Make create_array signatures consistent - #2819
Conversation
d-v-b
commented
Feb 12, 2025
worth noting that this changes some defaults (we were using a default fill_value of |
LDeakin
commented
Feb 13, 2025
|
d-v-b
commented
Feb 13, 2025
That works for me. In |
…x/consistent-create-array-signature
d-v-b
commented
Feb 27, 2025
with 642272d the default fill value is |
dstansby
left a comment
There was a problem hiding this comment.
👍 for this in general - I left one request for a more verbose changelog entry, and one question.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dstansby
left a comment
There was a problem hiding this comment.
Thanks for the changelog update, looks great to me. I left one more suggestion - I did a bit of testing and this doesn't seem to change the fill value that's set on the arrays (which is good, but I think worth reassuring users)
Uh oh!
There was an error while loading. Please reload this page.
d-v-b
commented
Feb 28, 2025
how did you check this? because for zarr v2 data, it should make a difference -- |
dstansby
commented
Feb 28, 2025
I didn't check for v2 🙈 . If it does make a difference, that should be made very clear in the changelog (and we should think about putting this PR in a non-bugfix release since it's a breaking change?) |
LDeakin
commented
Feb 28, 2025
I'd hope that since the below PRs, the metadata of the Zarr V2 data with |
d-v-b
commented
Feb 28, 2025
@LDeakin that was my impression as well. I think for v2 data the contents of the array metadata will be sensitive to the |
LDeakin
commented
Feb 28, 2025
Indeed! To be honest, I think |
The nullable fill value is also clunky because zarr v2 supports the python We would have to get a measure of the impact on users, but if it doesn't inconvenience a lot of people then I would definitely support dropping the creation of arrays with a |
Uh oh!
There was an error while loading. Please reload this page.
dstansby
left a comment
There was a problem hiding this comment.
Sorry to be a bit of a pain, but I'm going to put a request changes on this until we've resolved how we're going to bump the version number (and/or update our versioning policy) for this change. See #2819 (comment) for more context.
d-v-b
commented
Mar 4, 2025
that works for me! would you like to open an issue about the versioning policy, or should I? |
dstansby
commented
Mar 4, 2025
I can 👍 |
d-v-b
commented
May 22, 2025
ultimately I think whether these changes are breaking depends on whether you believe it's a bug that different definitions of the same function have different default values. |
dstansby
commented
May 22, 2025
Does changing the values affect any behaviour, or any metadata that gets written to zarr arrays or groups? If not, then I'd say this isn't breaking. If it does, then I'd say it is breaking. |
d-v-b
commented
May 22, 2025
I think there are two questions:
Because this library produces data, we will inevitably have bugs that affect how data is produced. Therefore, fixing those bugs will change how data is produced. If the bug fix takes us from "writes invalid data" to "writes valid data", that's a clear win. But if the bug fix takes us from "writes valid data" to "writes slightly different valid data", then things are less clear cut. I think we are in this second scenario. For simplicity lets say that these changes are breaking, and thus a good fit for a 3.1 release. it might be time to think about a 3.1 branch! |
dstansby
commented
May 23, 2025
I think my confusion/questions are stemming from the short explanation of what's changed in the changelog entry. I think the default argument would benefit from being being added to it's own |
d-v-b
commented
May 23, 2025
there is no change here, zarr-python uses an array of zeros (or the zeros-equivalent, per data type) in either case. |
dstansby
commented
May 27, 2025
I still need to wrap my head around the fill value changes a bit - in the meantime, perhaps adding the new arguments could be done in a separate PR, since that's definitely backwards compatible and probably something we could put in a 3.0.x release? |
d-v-b
commented
May 27, 2025
i would rather not split this PR into pieces. |
dstansby
commented
May 28, 2025
Ah, because that would ruin the automatic testing you added - gotcha. Will try and give this a proper re-review soon. |
dstansby
left a comment
There was a problem hiding this comment.
👍 had another think about this, and I think it's good as long as the changelog is fixed so it's visible. I would like someone else to review this though, just to check the default changes to the fill value are okay.
Uh oh!
There was an error while loading. Please reload this page.
dstansby
commented
Jun 18, 2025
Pinging @zarr-developers/python-core-devs - would be good to get a second review on this |
d-v-b
commented
Jun 19, 2025
the test failure here is windows-specific and fixed in #3151 |
d-v-b
commented
Jul 9, 2025
these function signature tests are gold. they caught a bunch of recently-added inconsistencies |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #2819 +/- ##
==========================================
- Coverage 94.73% 94.72% -0.02%
==========================================
Files 78 78 Lines 8646 8646 ==========================================
- Hits 8191 8190 -1 - Misses 455 456 +1
🚀 New features to boost your workflow:
|
This PR ensures that the various invocations of
create_arrayare consistent. For reference, we have 4 ways to callcreate_array:zarr.core.array.create_array(the actual function that does stuff)zarr.api.synchronous.create_array(synchronous wrapper around the async function)zarr.core.group.AsyncGroup.create_array(method onAsyncGroupclass that invokescreate_array)zarr.core.group.Group.create_array(synchronous wrapper around the AsyncGroup method)All of these functions should have consistent signatures, but in main they don't, and a big part of this is missing tests. So this PR adds some tests that check that certain pairs of functions have identical parameters (we can't force the return types to match, because the async functions will return coroutines). To make the tests pass, this PR also ensures that all of the invocations of
create_arrayhave parameters that are consistent.I say "consistent" because, when invoking
Group.create_array, that method does not take astoreargument, because we have one already from the group instance. Also,Group.create_arraywas recently given an extra keyword argument (compressor) that we need to deprecate. So the test that compareszarr.core.array.create_arraywithzarr.core.group.AsyncGroup.create_arrayonly checks that all ofcreate_arrayparameters are present in the group method.closes#2810