Комментарии об аргументах для функций в Python также должны быть включены в строки документации, и тогда вы можете использовать Sphinx для автоматического создания документации. Sphinx изначально был создан для самой документации Python.
По умолчанию Sphinx принимает следующий формат строки документации (см. здесь ):
:param [ParamName]: [ParamDescription], defaults to [DefaultParamVal]
:type [ParamName]: [ParamType](, optional)
...
:raises [ErrorType]: [ErrorDescription]
...
:return: [ReturnDescription]
:rtype: [ReturnType]
Но вы можетеиспользуйте расширение Наполеон для Сфинкса , чтобы прочитать гораздо более читаемый (и, следовательно, Pythonic) Строки документации Google Style :
def fetch_bigtable_rows(big_table, keys, other_silly_variable=None):
"""Fetches rows from a Bigtable.
Retrieves rows pertaining to the given keys from the Table instance
represented by big_table. Silly things may happen if
other_silly_variable is not None.
Args:
big_table: An open Bigtable Table instance.
keys: A sequence of strings representing the key of each table row
to fetch.
other_silly_variable: Another optional variable, that has a much
longer name than the other args, and which does nothing.
"""