【发布时间】:2013-12-02 17:59:57
【问题描述】:
尽管阅读了 this tutorial、this question 和 numpy docstring standard,但我无法让 sphinx autodoc 与 numpy 文档字符串很好地配合使用。
在我的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'
根据this question 的建议,我将numpydoc_show_class_members = False 添加到我的conf.py。
现在我可以运行 make html 而不会出错,但 Parameters 和 Returns 部分不会被解释为 numpydoc 部分。
有办法摆脱这种混乱吗?
【问题讨论】:
标签: numpy python-sphinx autodoc numpydoc