Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
NumPy如何将字符串文件化到sphinx文档中以获取参数?_Numpy_Python Sphinx_Docstring - Fatal编程技术网

NumPy如何将字符串文件化到sphinx文档中以获取参数?

NumPy如何将字符串文件化到sphinx文档中以获取参数?,numpy,python-sphinx,docstring,Numpy,Python Sphinx,Docstring,我想使用sphinx构建我们的文档,并获得与NumPy文档相同的参数格式() 我发现有两种方法可以使用sphinx以这种rst样式记录参数,一种是 :param name: description 或 另一个(是NumPy风格) 下面是一个类似的示例: 来源呢 def get_subpackage(self,subpackage_name, subpackage_path=None, parent_name=None

我想使用sphinx构建我们的文档,并获得与NumPy文档相同的参数格式()

我发现有两种方法可以使用sphinx以这种rst样式记录参数,一种是

:param name: description

另一个(是NumPy风格)

下面是一个类似的示例:

来源呢

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样式时,我没有得到格式化。看一下rst语法()似乎

Parameters
----------
这只是一个章节标题。但是将此格式与sphinx一起使用时,title参数不会出现在输出中,并且它不会获得任何参数节格式

有人知道NumPy是如何使用sphinx构建文档的,从而使这种格式适用于参数的吗


我试图查看makefile和conf.py,但我不确定NumPy如何使用自定义Sphinx扩展名:

您可以使用安装

pip install numpydoc
然后通过添加到扩展名列表,将其添加到sphinx conf.py文件中

extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'numpydoc']

你能更新一下(现在坏了的)链接吗?干杯如果有人也在寻找狮身人面像主题NumPy的用途,那么它是
pip install numpydoc
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'numpydoc']