Skip to main content

Spec-defined metadata types for Zarr v2 and v3.

Project description

zarr-metadata

Python type definitions for Zarr v2 and v3 metadata.

What this is

A typed-data package: TypedDict definitions and Literal aliases for the JSON shapes specified by the Zarr v2 and Zarr v3 specifications, plus types for zarr-extensions and a few widely-used-but-unspecified entities (e.g. consolidated metadata).

What this is for

These types describe the JSON shape of Zarr metadata. They are intended for libraries that read, write, validate, or transform Zarr metadata. Pair them with a runtime validator like pydantic to check JSON loaded from disk:

import json
from pydantic import TypeAdapter
from zarr_metadata.v3.array import ArrayMetadataV3

with open("zarr.json", "rb") as f:
    raw = json.load(f)

metadata = TypeAdapter(ArrayMetadataV3).validate_python(raw)

What this is not

  • Not a parser or builder. There are no make_array_metadata(...) factories — that surface belongs to consumer libraries.
  • Not a runtime validator on its own. Pair with pydantic, msgspec, or similar to enforce shapes at decode time.

Even with a runtime validator, these types only describe structural shape — they will not flag semantically invalid metadata, like a 3D v3 array whose dimension_names has 4 entries instead of 3. That's a job for downstream validator routines.

Scope

At minimum, this library supports what Zarr-Python needs: the complete Zarr v2 and v3 specs, consolidated metadata, and a subset of the metadata defined in zarr-extensions. We are generally open to contributions that add types for Zarr metadata with a published spec.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zarr_metadata-0.1.1.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zarr_metadata-0.1.1-py3-none-any.whl (39.3 kB view details)

Uploaded Python 3

File details

Details for the file zarr_metadata-0.1.1.tar.gz.

File metadata

  • Download URL: zarr_metadata-0.1.1.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for zarr_metadata-0.1.1.tar.gz
Algorithm Hash digest
SHA256 58af8d63af76ed3b4e7fd924fb845448cf79819c5d314ebc6c5530c128eee430
MD5 30fe6c4b2444274c1319645c0305fa9f
BLAKE2b-256 5698a6a2b893c0432f2b7a7c8a6143c7dd3e386e51baacf3c446699dfc1348bd

See more details on using hashes here.

File details

Details for the file zarr_metadata-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: zarr_metadata-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 39.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for zarr_metadata-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a49ab51009b84eecec9e776db5c259043157b9cb0d372e18abe396135c5db381
MD5 0ef3cebede837223c395993a8647177c
BLAKE2b-256 dfa8f49e29736ebc03b0f798b16a711fe3c101593670cad726ed51307336be5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page