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

updating style doc for list parameter #200

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions doc/source/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Chronological list of authors
- Cédric Bouysset
2022
- Florent Langenfeld
- Kavya Bisht
- Bjarne Feddersen
- Mark Verma
- Patricio Barletta
Expand Down
16 changes: 15 additions & 1 deletion doc/source/contributing_code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ A typical function docstring looks like the following:

::

def func(arg1, arg2):
def func(arg1, arg2, arg3):
"""Summary line.

Extended description of function.
Expand All @@ -751,6 +751,8 @@ A typical function docstring looks like the following:
Description of `arg1`
arg2 : str
Description of `arg2`
arg3 : list[int]
Description of `arg3`


Returns
Expand All @@ -761,6 +763,18 @@ A typical function docstring looks like the following:
"""
return True

.. note::

While MDAnalysis continues to support Python versions under 3.9,
type hinting should follow the syntax first laid out in
`PEP 484 – Type Hints <https://www.python.org/dev/peps/pep-0484/>`_.
However, as shown in the example above, function **documentation**
should follow the type hinting recommendations laid out in
`PEP 585 – Type Hinting Generics In Standard Collections <https://peps.python.org/pep-0585/>`_.
That means that for now, type hinting should still import from ``typing``
and a dictionary would still be hinted as ``Dict[Tuple[str, str], int]``.
However, the corresponding docstring would describe the argument as ``dict[tuple[str, str], int]``.

robotjellyzone marked this conversation as resolved.
Show resolved Hide resolved
.. seealso::

The `napoleon documentation <https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html>`_ has further breakdowns of docstrings at the module, function, class, method, variable, and other levels.
Expand Down
Loading