10

Sphinx を使用してドキュメントを作成し、NumPy ドキュメント ( https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt )と同じパラメーターのフォーマットを取得したい

sphinx を使用してこの最初のスタイルでパラメーターを文書化する方法を 2 つ見つけました。

:param name: description

また

:keyword name: description

もう1つは(NumPyスタイルです)

Parameters
----------
name: type
    description

以下に例を示します。

http://docs.scipy.org/doc/numpy/reference/distutils.html#module-numpy.distutils

とソース

def get_subpackage(self,subpackage_name,
                   subpackage_path=None,
                   parent_name=None,
                   caller_level = 1):
    """Return list of subpackage configurations.

    Parameters
    ----------
    subpackage_name: str,None
        Name of the subpackage to get the configuration. '*' in
        subpackage_name is handled as a wildcard.
    subpackage_path: str
        If None, then the path is assumed to be the local path plus the
        subpackage_name. If a setup.py file is not found in the
        subpackage_path, then a default configuration is used.
    parent_name: str
        Parent name.
    """

ただし、sphinx を使用してドキュメントを作成すると (私は sphinx-apidoc と sphinx-build を使用しています)、最初の構文 ( :param name: description ) を使用すると書式設定されたリストを生成できますが、NumPy を使用しようとするとスタイル フォーマットがわかりません。最初の構文 ( http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections )を見ると、

Parameters
----------

は単なるセクションのタイトルです。ただし、sphinx でこの書式設定を使用すると、タイトル パラメーターは出力に表示されず、パラメーター セクションの書式設定も取得されません。

NumPy が sphinx を使用してドキュメントを作成し、この種の書式設定をパラメーターに対して機能させる方法を知っている人はいますか?

makefile と conf.py を見ようとしましたが、方法がわかりません

4

1 に答える 1

19

NumPy はカスタム Sphinx 拡張機能を使用します: https://pypi.python.org/pypi/numpydoc

でインストールできます

pip install numpydoc

次に、拡張子リストに追加して、それを sphinx conf.py ファイルに追加します。

extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'numpydoc']
于 2013-07-01T04:31:59.690 に答える