You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 310075a
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(zarr-metadata)!: call an extension-point value a declaration (zarr-developers#4592)
* refactor(zarr-metadata)!: call a JSON key a field and an extension-point value a declaration
Match zarrs and the v3 spec. A name/value pair in a JSON metadata object
is now a field everywhere (it was a member), which frees "field" from its
old term-of-art meaning: a value at an extension point that a scope
resolves, which is now a declaration.
The public names for that concept follow: AcceptedField and its siblings
become AcceptedDeclaration etc., the ZarrV3*Field aliases become
ZarrV3*Declaration, ZarrV3MetadataFieldJSON becomes ZarrV3DeclarationJSON,
a reading's fields() becomes declarations(), and unclaimed_fields becomes
unclaimed_declarations. Messages that said member now say field. The
pickle-rebuild functions keep their names so existing pickles load.
Assisted-by: ClaudeCode:claude-opus-5-5
* docs(zarr-metadata): say which fields hold declarations and complete the rename's changelog
Review fixes for the field/declaration rename: an extra field is a
declaration written as the field alone, the array models' plain fields
are the ones that hold no declaration, must_understand_fields covers
extra fields only, and the context guide matches definitions to
declarations. The fragment drops four names that were never public and
adds spec_fields, the declaration wording of messages, and the renamed
JSON Schema $defs keys.
Assisted-by: ClaudeCode:claude-opus-5-5
* docs(zarr-metadata): number the field/declaration fragment after its PR
Assisted-by: ClaudeCode:claude-opus-5-5
* docs(zarr-metadata): keep the field/declaration fragment unnumbered until it goes upstream
towncrier links fragments to upstream zarr-python PRs, and upstream #432
is an unrelated merged PR; this change has only a fork PR so far.
Assisted-by: ClaudeCode:claude-opus-5-5
* docs(zarr-metadata): number the field/declaration fragment after its fork PR
CI's changelog check requires an integer PR number, so an orphan
fragment cannot land. 432 is the fork PR; renumber it to the upstream
PR when this goes upstream.
Assisted-by: ClaudeCode:claude-opus-5-5
* docs(zarr-metadata): stop claiming the v3 spec prefers "field" over "member"
The v3 core spec uses both words for a name/value pair in a metadata
object ("the member chunk_shape", "the fill_value metadata field"), so
only zarrs motivates the choice. Also say "context", not "scope".
Assisted-by: ClaudeCode:claude-fable-5-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
* refactor(zarr-metadata)!: keep "member" for a JSON name/value pair
Drop the member-to-field half of the rename. The v3 core spec uses
"field", "key" and "member" for a name/value pair without preference,
RFC 8259 says "member", and the package already said "member", so only
zarrs motivated the change. The field-to-declaration half stays: it
removes the collision between the extension-point sense of "field" and
the JSON sense in extra_fields, ExtraFieldDefinition and friends.
Every line that upstream main writes with "member" is restored by
aligning the two trees token by token. spec_fields is spec_members
again, member_changes keeps its name, and ZarrV3ConsolidatedMetadata
takes member= again. Prose that said "extra member" or "extension
member" now says "extra field" and "extension field", after the names.
Assisted-by: ClaudeCode:claude-fable-5-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
* refactor(zarr-metadata): finish the member and declaration wording roborev flagged
Four docstrings said "the fields that hold no declaration" for members;
the pickle-rebuild comment said the functions keep their _declaration
names when they keep their _field names; and two test helpers in the
strategies tests still said "fields" for declarations.
Assisted-by: ClaudeCode:claude-fable-5-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
* test(zarr-metadata): name the schema-acceptance test after the declaration it reads
Last test in the package whose name said "field" for a declaration.
Assisted-by: ClaudeCode:claude-fable-5-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
* refactor(zarr-metadata): restore "member" where the rename changed a name in both senses
Thirteen test names changed in both the member and the declaration
sense at once, so the token alignment that restored "member" skipped
them; they take their upstream spelling with only the declaration half
applied. Seven docstrings get the same treatment, and the two envelope
docstrings that said "an extra field" for an undeclared envelope member
now say "an extra envelope member", so "extra field" keeps one meaning.
Assisted-by: ClaudeCode:claude-fable-5-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
* docs(zarr-metadata): say the model checks the members of a document
Last module docstring with "field" in the name/value-pair sense.
Assisted-by: ClaudeCode:claude-fable-5-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
* docs(zarr-metadata): number the declaration-rename fragment after upstream PR 4592
Assisted-by: ClaudeCode:claude-fable-5-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
---------
Co-authored-by: Claude Fable 5.1 <[email protected]>
Copy file name to clipboardExpand all lines: packages/zarr-metadata/README.md
+30-28Lines changed: 30 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ closely model the content of the Zarr specifications, such as:
48
48
-**Problems** ([`zarr_metadata.problems`](https://zarr-metadata.readthedocs.io/en/latest/api/problems/)): the problem
49
49
values every reader returns, and the error that carries them.
50
50
-**JSON Schema** ([`zarr_metadata.json_schema`](https://zarr-metadata.readthedocs.io/en/latest/api/json_schema/)): the
51
-
JSON Schema of a `TypedDict`, a v3 field, or a whole `zarr.json`.
51
+
JSON Schema of a `TypedDict`, a v3 declaration, or a whole `zarr.json`.
Added `zarr_metadata.testing.strategies`, Hypothesis strategies that draw valid Zarr v3 metadata fields, behind a new `testing` extra (`pip install zarr-metadata[testing]`). There is one strategy for every codec, data type, chunk grid and chunk key encoding the package defines that holds no other field. `fields` draws every envelope spelling the spec allows, or only the canonical one with `spellings="canonical"`. Codecs can be drawn for the `Chunk` they are handed, chunk grids for an array shape, and fill values for a data type. The strategies are a mapping keyed by definition, so an extension author can add strategies for their own definitions.
1
+
Added `zarr_metadata.testing.strategies`, Hypothesis strategies that draw valid Zarr v3 metadata declarations, behind a new `testing` extra (`pip install zarr-metadata[testing]`). There is one strategy for every codec, data type, chunk grid and chunk key encoding the package defines that holds no other declaration. `declarations` draws every envelope spelling the spec allows, or only the canonical one with `spellings="canonical"`. Codecs can be drawn for the `Chunk` they are handed, chunk grids for an array shape, and fill values for a data type. The strategies are a mapping keyed by definition, so an extension author can add strategies for their own definitions.
Rename the word for a value at an extension point: it is now a *declaration* (it was a *field*). A name/value pair in a JSON metadata object stays a *member*. The package already said *field* in the JSON sense in `extra_fields`, `ExtraFieldDefinition`, `ZarrV3ExtensionField` and `must_understand_fields`, after the spec's "additional fields", so one word meant two things. The public names change with no aliases:
2
+
3
+
-`AcceptedField`, `UnclaimedField`, `RefusedField` and `ResolvedField` are now `AcceptedDeclaration`, `UnclaimedDeclaration`, `RefusedDeclaration` and `ResolvedDeclaration`.
4
+
-`ZarrV3DataTypeField`, `ZarrV3ChunkGridField`, `ZarrV3ChunkKeyEncodingField`, `ZarrV3CodecField`, `ZarrV3StaticCodecField`, `ZarrV3StorageTransformerField` and `ZarrV2DataTypeField` are now the same names ending in `Declaration`, and a kind's `field_aliases` is now `declaration_aliases`.
5
+
-`ZarrV3MetadataFieldJSON` is now `ZarrV3DeclarationJSON`, and `field_json_schema_v3` is now `declaration_json_schema_v3`.
6
+
- A reading's `fields()` is now `declarations()`, and a model's `unclaimed_fields` is now `unclaimed_declarations`.
7
+
- The first parameter of `with_problems` is now `declarations` (it was `fields`).
8
+
- The JSON Schemas that `node_metadata_json_schema_v3` and `declaration_json_schema_v3` write name each alias under `$defs` by its new name, so a `$ref` to `#/$defs/ZarrV3CodecField` is now `#/$defs/ZarrV3CodecDeclaration`, and likewise for the other kinds.
9
+
10
+
Messages that said *field* or *metadata field* for an extension-point value now say *declaration*, as in "expected a declaration (string or extension object)". Prose that said *extra member* or *extension member* now says *extra field* and *extension field*, after the names. `extra_fields`, `ExtraFieldDefinition`, `ZarrV3ExtensionField`, `StructField` and the pydantic `...MetadataField` types keep their names.
0 commit comments