zarr-zip
A small pure-Python library and command line for Zarr stores in zip files. It zips any Zarr store,
OME-Zarr or plain, one zip per store: in the layout the
BioImage Archive asks for, or as an NGFF RFC-9 .ozx.
It was called ome-zarr-zip up to 0.0.1.
- Finds every OME-Zarr (or plain Zarr) under the input folder, subfolders included.
- Writes one zip per store, named after the corresponding folder. Unzipping it gives back the original folder.
- Does not recompress the data. Assumes Zarr chunks are already compressed.
- Skips zips that already exist.
Install
pip install zarr-zip
Use
Zip everything under a folder, putting each zip next to its image:
zarr-zip D:\results
Put the zips in another folder (the subfolders are kept):
zarr-zip D:\results -o E:\upload
See what it would do, without writing anything:
zarr-zip D:\results -o E:\upload --dry-run
Other options:
| Option | What it does |
|---|---|
-j 4 (or --workers 4) |
zip 4 images in parallel (default 2). |
--overwrite |
replace zips that already exist |
--verify list |
check only file names and sizes after writing. This is faster than the default full check. |
--verify none |
skip the check |
--rename-folder |
rename an OME-Zarr folder name.zarr to name.ome.zarr inside the zip, giving name.ome.zarr.zip as the BioImage Archive asks (see below) |
--layout rfc9 |
write name.ozx files instead (see below) |
From Python:
from zarr_zip import find_stores, zip_store
for store in find_stores(r"D:\results"):
zip_store(store, r"E:\upload")
Writing a store straight into a zip
A program that writes a Zarr store can write it into a zip directly, without a folder first.
ZipWriter takes each finished chunk or shard as it comes, from any number of threads:
from zarr_zip import open_writer
with open_writer("img.ome.zarr.zip") as zw: # holds the folder img.ome.zarr (BioImage Archive)
zw.write("0/c/0/0/0", shard_bytes) # a whole chunk or shard, from memory
zw.write_from("0/c/0/0/1", "shard.tmp") # or from a file
level0 = zw.read("0/c/0/0/0") # finished entries can be read back
zw.write("zarr.json", metadata_bytes) # written twice? the last copy counts
open_writer("img.ozx") writes the RFC-9 layout instead: the store at the top of the zip, and
the comment naming the OME-Zarr version, taken from the root zarr.json when the zip is closed.
zarr-python can read and write through the writer too (pip install "zarr-zip[zarr]"):
import zarr
from zarr_zip.zarr_store import WriterStore
group = zarr.open_group(WriterStore(zw), mode="w-", zarr_format=3)
level0 = zarr.open_array(WriterStore(zw, read_only=True), path="0")
- The zip is written as
img.ome.zarr.zip.partand gets its name only when it is complete and checked. If the program stops, no zip that looks finished is left behind. - Entries are stored uncompressed (Zarr chunks are compressed already), so reading one back while the zip is still being written is a plain file read.
- The zip's table of contents lists each file once (its last copy) and the metadata files first, whatever order they were written in.
- Nothing can be deleted from a zip being written; a chunk or shard is best written once.
The two layouts
bia (the default) follows the
BioImage Archive's rules:
- Each zip holds the original folder under its own name and is named after it. An OME-Zarr folder named
name.zarrtherefore becomesname.zarr.zip. - Add
--rename-folderto rename the input folders named likename.zarrtoname.ome.zarrinside the zip. The zip file itself also becomesname.ome.zarr.zip. - The BioImage Archive advises keeping each zip below 100 GB, and the tool warns when a zip is larger.
rfc9 follows NGFF RFC-9:
- The zip is named
name.ozx. - Its top level is the image itself, with
zarr.jsonat the root and no folder around it. - It uses ZIP64 entries.
- A comment in the zip names the OME-Zarr version.
- It works only for OME-Zarr 0.5 and newer.
Tests
pip install -e .[test]
pytest
Metadata
Release files for zarr-zip 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zarr_zip-0.1.0.tar.gz | 22.4 kB | With provenance | Details for zarr_zip-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zarr_zip-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for zarr_zip-0.1.0-py3-none-any.whl |
Total release size: 40.3 kB
Release files / zarr_zip-0.1.0.tar.gz
| Download URL | zarr_zip-0.1.0.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ac6ab68c90111fff570fb843286dfdf4f03e85fe2a1e1f76fe45b02c99bf043
|
|
BLAKE2b-256 checksum How to use checksums |
799bb662a8a77249ee357612ff910399c1707e4bb12970c1b418c4406b56e609
|
| 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 9, 2026.
Transparency logRelease files / zarr_zip-0.1.0-py3-none-any.whl
| Download URL | zarr_zip-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57e693f264cefc017c3ba6e553216a09dcc4cab6bba5dfa32191930de5455cc1
|
|
BLAKE2b-256 checksum How to use checksums |
56e23b31b85b575f81947c4b532d88410fdefc8714432bbef9f609420375326a
|
| 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 9, 2026.
Transparency logSecurity for zarr-zip 0.1.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.
Attestation for zarr_zip-0.1.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 9, 2026.
Transparency logA 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.