Sphinx自动文档和NumpyDoc

23
尽管我已经阅读了这个教程, 这个问题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而不出现错误,但是ParametersReturns部分没有被解释为numpydoc部分。
有什么解决办法吗?
1个回答

3
尝试删除之前的整个html输出,然后重新生成文档。

2
这对我没有用。在删除并重新运行后,问题仍然存在。还有别的想法吗? - Brian

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接