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

Link custom type aliases (numeric, etc) in docstrings to their definitions #1693

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
9 changes: 9 additions & 0 deletions docs/sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@

napoleon_use_rtype = False # group rtype on same line together with return

napoleon_type_aliases = {
# link to the sphinx targets & definitions in contributing.rst
'dict-like': ':ref:`dict-like <dict-like>`',
'numeric': ':ref:`numeric <numeric>`',
'array-like': ':ref:`array-like <array-like>`',
}
napoleon_preprocess_types = True


# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down
6 changes: 3 additions & 3 deletions docs/sphinx/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ allows for multiple input types to work for many parameters. pvlib uses
the following generic descriptors as short-hand to indicate which
specific types may be used:

* dict-like : dict, OrderedDict, pd.Series
* numeric : scalar, np.array, pd.Series. Typically int or float dtype.
* array-like : np.array, pd.Series. Typically int or float dtype.
* _`dict-like` : dict, OrderedDict, pd.Series
* _`numeric` : scalar, np.array, pd.Series. Typically int or float dtype.
* _`array-like` : np.array, pd.Series. Typically int or float dtype.

Parameters that specify a specific type require that specific input type.

Expand Down