Repository navigation
Conversation
Array.metadata and Group.metadata return ArrayV2Metadata, ArrayV3Metadata, and GroupMetadata, and every zarr.abc.codec method takes an ArraySpec, but all of them were importable only from zarr.core. Export them from zarr.metadata and zarr.abc.codec, and document a narrow member list for each so their internals stay free to change. Assisted-by: ClaudeCode:claude-opus-5-5
d-v-b
force-pushed
the
feat/public-metadata-exports
branch
from
October 9, 2026 15:36
1fdcb26 to
4a29001
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4502 +/- ##
=======================================
Coverage 94.69% 94.70%
=======================================
Files 94 95 +1
Lines 13619 13625 +6
=======================================
+ Hits 12897 12903 +6
Misses 722 722
🚀 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 🤖
Summary
Added public import paths for the metadata classes that
Array.metadataandGroup.metadatareturn:zarr.metadata.ArrayV2Metadata,ArrayV3Metadata,ArrayMetadata,GroupMetadata, andConsolidatedMetadata. Addedzarr.abc.codec.ArraySpec, the chunk description passed to codec methods. The API reference lists the members of each class that are public; construct the metadata classes withfrom_dict.Before this PR, telling a v2 array from a v3 array with
isinstance, or writing a codec against the publiczarr.abc.codecclasses, required importing fromzarr.core. An audit of types reachable from the documented API found 74 with no public path; these are the ones users hold or must implement against.For reviewers
members:list on its reference page, which under the definition proposed in docs: define the public API in the contributing guide #4501 makes only those members public. Left out:chunk_gridandchunk_key_encoding(their classes are private; the glossary already calls chunk-grid classes private API),extra_fields(typed with a private TypedDict), theupdate_*helpers,encode_chunk_key,to_buffer_dict,get_chunk_spec, andArraySpec.config(typed with the privateArrayConfig;ArraySpec.ordercovers the common need). Any of these can be added later without breaking anyone.from_dict. This keeps room to move these classes ontozarr-metadatamodels later. The open question isArraySpec: codec authors may want to build one in their own tests, which argues for making its constructor public.ArrayMetadata(theArrayV2Metadata | ArrayV3Metadataunion) is exported because it is the annotated type ofArray.metadata.zarr.abc.codecnow importsArraySpecat runtime instead of underTYPE_CHECKING; there is no import cycle.ShapeLike,ChunksLike, ...),ArrayConfig,Attributes, and the indexer classes. Those are separate decisions.Checks run locally:
just docs-check(strict build; the rendered pages show exactly the listed members),tests/test_public_exports.py, plustests/test_codecs,tests/test_metadata,tests/test_cli(1415 passed), ruff, and mypy.Author attestation
TODO
docs/user-guide/*.mdchanges/Stack notes
🤖 Generated with Claude Code