Skip to content

Commit f4a239c

Browse files
authored
chore(zarr-metadata): build 0.5.0 changelog (#4266)
* chore(zarr-metadata): note the sdist allowlist, and let misc entries speak #4248 gave this package's sdist an explicit allowlist and merged without a news fragment, so a user-visible packaging change was about to miss the 0.5.0 notes. Add one. Filing it as `misc` exposed that towncrier's built-in `misc` type sets `showcontent = false`: the entry would render as a bare PR link, which tells a reader nothing. Restate all five types the `changes/README.md` menu offers — declaring any type replaces the built-in set — as the defaults verbatim except for `misc`, which now shows its content. A change worth a release note is worth a sentence, whatever its category. Assisted-by: ClaudeCode:claude-opus-5 * chore(zarr-metadata): build 0.5.0 changelog Consume the pending news fragments — #4232's constant-naming-grammar removal note, #4264's note widening `JSONValue`'s array arm to the covariant `Sequence`, and #4248's sdist allowlist — into CHANGELOG.md via towncrier for the zarr_metadata-v0.5.0 release. Minor, not patch: the `JSONValue` widening changes a published type's meaning for every consumer that annotates against it, and #4232 removes the old version-last constant spellings outright. Assisted-by: ClaudeCode:claude-opus-5
1 parent b1d4132 commit f4a239c

4 files changed

Lines changed: 120 additions & 72 deletions

File tree

packages/zarr-metadata/CHANGELOG.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,96 @@
22

33
<!-- towncrier release notes start -->
44

5+
## 0.5.0 (2026-08-14)
6+
7+
### Bugfixes
8+
9+
- `JSONValue`'s array arm is now the covariant `Sequence["JSONValue"]` rather
10+
than the invariant `list["JSONValue"] | tuple["JSONValue", ...]`. Values typed
11+
with a narrower element type — a `list[str]` field on a TypedDict, a
12+
`Sequence[float]` — now count as JSON values, and TypedDicts whose fields
13+
carry precise types are now assignable to `Mapping[str, JSONValue]`.
14+
Type-level cost, accepted deliberately: `Sequence` says nothing about the
15+
concrete container and admits `str`/`bytes`, so runtime code narrowing a JSON
16+
array must exclude `str`/`bytes`/`bytearray` — as it already had to, since
17+
`str` was always a union arm. ([#4264](https://github.com/zarr-developers/zarr-python/pull/4264))
18+
19+
### Deprecations and Removals
20+
21+
- Unified the naming grammar for SCREAMING_SNAKE constants with the one used for
22+
type names. A constant's name is now a purely syntactic transformation of the
23+
name of the `Literal` type it manifests, so the format version is spelled
24+
`ZARR_V2`/`ZARR_V3` and comes first, matching the `ZarrV2`/`ZarrV3` prefix on
25+
the corresponding type:
26+
27+
- `ARRAY_METADATA_STORE_KEY_V2``ZARR_V2_ARRAY_METADATA_STORE_KEY`
28+
- `ARRAY_METADATA_STORE_KEY_V3``ZARR_V3_ARRAY_METADATA_STORE_KEY`
29+
- `ATTRIBUTES_STORE_KEY_V2``ZARR_V2_ATTRIBUTES_STORE_KEY`
30+
- `GROUP_METADATA_STORE_KEY_V2``ZARR_V2_GROUP_METADATA_STORE_KEY`
31+
- `GROUP_METADATA_STORE_KEY_V3``ZARR_V3_GROUP_METADATA_STORE_KEY`
32+
- `CONSOLIDATED_METADATA_STORE_KEY_V2``ZARR_V2_CONSOLIDATED_METADATA_STORE_KEY`
33+
- `ARRAY_ORDER_V2``ZARR_V2_ARRAY_ORDER`
34+
- `ARRAY_DIMENSION_SEPARATOR_V2``ZARR_V2_ARRAY_DIMENSION_SEPARATOR`
35+
- `CONSOLIDATED_METADATA_KEY_V3``ZARR_V3_CONSOLIDATED_METADATA_KEY`
36+
37+
The old names are removed, not aliased. This supersedes the 0.4.0 convention
38+
under which type names put the format version first while constants put it
39+
last: every constant that manifests a `Literal` type now follows the same rule
40+
as that type.
41+
42+
The last of those is the one rename the syntactic rule does not force:
43+
`ZARR_V3_CONSOLIDATED_METADATA_KEY` manifests no `Literal` type, so it is
44+
outside the rule and was renamed for consistency with its siblings.
45+
46+
Digit runs stay glued to the token they follow, so spec vocabulary is
47+
preserved: `Uint8DataTypeName` pairs with `UINT8_DATA_TYPE_NAME` (not
48+
`UINT_8_...`) and `Crc32cCodecName` with `CRC32C_CODEC_NAME`. No dtype, codec,
49+
chunk-grid, or chunk-key-encoding constant changed name.
50+
51+
Constants that do not manifest a `Literal` type are outside the rule and are
52+
unchanged: the `*_METADATA_*_KEYS_V2`/`_V3` key sets, the
53+
`CANONICAL_*_HEX_FLOAT*` bit patterns, and `UNSET`. The key sets keep the
54+
version-last spelling, so `zarr_metadata.model` exports both
55+
`ARRAY_METADATA_REQUIRED_KEYS_V2` and `ZARR_V2_ARRAY_METADATA_STORE_KEY`. They
56+
name validation policy rather than a spec document, have no paired type to
57+
derive from, and renaming them would be a second breaking change buying only
58+
cosmetic consistency — so it is deliberately deferred.
59+
60+
`tests/test_public_api.py::test_constant_names_derive_from_their_type_names`
61+
derives every constant name from the type it manifests and asserts they match,
62+
so the two grammars cannot diverge again.
63+
64+
Store keys also moved to the modules that describe the documents they name,
65+
matching the package's layering (the `v2`/`v3` modules describe the specs; the
66+
`model` layer is built on top of them). `ZARR_V2_ATTRIBUTES_STORE_KEY` now
67+
lives in `zarr_metadata.v2.attributes` beside the `.zattrs` type it names,
68+
rather than in the array model; the other five moved likewise, and
69+
`ZarrV2AttributesStoreKey` is no longer an array-specific concept.
70+
`zarr_metadata.model` re-exports all six, so
71+
`from zarr_metadata.model import ZARR_V2_ARRAY_METADATA_STORE_KEY` is
72+
unaffected.
73+
74+
`CONSOLIDATED_METADATA_KEY_V3` moved to `zarr_metadata.v3.consolidated` and was
75+
renamed to `ZARR_V3_CONSOLIDATED_METADATA_KEY` for consistency. It is not a
76+
store key: unlike v2's `.zmetadata` file, v3 consolidated metadata is embedded
77+
as an extension field inside the group's own `zarr.json`.
78+
79+
All seven keys and the six store-key `Literal` aliases are now also exported
80+
from the top-level `zarr_metadata` namespace, alongside the document types and
81+
the rest of the spec vocabulary, so `from zarr_metadata import
82+
ZARR_V2_ARRAY_METADATA_STORE_KEY` works. The model layer's validators, parsers,
83+
type guards, and metadata key sets remain `zarr_metadata.model` imports.
84+
85+
([#4232](https://github.com/zarr-developers/zarr-python/pull/4232))
86+
87+
### Misc
88+
89+
- The source distribution now ships an explicit allowlist (`/src`, `/tests`,
90+
`/docs`, `/mkdocs.yml`, `/justfile`, `/CHANGELOG.md`) rather than whatever
91+
happens to sit in the package directory, so an sdist both tests and documents
92+
itself and cannot pick up scratch files from the tree it was built in. ([#4248](https://github.com/zarr-developers/zarr-python/pull/4248))
93+
94+
595
## 0.4.0 (2026-07-29)
696

797
### Features

packages/zarr-metadata/changes/4232.removal.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

packages/zarr-metadata/changes/4264.bugfix.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/zarr-metadata/pyproject.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,33 @@ underlines = ["", "", ""]
137137
title_format = "## {version} ({project_date})"
138138
issue_format = "[#{issue}](https://github.com/zarr-developers/zarr-python/pull/{issue})"
139139
start_string = "<!-- towncrier release notes start -->\n"
140+
141+
# Declaring any type replaces towncrier's built-in set, so all five the
142+
# `changes/README.md` menu offers are restated here. They are the defaults
143+
# verbatim except for `misc`, whose `showcontent` towncrier defaults to false:
144+
# a `misc` entry would render as a bare PR link, which tells a reader nothing.
145+
# A change worth a release note is worth a sentence, whatever its category.
146+
[[tool.towncrier.type]]
147+
directory = "feature"
148+
name = "Features"
149+
showcontent = true
150+
151+
[[tool.towncrier.type]]
152+
directory = "bugfix"
153+
name = "Bugfixes"
154+
showcontent = true
155+
156+
[[tool.towncrier.type]]
157+
directory = "doc"
158+
name = "Improved Documentation"
159+
showcontent = true
160+
161+
[[tool.towncrier.type]]
162+
directory = "removal"
163+
name = "Deprecations and Removals"
164+
showcontent = true
165+
166+
[[tool.towncrier.type]]
167+
directory = "misc"
168+
name = "Misc"
169+
showcontent = true

0 commit comments

Comments
 (0)