xpublish.plugins.hooks.PluginSpec#
- pydantic model xpublish.plugins.hooks.PluginSpec[source]#
Plugin extension points.
Plugins do not need to implement all of the methods defined here, instead they implement
- Fields:
- app_router(deps)[source]#
Create an app (top-level) router for the plugin.
Implementations should return an APIRouter, and define app_router_prefix, and app_router_tags on the class, and use those to initialize the router.
- Return type:
- dataset_router(deps)[source]#
Create a dataset router for the plugin.
Implementations should return an APIRouter, and define dataset_router_prefix, and dataset_router_tags on the class, and use those to initialize the router.
- Return type:
- get_dataset(dataset_id)[source]#
Return a
xarray.Datasetfordataset_id.Use this hook when your provider only serves flat datasets — Xpublish wraps the returned Dataset in a single-node
xarray.DataTreeinternally. For hierarchical providers, implementget_datatree()instead, which also receives the requestedgrouppath.Both hooks are first-class and may coexist;
get_datatree()is consulted first.If the plugin does not have the dataset, return
None.
- get_datatree(dataset_id, group)[source]#
Return a
xarray.DataTreefordataset_idrooted atgroup.Implementations should declare
groupas a positional parameter (pluggy will not forward keyword-only parameters). An emptygroupstring means “the root”.Providers decide how to be smart about this. Providers that only ever serve flat datasets can return
xr.DataTree(dataset=ds)(a single-node tree) andNonefor any non-emptygroup. Providers that have hierarchical data can return either the full tree (and index into it withgroup) or, for lazy backends, open only the requestedgroupand wrap it in a single-node tree.The returned tree’s root corresponds to the requested
group.If the plugin does not have the dataset, return
None.