Conversation
Group.empty/zeros/ones/full and their *_like versions forwarded **kwargs to the top-level creation functions without the group's zarr_format, so a zarr v2 group got zarr v3 arrays. The group lists only members of its own format, so each array was written into the group without becoming a member of it. Pass the group's format, and raise when the caller asks for another. Creating an array in one format like an array of the other then failed, because _like_args copied format-specific codec settings (compressor and filters, or codecs). _like_args now takes the target format and copies those settings only when the formats match. Top-level *_like functions inherit the source's format unless another is requested; open_like does not, because open_array would then look for an existing array in only that format. Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
`empty_like`, `zeros_like`, `ones_like`, `full_like` and `open_like` read the
target format with `kwargs.get("zarr_format")` and then merged `kwargs` over
the arguments derived from the source array. An explicit `zarr_format=None`
therefore made `_like_args` inherit the source's format and copy its codecs,
after which the merge put `None` back and `create` chose the default format:
`zarr.zeros_like(v2_array, zarr_format=None)` raised because v2 compressor
settings reached a v3 array. `zarr_format` is now a keyword-only parameter,
and `_like_args` records the resolved format in the arguments it returns.
Assisted-by: ClaudeCode:claude-opus-5-5
The top-level `empty`, `zeros`, `ones` and `full` (sync and async) and the `AsyncGroup`/`Group` versions forwarded `**kwargs` to `create`. They now declare `create`'s parameters, with the same defaults, and forward each one explicitly. The group methods leave out `store`, `path` and `storage_options`, which the group supplies, and take `zarr_format` as a named parameter instead of popping it from kwargs. `data` is deprecated on these functions: it fills the "zeros" array with other values. `mode` is deprecated on the group methods, where the group's store is already open and it never had an effect. Tests pin the signatures against `create`, check that every argument is forwarded unchanged at each layer, and cover the deprecations and unknown keywords. Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4457 +/- ##
==========================================
+ Coverage 94.46% 94.49% +0.02%
==========================================
Files 93 93
Lines 13233 13267 +34
==========================================
+ Hits 12501 12536 +35
+ Misses 732 731 -1
🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
zarr.empty,zeros,onesandfull, theirzarr.api.asynchronousversions, andGroup/AsyncGroupempty,zeros,onesandfullnow list their parameters instead of taking**kwargs. The parameters are those ofzarr.create. The group methods do not takestore,pathorstorage_options, which the group supplies. An unknown keyword now raises aTypeErrornaming the function called. Passingdatato these functions is deprecated; it fills the new array withdatainstead of the value the function is named for. To create an array from existing data, usezarr.create_array(data=...). Passingmodeto the group methods is deprecated, because it never had an effect there.This is the second step of replacing
**kwargsin the array-creation helpers with explicit parameters. The*_likefunctions andopen_array/open_likefollow in separate PRs.create's, parameter for parameter, including the seven parameters thatcreateaccepts but does not implement (synchronizer,chunk_store,cache_metadata,cache_attrs,object_codec,read_only,meta_array). They are still forwarded and still warn increate. Removing them is left to the deprecation sweep, so it applies tocreateand the helpers together.zeros/onesdo not takefill_value, which is already aTypeErrortoday.fullkeepsfill_valueas its second positional parameter.zarr_formatas a named parameter and check it against the group, replacing thekwargs.pop("zarr_format", None)calls added in fix(group): create group helper arrays in the group's zarr format #4412.storage_optionswas already rejected for arrays in a group (make_store_pathraises for aStorePath); it is now aTypeErrorat the call.shape,fill_value,name,zarr_formatand the deprecated parameters, and refer tocreatefor the rest.create's, so the helpers cannot drift from it.createunchanged at each layer (async, sync,AsyncGroup,Group), using a recording stand-in.datadeprecation, the groupmodedeprecation, and unknown keywords (includingstore/pathon the group methods).**kwargsis restored.Notes
modeanddatatocreate, which accepts them onmainthrough**kwargsand, after feat(api): declare mode and data on create #4455, as named parameters. The signature test accepts both.*_likemethods still popzarr_formatfrom**kwargs; they are part of the*_likePR.🤖 Generated with Claude Code