Skip to main content

AnniZarr

CI PyPI docs

Convert to, append, sort anndata zarr storages efficiently with parallel and out of memory operations for all commands and api usage. Also, enable versioned anndata storage with Icechunk ease of use.

Install

the icechunk additional dependencies include gcs, s3 read/writing alongside icechunk usage.

pip install annizarr
pip install "annizarr[icechunk]"

Quickstart usage

Convert

The input format is sniffed from the HDF5 contents (h5ad vs 10x); --from h5ad|10x overrides it. Configuration can enable chunking, sharding, format ... Two or more inputs are concatenated. --ic writes an Icechunk repository instead of plain zarr.

annizarr convert sample.h5ad -o sample.zarr

annizarr convert a.h5ad b.h5ad -o merged.zarr
annizarr convert sample.h5ad -o repo.icechunk --ic -m "initial import"

Zarr operations and edits

rechunk rewrites one matrix with new chunking and streams everything else through unchanged.
sort physically orders rows by obs column(s) into a new store.
append adds cells to an existing zarr/ic store; it prompts before dropping obsm/obsp/layers (--drop-derived consents up front)
add-layer copies X (or a layer, or raw/X) into a new layer in another layout, values untouched; CSC by default for fast gene reads

annizarr rechunk merged.zarr -o rechunked.zarr --row-chunk 2000

annizarr sort merged.zarr -o sorted.zarr --by cell_type
annizarr append sorted.zarr more_cells.zarr --drop-derived

annizarr add-layer merged.zarr --layer counts_csc
annizarr add-layer repo.icechunk --layer counts_csc --branch dev -m "csc copy for gene reads"

Icechunk history, branches, cherry-picks live in the Python API annizarr.Repo below

Python API for Icechunk usage

The full Python API, including the config dataclasses and the ops functions, is in the Python API page.

import annizarr as az

repo = az.Repo("repo.icechunk")

repo.branches()
repo.log()
repo.tree()

root = repo.open_zarr("w")
root.attrs["step"] = "lognorm"
repo.commit("normalize")

repo.checkout("experiment", create=True)  # switches this object only; nothing is persisted
old = repo.open_zarr("r", snapshot_id=repo.log()[1].id)

repo.copy("/work/store")  # clone with every branch and snapshot id intact, good for readonly cases

OpResult(path, n_obs, n_vars, snapshot_id) — snapshot_id is None for plain zarr, the committed Icechunk snapshot id otherwise.

Configuration and zarr stores

Every flag is documented in annizarr <command> --help; the CLI reference has the same text in one place, and each operation has its own page in the documentation. Inputs stream band by band by default, so memory stays bounded at any store size (--eager loads the whole input first, faster for small files), and matrix writes use every core unless --cpus says otherwise.

Some of the main options; the docs have all of them:

  • --cpus N — parallel band workers, up to about 630 MB each (default: every core this process may use, capped by a container CPU limit). Every command.
  • --clevel N — Blosc zstd compression level, 0 to 9 (default: 3). convert, sort, add-layer; rechunk keeps the source's level unless given.
  • --layout csr|csc|dense — on-disk layout of the matrix being written. Default csr for X on convert, csc for an add-layer copy. CSR suits row-wise access, CSC and dense column queries.
  • --row-chunk N, --col-chunk N — chunk shape. Exact rows and columns for dense; for sparse, about N cells (csr) or N genes (csc) per chunk, sized from the average nonzeros. Defaults: 2048 for dense, about 9,000,000 nonzeros for sparse. convert, rechunk, add-layer.
  • --auto-shard — shard the 1-D sparse arrays and anndata-written elements with zarr's automatic shard shape (default: off). Every command but append.
  • --ic — write through an Icechunk repository; --branch B and -m MSG pick the branch and commit message. append and add-layer detect an existing repo on their own. convert, rechunk, sort.
  • --sort-by COL… on convert / --by COL… on sort — physically order rows by obs columns, primary key first

What gets written. Every store is anndata-readable zarr v3 with encoding-type/encoding-version attrs matching anndata's on-disk spec (anndata 0.12.7 or newer reads them). X and layers may be dense, CSR or CSC on input (h5ad or 10x, mixed across inputs) and are written in whatever --layout asks for; X defaults to CSR. convert/rechunk/sort write to a sibling temp store, verify it opens, then rename it onto the target, so a killed run never leaves a partial store. On Icechunk every op is exactly one commit, and remote (s3://, gs://) outputs require it. More in What annizarr writes.

Development

python -m venv .venv && source .venv/bin/activate
pip install -e ".[icechunk,dev,docs]"
pytest                                  # excludes -m slow by default
pytest -m slow --no-cov                 # large synthetic-store memory-ceiling test
ruff check src tests docs && ruff format --check src tests docs
mypy --strict src/annizarr
mkdocs serve                            # the documentation site, live at http://127.0.0.1:8000

Golden stores for regression tests live in tests/golden/.

License

MIT — see LICENSE.

Metadata

Release files for annizarr 0.2.4

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

Source distribution (sdist)

Source distribution for annizarr 0.2.4
File Size Uploaded Provenance Actions
annizarr-0.2.4.tar.gz 389.4 kB With provenance Details for annizarr-0.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 492.0 kB

Release files / annizarr-0.2.4.tar.gz

Download URL annizarr-0.2.4.tar.gz
Size 389.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d0275e03980d765b4d42f1d9d667f9e1fb767c826296f5c8889124c6067460ea
BLAKE2b-256 checksum
How to use checksums
3f675e8b7ad8d8d54e192448b7cfa5c1dbe0dad7d20d61a7db637369995ab3fc
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 Oct 30, 2026.

Transparency log

Release files / annizarr-0.2.4-py3-none-any.whl

Download URL annizarr-0.2.4-py3-none-any.whl
Size 102.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f59daa6964247e440489841a1a34ece7e0fd8ef9081b3cb721e9076beeab860
BLAKE2b-256 checksum
How to use checksums
36ad759d3a1c044ed7043f8094bb50afd8fe4b4427aa06b15c015793f8a4382d
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 Oct 30, 2026.

Transparency log

Security for annizarr 0.2.4

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.

Select from 2 files

Attestation for annizarr-0.2.4.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 Oct 30, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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