forked from xpublish-community/xpublish
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start of a big revamp of the docs. - Uses Pydata theme - Enables MyST markdown and converts a lot of the docs to it (rst heading levels and git conflict formatting conflict, which was a fun discovery) - Re-arranges things along the Diátaxis framework lines, or at least how they are being used in the PyData space - Adds the vision or 'Why Xpublish' page - Breaks the tutorial into sections and scaffolds sections for use of plugins Closes xpublish-community#163 xpublish-community#165 xpublish-community#162 xpublish-community#166
- Loading branch information
Showing
22 changed files
with
832 additions
and
677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ sphinx-autosummary-accessors | |
pydata-sphinx-theme | ||
sphinx-autodoc-typehints | ||
autodoc_pydantic | ||
myst-nb | ||
sphinx-design |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Ecosystem | ||
|
||
Xpublish's ecosystem is made up of plugins and servers, and the folks who build and run them. | ||
|
||
## Connect | ||
|
||
We have two main venues for discussing Xpublish and it's ecosystem, Github Discussions and Slack. | ||
|
||
### Github Discussions | ||
|
||
For longer form discussions, we can be found in [Github Discussions](https://github.com/xarray-contrib/xpublish/discussions?discussions_q=). | ||
|
||
### Slack | ||
|
||
Xpublish has a channel (`#xpublish`) on [ESIP](https://www.esipfed.org/)'s (Earth Science Information Partners) Slack. (Insert Rich's justification here about ESIP being the biggest unbrella that he can find) [Join here](https://join.slack.com/t/esip-all/shared_invite/zt-1omjufm9z-iH8Gf7gmmsm2SiS5Xh6BlQ) | ||
|
||
## Server distributions | ||
|
||
- [XREDS](https://github.com/asascience-open/xreds) from RPS | ||
|
||
## Plugins | ||
|
||
- [OGC EDR](https://github.com/gulfofmaine/xpublish-edr/) | ||
- [OpenDAP](https://github.com/gulfofmaine/xpublish-opendap/) | ||
- [WMS](https://github.com/asascience-open/xpublish-wms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Getting started | ||
|
||
The getting started guide aims to get you using Xpublish productively as quickly as possible. | ||
It is designed as an entry point for new users, and it provided an introduction to Xpublish’s main concepts. | ||
|
||
```{toctree} | ||
:hidden: | ||
why-xpublish | ||
installation | ||
tutorial/index | ||
``` |
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
docs/source/getting-started/tutorial/dataset-provider-plugin.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Building a dataset provider plugin | ||
|
||
```{warning} | ||
Under construction. | ||
For now see the [plugin user guide](../../user-guide/plugins.rst) | ||
``` |
6 changes: 6 additions & 0 deletions
6
docs/source/getting-started/tutorial/dataset-router-plugin.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Creating a dataset router plugin | ||
|
||
```{warning} | ||
Under construction. | ||
For now see the [plugin user guide](../../user-guide/plugins.rst) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Building a dataset router | ||
|
||
It is also possible to create custom API routes and serve them via Xpublish. In | ||
the example below, we create a minimal application to get the mean value of a | ||
given variable in the published dataset: | ||
|
||
```python | ||
from fastapi import APIRouter, Depends, HTTPException | ||
from xpublish.dependencies import get_dataset | ||
|
||
|
||
myrouter = APIRouter() | ||
|
||
@myrouter.get("/{var_name}/mean") | ||
def get_mean(var_name: str, dataset: xr.Dataset = Depends(get_dataset)): | ||
if var_name not in dataset.variables: | ||
raise HTTPException( | ||
status_code=404, detail=f"Variable '{var_name}' not found in dataset" | ||
) | ||
|
||
return float(dataset[var_name].mean()) | ||
|
||
ds.rest(routers=[myrouter]) | ||
|
||
ds.rest.serve() | ||
``` | ||
|
||
Taking the dataset loaded above in this tutorial, this application should behave | ||
like this: | ||
|
||
- `/air/mean` returns a floating number | ||
- `/not_a_variable/mean` returns a 404 HTTP error | ||
|
||
The {func}`~xpublish.dependencies.get_dataset` function in the example above is | ||
a FastAPI dependency that is used to access the dataset object being served by | ||
the application, either from inside a FastAPI path operation decorated function | ||
or from another FastAPI dependency. Note that `get_dataset` can only be used | ||
as a function argument (FastAPI has other ways to reuse a dependency, but those | ||
are not supported in this case). | ||
|
||
Xpublish also provides a {func}`~xpublish.dependencies.get_cache` dependency | ||
function to get/put any useful key-value pair from/into the cache that is | ||
created along with a running instance of the application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Tutorial | ||
|
||
The Xpublish tutorial is designed for an experienced Xarray user (but not a server administrator) to be able to start at the beginning and build layers of understanding of how Xpublish and it's ecosystem work together. | ||
|
||
If you are interested in developing plugins or administering servers, you may want to jump ahead to [using plugins](./using-plugins.md) or look to [deployment](../../user-guide/deployment/index.md) in the user guide.. | ||
|
||
```{toctree} | ||
:hidden: | ||
introduction | ||
dataset-router | ||
serving-multiple-datasets | ||
using-plugins | ||
dataset-router-plugin | ||
dataset-provider-plugin | ||
``` |
Oops, something went wrong.