尽管阅读了本教程,这个问题和numpy docstring标准,但我无法让sphinx autodoc与numpy docstrings很好地配合.
在我的conf.py
身上:
extensions = ['sphinx.ext.autodoc', 'numpydoc']
在我的doc文件中,我有:
.. 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部分.
有没有办法解决这个烂摊子?