このチュートリアル、この質問、および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 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'
この質問で推奨されているように、私はに追加numpydoc_show_class_members = False
しますconf.py
。
make html
エラーなしで実行できるようになりましたが、 Parameters
andReturns
セクションは numpydoc セクションとして解釈されません。
この混乱から抜け出す方法はありますか?