Skip to content

Commit f8c3a89

Browse files
authored
Add api using sphinx_autosummary_accessors (#43)
* Add api using sphinx_autosummary_accessors * actual add api.rst
1 parent b8286a0 commit f8c3a89

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

ci/doc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ dependencies:
1515
- pip:
1616
- cf_xarray
1717
- sphinx-book-theme
18+
- git+https://github.com/keewis/sphinx-autosummary-accessors

doc/api.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. currentmodule:: xarray
2+
3+
API
4+
===
5+
6+
DataArray
7+
---------
8+
9+
.. autosummary::
10+
:toctree: generated/
11+
:template: autosummary/accessor_attribute.rst
12+
13+
14+
15+
.. autosummary::
16+
:toctree: generated/
17+
:template: autosummary/accessor_method.rst
18+
19+
DataArray.cf.describe
20+
DataArray.cf.get_valid_keys
21+
22+
Dataset
23+
-------
24+
25+
.. autosummary::
26+
:toctree: generated/
27+
:template: autosummary/accessor_attribute.rst
28+
29+
30+
31+
.. autosummary::
32+
:toctree: generated/
33+
:template: autosummary/accessor_method.rst
34+
35+
Dataset.cf.describe
36+
Dataset.cf.get_valid_keys

doc/conf.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import os
1616
import sys
1717

18+
import sphinx_autosummary_accessors
19+
1820
import cf_xarray # noqa
1921

2022
# If extensions (or modules to document with autodoc) are in another directory,
@@ -45,6 +47,7 @@
4547
"IPython.sphinxext.ipython_console_highlighting",
4648
"IPython.sphinxext.ipython_directive",
4749
"nbsphinx",
50+
"sphinx_autosummary_accessors",
4851
]
4952

5053
extlinks = {
@@ -53,7 +56,7 @@
5356
}
5457

5558
# Add any paths that contain templates here, relative to this directory.
56-
templates_path = ["_templates"]
59+
templates_path = ["_templates", sphinx_autosummary_accessors.templates_path]
5760

5861
# The suffix of source filenames.
5962
source_suffix = ".rst"
@@ -294,3 +297,10 @@
294297
"python": ("https://docs.python.org/3/", None),
295298
"xarray": ("http://xarray.pydata.org/en/stable/", None),
296299
}
300+
301+
autosummary_generate = True
302+
303+
autodoc_typehints = "none"
304+
305+
napoleon_use_param = True
306+
napoleon_use_rtype = True

doc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on xarray objects.
1515
examples/index
1616
roadmap
1717
contributing
18+
api
1819

1920
Indices and tables
2021
==================

0 commit comments

Comments
 (0)