Skip to main content

A simple server for sharing zarr over HTTP.

Project description

simple-zarr-server

License PyPI Python Version tests

A simple server for sharing zarr over HTTP.


Installation

You can install simple-zarr-server via pip:

pip install simple-zarr-server

Usage

CLI:

$ simple-zarr-server /dataset.zarr # or /dataset.n5, or /dataset.zip

Python API:

The python API is more flexible than the CLI, and can serve any zarr.Array, zarr.Group or np.ndarray.

Server
from simple_zarr_server import serve
import numpy as np
arr = np.random.rand(1024, 1024)
serve(arr)

Client

zarr-python
import zarr
from fsspec import get_mapper
store = get_mapper("http://localhost:8000") 
arr = zarr.open(store, mode='r')
# or 
import dask.array as da
arr = da.from_zarr("http://localhost:8000")
zarr.js
import { openArray } from 'zarr';
arr = await openArray({ store: 'http://localhost:8000' });

Advanced: Serving a remote pyramidal tiff as Zarr

Server
from napari_lazy_openslide import OpenSlideStore
from simple_zarr_server import serve
import zarr

store = OpenSlideStore('tumor_004.tif') # custom zarr store
grp = zarr.open(store)
serve(grp)
Client
import napari
import dask.array as da
import zarr
from fsspec import get_mapper

store = get_mapper("http://localhost:8000")
grp = zarr.open(store)
datasets = z_grp.attrs["multiscales"][0]["datasets"]
pyramid = [
    da.from_zarr(store, component=d["path"]) for d in datasets
]
with napari.gui_qt():
    napari.view_image(pyramid)

Contributing

Contributions are very welcome. Tests can be run with tox.

License

Distributed under the terms of the BSD-3 license, "simple-zarr-server" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple-zarr-server-0.0.1.tar.gz (9.2 kB view hashes)

Uploaded Source

Built Distribution

simple_zarr_server-0.0.1-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page