Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use napolean extension in docs to handle numpy docstrings too #3871

Merged
merged 6 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/iris/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def autolog(message):
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"sphinx.ext.napoleon",
# TODO: Spelling extension disabled until the dependencies can be included
# "sphinxcontrib.spelling",
"sphinx_gallery.gen_gallery",
Expand All @@ -125,6 +126,22 @@ def autolog(message):
"generate_package_rst",
]

# -- Napoleon extension -------------------------------------------------------
# See https://sphinxcontrib-napoleon.readthedocs.io/en/latest/sphinxcontrib.napoleon.html
napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = False
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = True # includes dunders in api doc
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True
napoleon_use_keyword = True
napoleon_custom_sections = None

# -- spellingextension --------------------------------------------------------
# See https://sphinxcontrib-spelling.readthedocs.io/en/latest/customize.html
spelling_lang = "en_GB"
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/analysis/maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ def __call__(
Dimension along which to apply `other` if it's a coordinate that is
not found in `cube`

* **kwargs_data_func:
* kwargs_data_func:
Keyword arguments that get passed on to the data_func.

Returns:
Expand Down
37 changes: 20 additions & 17 deletions lib/iris/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ def add_saver(file_extension, new_saver):

Args:

* file_extension - A string such as "pp" or "my_format".
* new_saver - A function of the form ``my_saver(cube, target)``.
* file_extension: A string such as "pp" or "my_format".
* new_saver: A function of the form ``my_saver(cube, target)``.

See also :func:`iris.io.save`

Expand Down Expand Up @@ -351,24 +351,27 @@ def save(source, target, saver=None, **kwargs):

Args:

* source - A :class:`iris.cube.Cube`, :class:`iris.cube.CubeList` or
sequence of cubes.
* target - A filename (or writeable, depending on file format).
When given a filename or file, Iris can determine the
file format.
* source:
:class:`iris.cube.Cube`, :class:`iris.cube.CubeList` or
sequence of cubes.
* target:
A filename (or writeable, depending on file format).
When given a filename or file, Iris can determine the
file format.

Kwargs:

* saver - Optional. Specifies the file format to save.
If omitted, Iris will attempt to determine the format.

If a string, this is the recognised filename extension
(where the actual filename may not have it).
Otherwise the value is a saver function, of the form:
``my_saver(cube, target)`` plus any custom keywords. It
is assumed that a saver will accept an ``append`` keyword
if it's file format can handle multiple cubes. See also
:func:`iris.io.add_saver`.
* saver:
Optional. Specifies the file format to save.
If omitted, Iris will attempt to determine the format.

If a string, this is the recognised filename extension
(where the actual filename may not have it).
Otherwise the value is a saver function, of the form:
``my_saver(cube, target)`` plus any custom keywords. It
is assumed that a saver will accept an ``append`` keyword
if it's file format can handle multiple cubes. See also
:func:`iris.io.add_saver`.

All other keywords are passed through to the saver function; see the
relevant saver documentation for more information on keyword arguments.
Expand Down
3 changes: 3 additions & 0 deletions requirements/ci/py36.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ dependencies:
- sphinx-copybutton
- sphinx-gallery
- sphinx_rtd_theme
- pip
- pip:
- sphinxcontrib-napoleon
tkknight marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions requirements/ci/py37.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ dependencies:
- sphinx-copybutton
- sphinx-gallery
- sphinx_rtd_theme
- pip
- pip:
- sphinxcontrib-napoleon
1 change: 1 addition & 0 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ sphinx
sphinx-copybutton
sphinx-gallery
sphinx_rtd_theme
sphinxcontrib-napoleon