Skip to main content

Zarrita

Zarrita is an experimental implementation of Zarr v3 including sharding. This is only a technical proof of concept meant for generating sample datasets. Not recommended for production use.

Setup

import zarrita
import numpy as np

store = zarrita.LocalStore('testoutput') # or zarrita.RemoteStore('s3://bucket/test')

testdata = np.arange(0, 16 * 16, dtype='int32').reshape((16, 16))

Create an array

a = zarrita.Array.create(
    store / 'array',
    shape=(16, 16),
    dtype='int32',
    chunk_shape=(2, 8),
    codecs=[
        zarrita.codecs.bytes_codec(),
        zarrita.codecs.blosc_codec(typesize=4),
    ],
    attributes={'question': 'life', 'answer': 42}
)
a[:, :] = testdata

Open an array

a = zarrita.Array.open(store / 'array')
assert np.array_equal(a[:, :], testdata)

Create an array with sharding

a = zarrita.Array.create(
    store / 'sharding',
    shape=(16, 16),
    dtype='int32',
    chunk_shape=(16, 16),
    chunk_key_encoding=('v2', '.'),
    codecs=[
        zarrita.codecs.sharding_codec(
            chunk_shape=(8, 8),
            codecs=[
                zarrita.codecs.bytes_codec(),
                zarrita.codecs.blosc_codec(typesize=4),
            ]
        ),
    ],
)
a[:, :] = testdata
assert np.array_equal(a[:, :], testdata)

Create a group

g = zarrita.Group.create(store / 'group')
g2 = g.create_group('group2')
a = g2.create_array(
    'array',
    shape=(16, 16),
    dtype='int32',
    chunk_shape=(16, 16),
)
a[:, :] = testdata

Open a group

g = zarrita.Group.open(store / 'group')
g2 = g['group2']
a = g['group2']['array']
assert np.array_equal(a[:, :], testdata)

Resize array

a.resize((10, 10))

Update attributes

a.update_attributes({'question': 'life', 'answer': 0})

Zarr v2

a = zarrita.ArrayV2.create(
    store / 'array',
    shape=(16, 16),
    dtype='int32',
    chunks=(2, 8),
)
a[:, :] = testdata

a3 = a.convert_to_v3()
assert a3.metadata.shape == a.shape

Async methods

a = await zarrita.Array.create_async(
    store / 'array_async',
    shape=(16, 16),
    dtype='int32',
    chunk_shape=(2, 8),
)
await a.async_[:, :].set(testdata)
assert np.array_equal(await a.async_[:, :].get(), testdata)

Credits

This is a largely-rewritten fork of zarrita by @alimanfoo. It implements the Zarr v3 draft specification created by @alimanfoo, @jstriebel, @jbms et al.

Licensed under MIT

Metadata

Release files for zarrita 0.2.7

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

Source distribution (sdist)

Source distribution for zarrita 0.2.7
File Size Uploaded Provenance
zarrita-0.2.7.tar.gz 24.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zarrita 0.2.7
File Interpreter ABI Platform
zarrita-0.2.7-py3-none-any.whl Python 3 none any Details

Total release size: 55.5 kB

Release files / zarrita-0.2.7.tar.gz

Download URL zarrita-0.2.7.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f607d401f6f179e1b95e8cb089301287df2ba92c6a301d5659c645feafa05a4a
BLAKE2b-256 checksum
How to use checksums
ad5ace27b43d6fc3c6a7520d15f598f32905210cfc7d7f5b42119f5a10e753f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Darwin/23.5.0

Release files / zarrita-0.2.7-py3-none-any.whl

Download URL zarrita-0.2.7-py3-none-any.whl
Size 30.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9b830be3c3b5376dca94d6dc573747d5674148aa0b0b758d1511a43fee22c26
BLAKE2b-256 checksum
How to use checksums
1437817ee1313ce7fdf8a52e85ccba15873c1ae6ad3761f61702cd90846cb81c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Darwin/23.5.0

Security for zarrita 0.2.7

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.2.7 This release

2 release files No provenance

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