xpublish.SingleDatasetRest#

class xpublish.SingleDatasetRest(dataset, routers=None, cache_kws=None, app_kws=None, plugins=None)[source]#

Used to publish a single Xarray dataset via a REST API (FastAPI application). Use xpublish.Rest to publish multiple datasets.

Parameters:#

dataset :

A single xarray.Dataset object to be served.

__init__(dataset, routers=None, cache_kws=None, app_kws=None, plugins=None)[source]#

Methods

__init__(dataset[, routers, cache_kws, ...])

dependencies()

FastAPI dependencies to pass to plugin router methods

get_dataset_from_plugins([dataset_id])

Attempt to load dataset from plugins, otherwise return dataset from passed in dictionary of datasets

get_datasets_from_plugins()

Return dataset ids from directly loaded datasets and plugins

init_app_kwargs(app_kws)

Set up FastAPI application kwargs

init_cache_kwargs(cache_kws)

Set up cache kwargs

plugin_routers()

Load the app and dataset routers for plugins

register_plugin(plugin[, plugin_name, overwrite])

Register a plugin with the xpublish system

serve([host, port, log_level])

Serve this FastAPI application via uvicorn.run().

setup_datasets(datasets)

Modifies the dataset loading to instead connect to the single dataset

setup_plugins([plugins])

Initialize and load plugins from entry_points unless explicitly provided

Attributes

app

Returns the fastapi.FastAPI application instance.

cache

Returns the cachey.Cache instance used by the FastAPI application.

plugins

Returns the loaded plugins