несмотря на то, что прочитал это руководство, этот вопрос и стандарт numpy docstring, я не могу заставить sphinx autodoc хорошо работать с numpy docstrings.
В моем conf.py
есть:
extensions = ['sphinx.ext.autodoc', 'numpydoc']
и в моем файле документации есть:
.. automodule:: python_file
.. autoclass:: PythonClass
:members:
где python_file.py
имеет:
class PythonClass(object):
def do_stuff(x):
"""
This does good stuff.
Here are the details about the good stuff it does.
Parameters
----------
x : int
An integer which has amazing things done to it
Returns
-------
y : int
Some other thing
"""
return x + 1
Когда я бегу make html
, я получаю ERROR: Unknown directive type "autosummary"
. Когда я добавляю autosummary
к своему extensions
таким образом:
extensions = ['sphinx.ext.autodoc', 'numpydoc', 'sphinx.ext.autosummary']
Я получил:
WARNING: toctree references unknown document u'docs/python_file.PythonClass.do_stuff'
В соответствии с рекомендациями этого вопроса, я добавляю numpydoc_show_class_members = False
в мой conf.py
.
Теперь я могу запустить make html
без ошибок, но разделы Parameters
и Returns
не интерпретируются как разделы numpydoc.
Есть ли выход из этой неразберихи?