尽管我已经阅读了这个教程, 这个问题和numpy文档字符串标准, 但我仍然无法使sphinx autodoc与numpy文档字符串很好地配合使用。
在我的
在我的文档文件中有:
当我运行
我得到:
根据这个问题的建议,我在我的
现在我可以运行
有什么解决办法吗?
在我的
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'
根据这个问题的建议,我在我的
conf.py
中添加了numpydoc_show_class_members = False
。现在我可以运行
make html
而不出现错误,但是Parameters
和Returns
部分没有被解释为numpydoc部分。有什么解决办法吗?