|
2 | 2 |
|
3 | 3 | <!-- towncrier release notes start --> |
4 | 4 |
|
| 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 | + |
5 | 95 | ## 0.4.0 (2026-07-29) |
6 | 96 |
|
7 | 97 | ### Features |
|
0 commit comments