pydantic models for zarr
Project description
pydantic-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
Release history Release notifications | RSS feed
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.6.1.tar.gz
(13.7 kB
view hashes)
Built Distribution
Close
Hashes for pydantic_zarr-0.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f12c848b9ef243667907c3b68457cb851fb5c00f4b6ea5c6b120b8d9624459c |
|
MD5 | 132067ddfb771bf4865582c73b1820fd |
|
BLAKE2b-256 | 12d859928eb3a1ac0e948007b73fde6b647bc70dd30a391b0c27b14ac5ffe9ce |