How to write a docstring¶
All functionality needs to have a documentation string (docstrings). The convention used in Nashpy is to follow Numpy’s docstring convention:
def <function>(<signature>):
"""
<short summary>
Parameters
----------
<paramter> : <type>
<description>
<paramter> : <type>
<description>
...
<paramter> : <type>
<description>
Returns
-------
<type>
<description>
"""
If the function/method does not return anything but is instead a generator
then Returns
should be replaced with Yields
.
How to check dosctrings in a module¶
Running tests with tox will automatically check formatting of docstrings.
If you want to check a specific file, use darglint:
$ python -m pip install darglint
$ darglint -s numpy <path_to_file>