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

DOC: include positional-only and keyword-only parameters in standard #367

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
9 changes: 8 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@
version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', numpydoc.__version__)
version = re.sub(r'(\.dev\d+).*?$', r'\1', version)
numpydoc_xref_param_type = True
numpydoc_xref_ignore = {'optional', 'type_without_description', 'BadException'}
numpydoc_xref_ignore = {
'optional',
'type_without_description',
'BadException',
'keyword-only',
'positional-only',
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition is not particularly necessary since "keyword-only" and "positional-only" don't appear in any docstrings in the repo that I could find, but I tentatively included it in here to be consistent with the standard.

# Run docstring validation as part of build process
numpydoc_validation_checks = {"all", "GL01", "SA04", "RT03"}

Expand Down
7 changes: 7 additions & 0 deletions doc/format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ used as a value, ``optional`` is preferred. These are all equivalent::
copy : bool, default=True
copy : bool, default: True

Use ``positional-only`` for positional-only parameters, and ``keyword-only``
for keyword-only parameters::

x : int, positional-only
y : int, keyword-only
z : int, keyword-only, optional

When a parameter can only assume one of a fixed set of values,
those values can be listed in braces, with the default appearing first::

Expand Down
2 changes: 1 addition & 1 deletion doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ numpydoc_xref_ignore : set or ``"all"``
used in parameter type descriptions that may be confused for
classes of the same name. For example::

numpydoc_xref_ignore = {'type', 'optional', 'default'}
numpydoc_xref_ignore = {'type', 'optional', 'default', 'keyword-only', 'positional-only'}

The default is an empty set.

Expand Down