Skip to main content

pydantic models for zarr

Project description

pydantic-zarr

PyPI

Pydantic models for Zarr.

⚠️ Disclaimer ⚠️

This project is under a lot of flux -- I want to add zarr version 3 support to this project, but the reference python implementation doesn't support version 3 yet. Also, the key ideas in this repo may change in the process of being formalized over in this specification (currently just a draft). As the ecosystem evolves I will be breaking things (and versioning the project accordingly), so be advised!

Installation

pip install -U pydantic-zarr

Help

See the documentation for detailed information about this project.

Example

import zarr
from pydantic_zarr import GroupSpec

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

# this is a pydantic model
spec = GroupSpec.from_zarr(group)
print(spec.model_dump())
"""
{
    'zarr_version': 2,
    'attributes': {},
    'members': {
        'bar': {
            'zarr_version': 2,
            'attributes': {'metadata': 'hello'},
            'shape': (10,),
            'chunks': (10,),
            'dtype': '|u1',
            'fill_value': 0,
            'order': 'C',
            'filters': None,
            'dimension_separator': '.',
            'compressor': {
                'id': 'blosc',
                'cname': 'lz4',
                'clevel': 5,
                'shuffle': 1,
                'blocksize': 0,
            },
        }
    },
}
"""

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

pydantic_zarr-0.7.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

pydantic_zarr-0.7.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_zarr-0.7.0.tar.gz.

File metadata

  • Download URL: pydantic_zarr-0.7.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for pydantic_zarr-0.7.0.tar.gz
Algorithm Hash digest
SHA256 fdb0129722d5a3454f5107de56ec8370a7dc8ccb3fa34f2729632ed4f8da3acd
MD5 dc369f2592f3c809cd75c28e29309d89
BLAKE2b-256 c634a87b287b4b0d3c788c9adc690bfdcec41b3eeaa542f835ee123d04550967

See more details on using hashes here.

File details

Details for the file pydantic_zarr-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_zarr-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fafb481e7dfa77b3202b91937b777b266387d03e9f6dad5b7eaeca3ae4b5baf
MD5 c9e5e421ad8e018e801893d9180aec90
BLAKE2b-256 efc4a21a21e34655052fcf5f5bcfa2d7c8795c6f38bc1aa1ee110754a16d5151

See more details on using hashes here.

Supported by

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