首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Sphinx Autodoc和NumpyDoc

Sphinx Autodoc和NumpyDoc
EN

Stack Overflow用户
提问于 2013-12-03 01:59:58
回答 1查看 4.1K关注 0票数 23

尽管阅读了this tutorialthis questionnumpy docstring standard,我还是无法让sphinx autodoc很好地处理numpy文档字符串。

在我的conf.py中,我有:

代码语言:javascript
运行
复制
extensions = ['sphinx.ext.autodoc', 'numpydoc']

在我的doc文件中,我有:

代码语言:javascript
运行
复制
 .. automodule:: python_file

 .. autoclass:: PythonClass
   :members:

其中,python_file.py具有:

代码语言:javascript
运行
复制
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"。当我向我的extensions添加autosummary时,如下所示:

代码语言:javascript
运行
复制
extensions = ['sphinx.ext.autodoc', 'numpydoc', 'sphinx.ext.autosummary']

我得到了:

代码语言:javascript
运行
复制
WARNING: toctree references unknown document u'docs/python_file.PythonClass.do_stuff'

按照this question的建议,我将numpydoc_show_class_members = False添加到我的conf.py中。

现在我可以毫无错误地运行make html了,但是ParametersReturns部分不会被解释为numpydoc部分。

有没有办法摆脱这个烂摊子?

EN

回答 1

Stack Overflow用户

发布于 2013-12-30 02:35:31

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

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20334804

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档