23

このチュートリアルこの質問、およびnumpy docstring standardを読んだにもかかわらず、sphinx autodoc で numpy docstring をうまく処理できません。

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 htmlERROR: 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エラーなしで実行できるようになりましたが、 ParametersandReturnsセクションは numpydoc セクションとして解釈されません。

この混乱から抜け出す方法はありますか?

4

1 に答える 1