Skip to main content

dj-zarr-codecs

DataJoint codecs for storing arrays in Zarr format with schema-addressed paths.

Overview

This package provides DataJoint codecs that store numpy arrays as Zarr format in object storage, using DataJoint's schema-addressed storage system. This creates browsable, organized storage that mirrors your database structure.

Features

  • Schema-addressed storage: Paths mirror database structure ({schema}/{table}/{pk}/{field}_{token}.zarr)
  • Zarr format: Portable, cloud-optimized array storage with chunking and compression
  • Lazy loading: Efficient access to large arrays without loading entire datasets
  • Direct access: Fetch returns a read-only zarr.Array, with the full Zarr API
  • Automatic registration: Codecs are automatically available after installation

Installation

pip install dj-zarr-codecs

Requires Python 3.11 or later and datajoint>=2.3.4.

Quick Start

import datajoint as dj
import numpy as np

schema = dj.Schema("my_schema")


@schema
class Recording(dj.Manual):
    definition = """
    recording_id : int32
    ---
    waveform : <zarr@>           # Stored as Zarr array
    """


# Insert numpy array
Recording.insert1(
    {
        "recording_id": 1,
        "waveform": np.random.randn(1000, 32),
    }
)

# Fetch returns Zarr array (read-only)
zarr_array = (Recording & {"recording_id": 1}).fetch1("waveform")

# Use directly with numpy
result = np.mean(zarr_array, axis=0)

# Or access as Zarr for advanced features
print(zarr_array.shape)  # (1000, 32)
print(zarr_array.chunks)  # Zarr chunking info

Configuration

Configure your object storage in DataJoint:

dj.config["stores"] = {
    "mystore": {
        "protocol": "s3",
        "endpoint": "s3.amazonaws.com",
        "bucket": "my-bucket",
        "location": "datajoint",
    }
}

Codecs

<zarr@> / <zarr@store>

Store numpy arrays in Zarr format with schema-addressed paths.

Features:

  • Portable Zarr format (readable by any Zarr library)
  • Efficient chunked storage
  • Optional compression
  • Schema-addressed paths for organization

Usage:

class MyTable(dj.Manual):
    definition = """
    id : int32
    ---
    data : <zarr@>          # Default store
    large_data : <zarr@s3>  # Specific store
    """

Development

Setup

git clone https://github.com/datajoint/dj-zarr-codecs.git
cd dj-zarr-codecs
pip install -e ".[dev]"

Testing

pytest

Code Style

This project uses Ruff for linting and formatting:

ruff check src tests
ruff format src tests

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

License

Apache License 2.0. Copyright 2026 DataJoint Inc. See LICENSE for details.

Documentation & Support

Metadata

Release files for dj-zarr-codecs 0.1.0

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

Source distribution (sdist)

Source distribution for dj-zarr-codecs 0.1.0
File Size Uploaded Provenance Actions
dj_zarr_codecs-0.1.0.tar.gz 140.3 kB With provenance Details for dj_zarr_codecs-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dj-zarr-codecs 0.1.0
File Interpreter ABI Platform Actions
dj_zarr_codecs-0.1.0-py3-none-any.whl Python 3 none any Details for dj_zarr_codecs-0.1.0-py3-none-any.whl

Total release size: 150.7 kB

Release files / dj_zarr_codecs-0.1.0.tar.gz

Download URL dj_zarr_codecs-0.1.0.tar.gz
Size 140.3 kB
Tags Source
SHA-256 checksum
How to use checksums
12be1977822ec6f4181aa2fc8f840171ccfddc8cf4df47323e8f3673181f5e8e
BLAKE2b-256 checksum
How to use checksums
96ddb9922d3153a13dbdec77883d5a2f3d6f42a6ffcebb22266577e19e56f99f
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 20, 2026.

Transparency log

Release files / dj_zarr_codecs-0.1.0-py3-none-any.whl

Download URL dj_zarr_codecs-0.1.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ecf2fb862ea7a67ed059ce50eb33b33f4558ed7f4fc4beead721e7ba18a4e2db
BLAKE2b-256 checksum
How to use checksums
40334649ac8d92ccb4daa49e567c067cdd9c52b4607c1ad9947e5a5bc94f6378
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 20, 2026.

Transparency log

Security for dj-zarr-codecs 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.

Select from 2 files

Attestation for dj_zarr_codecs-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 20, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full 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