Skip to main content

Publish Xarray Datasets via a REST API.

Project description

Xpublish

Publish Xarray Datasets to the web

PyPI Conda PyPI - Python Version Binder

GitHub Workflow Status Documentation Status pre-commit.ci status

A quick example

Serverside: Publish a Xarray Dataset through a rest API

ds.rest.serve(host="0.0.0.0", port=9000)

Client-side: Connect to a published dataset

The published datasets can be accessed from various kinds of client applications, e.g., from within Python using Zarr and fsspec.

import xarray as xr
import zarr
from fsspec.implementations.http import HTTPFileSystem

fs = HTTPFileSystem()
http_map = fs.get_mapper("http://0.0.0.0:9000/zarr/")

# open as a zarr group
zg = zarr.open_consolidated(http_map, mode="r")

# or open as another Xarray Dataset
ds = xr.open_zarr(http_map, consolidated=True)

Or to explore other access methods, open http://0.0.0.0:9000/docs in a browser.

Why?

Xpublish lets you serve/share/publish Xarray Datasets via a web application.

The data and/or metadata in the Xarray Datasets can be exposed in various forms through pluggable REST API endpoints. Efficient, on-demand delivery of large datasets may be enabled with Dask on the server-side.

Xpublish's plugin ecosystem has capabilities including:

  • publish on-demand or derived data products
  • turning xarray objects into streaming services (e.g. OPeNDAP)

How?

Under the hood, Xpublish is using a web app (FastAPI) that is exposing a REST-like API with builtin and/or user-defined endpoints.

For example, Xpublish provides by default a minimal Zarr compatible REST-like API with the following endpoints:

  • zarr/.zmetadata: returns Zarr-formatted metadata keys as json strings.
  • zarr/var/0.0.0: returns a variable data chunk as a binary string.

Futher endpoints can be added by installing or writing plugins.

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

xpublish-0.4.0.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xpublish-0.4.0-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

File details

Details for the file xpublish-0.4.0.tar.gz.

File metadata

  • Download URL: xpublish-0.4.0.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for xpublish-0.4.0.tar.gz
Algorithm Hash digest
SHA256 dfe27908d4356f8bee38dca7404ee41892fdc2218133df499ae0175de69ca008
MD5 4e77a6a4d4faafe7256cc7e9bf293618
BLAKE2b-256 0724420e5c4c02139e5463a3e2be63c4c9f8afc6eebb6a2aeeec10472b669e6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for xpublish-0.4.0.tar.gz:

Publisher: pypipublish.yaml on xpublish-community/xpublish

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xpublish-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: xpublish-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 31.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for xpublish-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07660e3fb6e0eab7576e8329a5cac20ca423a5d392d2678a5d1f01a50a6b28fd
MD5 cde37fadc13e96bae6b929c7eef75c8b
BLAKE2b-256 a639765e9a1351148ef5dc2fad4ecf0f476d1f974628d3319c4793260c67889b

See more details on using hashes here.

Provenance

The following attestation bundles were made for xpublish-0.4.0-py3-none-any.whl:

Publisher: pypipublish.yaml on xpublish-community/xpublish

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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