Zarr-compatible REST API plugin for Xpublish.
Project description
xpublish-zarr
Zarr-compatible REST API plugin for Xpublish.
xpublish-zarr exposes an xarray.Dataset over HTTP as a consolidated Zarr v3 store,
so clients can read it via xarray.open_zarr / zarr.open_consolidated over fsspec's
HTTP backend.
This plugin is extracted from xpublish core so that the core can be used without
pulling in zarr.
Note on consolidated metadata. v3 consolidated metadata is currently an experimental extension — not yet part of the official Zarr v3 spec, but supported by both zarr-python and xarray. The plugin emits it because it lets clients open the dataset in a single HTTP request and because dropping it would require a directory-listing endpoint (zarr clients need some way to discover the group's children, and HTTP doesn't have a portable listing protocol). If/when the spec lands a different format, we'll follow upstream.
Install
uv add xpublish-zarr
# or
pip install xpublish-zarr
The plugin is auto-registered with xpublish via the xpublish.plugin entry point.
Usage
import xarray as xr
ds = xr.tutorial.open_dataset("air_temperature")
ds.rest.serve(host="0.0.0.0", port=9000)
import xarray as xr
ds = xr.open_zarr("http://0.0.0.0:9000/zarr/", consolidated=True, zarr_format=3)
Endpoints
For a single dataset (mounted at the root):
| Path | Description |
|---|---|
/zarr/zarr.json |
Root group metadata (includes consolidated metadata) |
/zarr/{var}/zarr.json |
Per-array metadata |
/zarr/{var}/c/{i}/{j}/… |
A variable's chunk (binary), /-separated chunk coords |
/zarr/{var}/c |
The single chunk of a scalar (0-d) variable |
For a multi-dataset Rest app the paths are prefixed with /datasets/{dataset_id}.
Caveats
- Single group only. DataTree / nested groups are not yet supported; this will land once xpublish merges its DataTree handling.
- No sharding yet. Adding it later is a one-line change at the
to_zarrstep and does not alter the HTTP surface. - Encoding. Each variable's codec pipeline, chunk shape, fill value, and
dimension_namescome from xarray's ownto_zarrpath, so the wire format matches whatds.to_zarr(..., zarr_format=3)would produce locally. Set per-variable encoding (compressor, chunks, fill value, dtype) viads[var].encodingbefore serving.
Development
This project uses uv for environment and dependency management.
uv sync
uv run pytest
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 xpublish_zarr-0.1.0.tar.gz.
File metadata
- Download URL: xpublish_zarr-0.1.0.tar.gz
- Upload date:
- Size: 86.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
beaf70016da93b469afb799bcb4743b5b1e5d25a9711e8fa91d2f2a6603441fe
|
|
| MD5 |
e4ee53a73f1af0210f609b531c8e1897
|
|
| BLAKE2b-256 |
56bfc1e626548cfc2b9d3971be80e32f7c48171d4e7f483ab8a9c8600375e2f3
|
Provenance
The following attestation bundles were made for xpublish_zarr-0.1.0.tar.gz:
Publisher:
publish.yml on xpublish-community/xpublish-zarr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xpublish_zarr-0.1.0.tar.gz -
Subject digest:
beaf70016da93b469afb799bcb4743b5b1e5d25a9711e8fa91d2f2a6603441fe - Sigstore transparency entry: 1592354241
- Sigstore integration time:
-
Permalink:
xpublish-community/xpublish-zarr@12442c5e5e914dec44c82a9e2d2c361d49df72fb -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/xpublish-community
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@12442c5e5e914dec44c82a9e2d2c361d49df72fb -
Trigger Event:
release
-
Statement type:
File details
Details for the file xpublish_zarr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: xpublish_zarr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 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 |
682e5785207fce39ca8ab1f35c03539a6a78fc9c37b0fe4287a06cca3d1f10d4
|
|
| MD5 |
3235e61b4742dff5b9ec5d3409b0b79f
|
|
| BLAKE2b-256 |
7942c48e72849a1121c114c3f9d08306ad421509dbe7d524aa476ad19d4df0cb
|
Provenance
The following attestation bundles were made for xpublish_zarr-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on xpublish-community/xpublish-zarr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xpublish_zarr-0.1.0-py3-none-any.whl -
Subject digest:
682e5785207fce39ca8ab1f35c03539a6a78fc9c37b0fe4287a06cca3d1f10d4 - Sigstore transparency entry: 1592354456
- Sigstore integration time:
-
Permalink:
xpublish-community/xpublish-zarr@12442c5e5e914dec44c82a9e2d2c361d49df72fb -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/xpublish-community
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@12442c5e5e914dec44c82a9e2d2c361d49df72fb -
Trigger Event:
release
-
Statement type: