Skip to main content

pydantic-zarr

PyPI

Pydantic models for Zarr.

Installation

pip install -U pydantic-zarr

pydantic-zarr models Zarr metadata documents and does no IO; zarr-python moves the documents in and out of stores, as the usage guide shows.

Getting help

  • Docs: see the documentation for detailed information about this project.
  • Chat: We use Zulip for project-related chat.

Example

import json

import zarr
from zarr.core.buffer import default_buffer_prototype

from pydantic_zarr.v2 import GroupSpec

group = zarr.create_group(store={}, path='foo', zarr_format=2)
array = zarr.create_array(
    store=group.store, name='foo/bar', shape=10, dtype='uint8', zarr_format=2
)
array.attrs.put({'metadata': 'hello'})

# collect the metadata documents zarr-python stored, keyed as the store keys them
prototype = default_buffer_prototype()
documents = {
    f"{path}/{name}" if path else name: json.loads(buffer.to_bytes())
    for path, node in [("", group), *group.members(max_depth=None)]
    for name, buffer in node.metadata.to_buffer_dict(prototype).items()
}

# this is a pydantic model
spec = GroupSpec.from_stored_metadata_json(documents)
print(spec.model_dump())
"""
{
    'zarr_format': 2,
    'attributes': {},
    'members': {
        'bar': {
            'zarr_format': 2,
            'attributes': {'metadata': 'hello'},
            'shape': (10,),
            'chunks': (10,),
            'dtype': '|u1',
            'fill_value': 0,
            'order': 'C',
            'filters': None,
            'dimension_separator': '.',
            'compressor': {'id': 'zstd', 'level': 0},
        }
    },
}
"""

Development

Development tasks are driven by just — run just --list for the available recipes — with environments installed from uv.lock by uv. See the contributing guide for setup, testing, and changelog conventions.

History

This project was developed at HHMI / Janelia Research Campus. It was originally written by Davis Bennett to solve problems he encountered while working on the Cellmap Project team. In December of 2024 this project was migrated from the janelia-cellmap github organization to zarr-developers organization.

Metadata

Release files for pydantic-zarr 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydantic-zarr 0.12.0
File Size Uploaded Provenance Actions
pydantic_zarr-0.12.0.tar.gz 422.8 kB With provenance Details for pydantic_zarr-0.12.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydantic-zarr 0.12.0
File Interpreter ABI Platform Actions
pydantic_zarr-0.12.0-py3-none-any.whl Python 3 none any Details for pydantic_zarr-0.12.0-py3-none-any.whl

Total release size: 510.9 kB

Release files / pydantic_zarr-0.12.0.tar.gz

Download URL pydantic_zarr-0.12.0.tar.gz
Size 422.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6c83ffdd790a60fb273242656c7e260a08c789486693457b4dcfb5d4d8d42b0b
BLAKE2b-256 checksum
How to use checksums
07f66d89d2b6eae13407b853c43cd4771341a832660e1c1ec3d05ad9e5984dcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / pydantic_zarr-0.12.0-py3-none-any.whl

Download URL pydantic_zarr-0.12.0-py3-none-any.whl
Size 88.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c55abd8e06771f4a9f0c472f9a79f9f58a94eb98ee80118c18b784474c269be
BLAKE2b-256 checksum
How to use checksums
8eb867ab84a221d843d1a095fd45560310de02279f98741f7d6f516fdb3529b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for pydantic-zarr 0.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pydantic_zarr-0.12.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page