A simple, elegant, and efficient Zarr implementation.
Project description
simplezarr
A simple, elegant, and efficient Zarr implementation
Intro
Zarr 3 is a great file format for large datasets. It's nice and elegant.
The simplezarr lib is what happens when one implemented this spec as directly as possible in Python.
Details
Parallelism and async are achieved using a thread-pool and concurrent.futures.Future objects.
You can use it with async frameworks (like asyncio), but none of it is forced.
You can use it synchronously and still benefit from parallelism.
Calls that return a Future have a _soon suffix. Calls that are blocking have a _now suffix.
The core is simple, easy to follow, and gives predictable performance.
Extra functionality is provided as functions and classes that are provided in simplezarr.utils.
This keeps the lib light, and easy to adopt in a wide variety of use cases.
The Zarr 3.1 spec is fully implemented, except for sharding. The core has 100% test coverage.
Installation
pip install simplezarr
Quick example
Write a Zarr file to an in-memory store:
>>> import simplezarr
>>> store = simplezarr.MemoryStore()
>>> simplezarr.ZarrGroup.create(store, "")
>>> arr = simplezarr.ZarrArray.create(store, "array1", (1000, 1000), "uint16", chunk_shape=(64, 64))
>>> arr[...].set_now(42)
Reading:
>>> group = simplezarr.open_zarr(store)
>>> group
<ZarrGroup '' with 1 children at 0x10910a5d0>
<ZarrArray 'array1' 1000x1000 uint16 at 0x10910a490>
>>> arr = group["array1"]
>>> a = arr[:100, :100].get_now() # blocking, but reads chunks in parallel
>>> a
array([[42, 42, 42, ..., 42, 42, 42],
[42, 42, 42, ..., 42, 42, 42],
[42, 42, 42, ..., 42, 42, 42],
...,
[42, 42, 42, ..., 42, 42, 42],
[42, 42, 42, ..., 42, 42, 42],
[42, 42, 42, ..., 42, 42, 42]], shape=(100, 100), dtype=uint16)
Parallel/lazy reads:
>>> f1 = array[:200, :200].get_soon()
>>> f2 = array[-200:, -200:].get_soon()
>>> a1, a2 = [f1.result(), f2.result()]
Developers
- Clone the repo.
- Install
rendercanvasand developer deps usingpip install -e .[dev]. - Use
ruff formatto apply autoformatting. - Use
ruff checkto check for linting errors. - Use
pytest teststo run the tests. Orpytest tests --cov=simplezarr --cov-report=htmlto get coverage reporting.
License
This code is distributed under the MIT license.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplezarr-1.0.0.tar.gz.
File metadata
- Download URL: simplezarr-1.0.0.tar.gz
- Upload date:
- Size: 34.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc4167db061ad7f5b25539afcb7cecd72daa4b6da0918b9afe19483eee03415c
|
|
| MD5 |
e559f1a75c9a7b56325559b7778c38f1
|
|
| BLAKE2b-256 |
691a526db30f9a2ed29308688e767740ce93dd510e7ba9bbfa44d7f1eb83307c
|
Provenance
The following attestation bundles were made for simplezarr-1.0.0.tar.gz:
Publisher:
ci.yml on canpute/simplezarr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplezarr-1.0.0.tar.gz -
Subject digest:
dc4167db061ad7f5b25539afcb7cecd72daa4b6da0918b9afe19483eee03415c - Sigstore transparency entry: 1788736924
- Sigstore integration time:
-
Permalink:
canpute/simplezarr@4d96a639d9ce40030c199577888127732745210d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/canpute
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@4d96a639d9ce40030c199577888127732745210d -
Trigger Event:
push
-
Statement type:
File details
Details for the file simplezarr-1.0.0-py3-none-any.whl.
File metadata
- Download URL: simplezarr-1.0.0-py3-none-any.whl
- Upload date:
- Size: 37.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce2a93c53fb78ffa87549b76e12fd64d223731a11115e75739b17e23b55dde0e
|
|
| MD5 |
3cf78e3ff7f26aced5c6426eba63a299
|
|
| BLAKE2b-256 |
93fca139743f19f97f56406087a6a9a2e4c4635d6ee9744a7fb2b40455d34e62
|
Provenance
The following attestation bundles were made for simplezarr-1.0.0-py3-none-any.whl:
Publisher:
ci.yml on canpute/simplezarr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplezarr-1.0.0-py3-none-any.whl -
Subject digest:
ce2a93c53fb78ffa87549b76e12fd64d223731a11115e75739b17e23b55dde0e - Sigstore transparency entry: 1788737011
- Sigstore integration time:
-
Permalink:
canpute/simplezarr@4d96a639d9ce40030c199577888127732745210d -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/canpute
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@4d96a639d9ce40030c199577888127732745210d -
Trigger Event:
push
-
Statement type: