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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file simple-zarr-server-0.0.1.tar.gz.

File metadata

  • Download URL: simple-zarr-server-0.0.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for simple-zarr-server-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d5940e9ccd56788c4226f69120d38081275d9a090cf5b786ad307ac48f25b5ab
MD5 993b785c722f148ce8e67eab805246df
BLAKE2b-256 0d14312c65832f3749b683bf256efe8f34c5d7b8b4f41fd4408a4bad8c95ff8d

See more details on using hashes here.

File details

Details for the file simple_zarr_server-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: simple_zarr_server-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

File hashes

Hashes for simple_zarr_server-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08a4ca133a7018bfaa4e9d6ec32511f311336da9f3ce66af191c4f43e62272ef
MD5 4b8469e10db5000204fcf454937774ae
BLAKE2b-256 4656a2d1782c154eb708a1d7b09513450e4c985cf2307c833c6a862a37ebd383

See more details on using hashes here.

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