|
1 | 1 | # zarr-metadata |
2 | 2 |
|
3 | | -Python type definitions for Zarr v2 and v3 metadata. |
| 3 | +Python types, models, and validators for Zarr v2 and v3 metadata. |
4 | 4 |
|
5 | 5 | ## What this is |
6 | 6 |
|
7 | | -A typed-data package: `TypedDict` definitions and `Literal` aliases for the |
8 | | -JSON shapes specified by the [Zarr v2](https://zarr-specs.readthedocs.io/en/latest/v2/v2.0.html) |
9 | | -and [Zarr v3](https://zarr-specs.readthedocs.io/en/latest/v3/core/index.html) |
10 | | -specifications, plus types for [`zarr-extensions`](https://github.com/zarr-developers/zarr-extensions/) |
11 | | -and a few widely-used-but-unspecified entities (e.g. consolidated metadata). |
12 | | -It also provides canonical frozen-dataclass models, structural validators, |
13 | | -parsers, store-key serialization, and optional Pydantic field integrations. |
14 | | -The optional integration requires Pydantic 2.13 or newer. |
| 7 | +Two layers and an optional integration: |
| 8 | + |
| 9 | +- **Typed JSON shapes**: `TypedDict` definitions and `Literal` aliases for the |
| 10 | + JSON documents specified by the [Zarr v2](https://zarr-specs.readthedocs.io/en/latest/v2/v2.0.html) |
| 11 | + and [Zarr v3](https://zarr-specs.readthedocs.io/en/latest/v3/core/index.html) |
| 12 | + specifications, plus types for [`zarr-extensions`](https://github.com/zarr-developers/zarr-extensions/) |
| 13 | + and a few widely-used-but-unspecified entities (e.g. consolidated metadata). |
| 14 | +- **Document models** (`zarr_metadata.model`): canonical frozen-dataclass |
| 15 | + models of whole metadata documents, with structural validators, loc-aware |
| 16 | + parsers, and store-key (de)serialization. A document produced by `to_json` |
| 17 | + shares no mutable state with the model that produced it. |
| 18 | +- **Optional Pydantic integration** (`zarr_metadata.pydantic`, requires |
| 19 | + Pydantic 2.13 or newer): each model as a Pydantic field type that validates |
| 20 | + raw documents through the same strict parser. |
15 | 21 |
|
16 | 22 | ## What this is for |
17 | 23 |
|
@@ -67,7 +73,14 @@ versus `shape`. Consumers should run the model parser after schema validation. |
67 | 73 | At minimum, this library supports what Zarr-Python needs: the complete |
68 | 74 | Zarr v2 and v3 specs, consolidated metadata, and a subset of the metadata |
69 | 75 | defined in `zarr-extensions`. We are generally open to contributions that |
70 | | -add types for Zarr metadata with a published spec. |
| 76 | +add types, models, or structural validation for Zarr metadata with a |
| 77 | +published spec. |
| 78 | + |
| 79 | +Runtime array behavior is out of scope: nothing here encodes or decodes |
| 80 | +chunks, resolves codec or data type names to implementations, or performs |
| 81 | +store I/O. The models begin and end at the metadata documents themselves — |
| 82 | +`from_key_value` / `to_key_value` map documents to store keys and bytes, |
| 83 | +and everything past that belongs to consumer libraries. |
71 | 84 |
|
72 | 85 | ## Releasing |
73 | 86 |
|
|
0 commit comments