Skip to content

Commit 7e0d993

Browse files
authored
Merge pull request #22 from andrewdnolan/doc_updates
Update API documentation and switch to `@properties` for some `Descriptor` attributes.
2 parents 8afd7cc + 7205e75 commit 7e0d993

File tree

7 files changed

+287
-138
lines changed

7 files changed

+287
-138
lines changed

dev-environment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ pre-commit
2525
# Documentation
2626
sphinx
2727
myst-nb
28-
myst-parser
2928
sphinx-book-theme
3029
sphinx-copybutton
30+
sphinx-remove-toctrees

docs/conf.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def setup(app):
4343
'sphinx.ext.autodoc',
4444
'sphinx.ext.autosummary',
4545
'sphinx.ext.intersphinx',
46+
'sphinx.ext.napoleon',
47+
'sphinx_remove_toctrees',
4648
]
4749

4850
source_suffix = {
@@ -61,7 +63,8 @@ def setup(app):
6163
'cartopy': ('https://scitools.org.uk/cartopy/docs/latest/', None),
6264
'matplotlib': ('https://matplotlib.org/stable', None),
6365
'numpy': ('https://numpy.org/doc/stable', None),
64-
'xarray': ('https://xarray.pydata.org/en/stable', None)
66+
'python': ('https://docs.python.org/3/', None),
67+
'xarray': ('https://xarray.pydata.org/en/stable', None),
6568
}
6669

6770
# -- MyST settings -----------------------------------------------------------
@@ -87,4 +90,25 @@ def setup(app):
8790
"show_navbar_depth": 3
8891
}
8992

90-
html_static_path = ['_static']
93+
remove_from_toctrees = ["developers_guide/generated/*"]
94+
95+
autodoc_typehints = "none"
96+
97+
copybutton_prompt_text = ">>> "
98+
99+
# Napoleon configurations
100+
napoleon_google_docstring = False
101+
napoleon_numpy_docstring = True
102+
napoleon_preprocess_types = True
103+
napoleon_type_aliases = {
104+
"cartopy.crs.Projection": ":class:`cartopy.crs.CRS`",
105+
# objects without namespace: xarray
106+
"DataArray": "~xarray.DataArray",
107+
"Dataset": "~xarray.Dataset",
108+
# matplotlib terms
109+
"matplotlib axes object": ":py:class:`matplotlib axes object <matplotlib.axes.Axes>`",
110+
# objects without namespace: numpy
111+
"ndarray": "~numpy.ndarray",
112+
"path-like": ":term:`path-like <path-like object>`",
113+
"string": ":class:`string <str>`",
114+
}

docs/developers_guide/api.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,42 @@
11
(dev-api)=
22

3-
# API Reference
4-
53
```{eval-rst}
64
.. currentmodule:: mosaic
75
6+
.. _api:
7+
8+
API Reference
9+
=============
10+
11+
This page provides an auto-generated summary of mosaic's API.
12+
13+
Top Level Utilities
14+
-------------------
815
.. autosummary::
916
:toctree: generated/
1017
1118
polypcolor
1219
Descriptor
1320
datasets.open_dataset
14-
```
1521
22+
Descriptor
23+
----------
24+
25+
Constructor
26+
~~~~~~~~~~~
27+
.. autosummary::
28+
:toctree: generated/
1629
30+
Descriptor
31+
32+
Properties
33+
~~~~~~~~~~
34+
.. autosummary::
35+
:toctree: generated/
36+
37+
Descriptor.cell_patches
38+
Descriptor.edge_patches
39+
Descriptor.vertex_patches
40+
Descriptor.transform
41+
42+
```

mosaic/datasets.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# idea borrowed/copied from xarray
4444
def open_dataset(
4545
name: str,
46-
cache_dir: None | str | os.PathLike = None,
46+
cache_dir: str | os.PathLike | None = None,
4747
cache: bool = True,
4848
**kwargs,
4949
) -> Dataset:
@@ -67,7 +67,8 @@ def open_dataset(
6767
cache : bool, optional
6868
If True, then cache data locally for use on subsequent calls
6969
kwargs : dict, optional
70-
Passed to xarray.open_dataset
70+
Additional arguments passed on to :py:func:`xarray.open_dataset`.
71+
7172
"""
7273

7374
# invalid dataset name requested

0 commit comments

Comments
 (0)