改良斯芬克斯“拿破仑”扩建。
sphinxcontrib-napoleon2的Python项目详细描述
Napoleon-*朝着清晰的文档字符串前进*
=======
更新
----
从Sphinx 1.3开始,Napoleon扩展将在Sphinx.ext.Napoleon下与Sphinx一起打包。`` sphinxcontrib.napoleon2``为更多指令提供
支持。它最适合于
`sphinx theme<;https://github.com/linxifan/sphinx theme>;``基于readthedocs.org的定制主题
``sphinxcontrolib.napolean2``基于
``sphinxcontrolib.napolean v0.6.0``<;https://bitbucket.org/robruana/sphinx contrib/src/default/napoleon/>;`_,由Rob Ruana编写。
+—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————(蓝色)``。注意,。另请参见,。参考` `
+——————————————————————————————————————————————————————提示。。示例```
+————————————————————————————————————————————————————————————————————————————————————————————————————————————————|危险(红色)``。危险,.error,.important```
+————————————————————————————————————————————————`_
>安装
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ br/>
:
>
``docs/source/conf.py````` docs/source/source/conf.py````扩展``列表中添加``sphinxcontrib.napolean ```到``扩展``列表中,然后将``sphinxxcontrib.napolean ``添加到``扩展``扩展``扩展`` ~参考到"sphinxcontrollib-napolean2/directives.py"中了解如何添加新的
指令。
-向"sphinxcontrolib-napolean2/docstring.py"中添加新的解析器方法。
请参阅标有"added"的行。
-添加"app.add"指令("示例",示例指令)``to``setup()`
函数位于``sphinxcontrib-napolean2/\uu init\uu.py``
-修改``sphinx theme/sass/\u theme\u rst.sass``以支持主题中的新指令。
-原始设计位于
`` sphinx theme/wyrm/sass/wyrm_core/_alert.sass``
intro
----
wrap
:type field_storage:filestorage
:param temporary:当文件
实例被破坏时是否删除文件
:type temporary:bool
:返回:缓冲的可写文件描述符
:rtype:bufferedfilestorage
`structuredtext<;http://docutils.sourceforge.net/rst.html>;``很好,但它创建了视觉密集、难以读取的文档字符串<;http://www.python.org/dev/peps/pep-0287/>;`。将上面的
乱码与根据"google python
style guide<;http://google.github.io/styleguide/pyguide.html>;`_
::
参数:
路径(str):要包装的文件的路径
字段存储(file storage):要包装的:类:`filestorage`实例
临时(bool):当文件
实例被破坏时是否删除文件
返回:
bufferedfilestorage:a buffered writable file descriptor
napoleon是一个"sphinx
扩展名<;http://sphinx doc.org/extensions.html>;``它使sphinx
能够同时解析
`numpy<;https://github。com/numpy/numpy/blob/master/doc/howto戋document.rst.txt>;`戋戋br/>和
`google<;http://google.github.io/styleguide/pyguide.html戋comments>;`戋戋br/>样式docstrings-由"khan
academy<推荐的样式;https://sites.google.com/a/khanacademy.org/forge/for developers/styleguide/python toc docstrings>;` http://google.github.io/styleguide/pyguide.html comments>;`这发生在sphinx处理文档的中间步骤中,因此它不会修改实际源代码文件中的任何文档字符串。
安装Napoleon扩展:
:
$pip安装SphinxContrib Napoleon
2。在将sphinx<;http://sphinx doc.org/tutorial.html>;``设置为
生成文档后,在sphinx conf.py文件中启用napoleon:
:
conf.py
"斯芬克森特里布。拿破仑"]
3.使用sphinx api doc来构建您的api文档:
:
$sphinx apidoc-f-o docs/source projectdir
--
autodoc<;http://sphinx doc.org/ext/autodoc.html>;``uuuu可以找到的每个docstring,包括
docstrings on:``modules``,``classes`,``attributes`,``methods`,
``functions`,and``variables`。在每个docstring中,特别是格式化的"节"<;>;`_分析并转换为RestructuredText。
所有标准的RestructuredText格式仍按预期工作。
----
>支持以下所有节头:
-``args``*(参数别名)*
-``参数``*(参数的别名)*
-``属性`
-``示例`
-``示例`
-``关键字参数``*(关键字参数的别名)*
-``关键字参数`
-``方法`
-``注释`
-``注释`
-``其他参数`
-``parameters``
-``return``*(返回的别名)*
-``returns`
-``引发`
-``引用`
-``另请参见`
-``warning``
-``warnings``*(警告的别名)*
-``警告``
-``yield`*(返回的别名产量)*
-``产量`
添加在SphinxContrib-Napoleo2中:
-``引用``*(引用的别名)*
-``提示`
-``提示``
-``注意`
-``危险`
-``重要`
-``错误`
googlevs numpy
---------
napoleon支持两种类型的docstring:
`google<;http://google.github.io/styleguide/pyguide.html comments>;``
和
`numpy<;https://github.com/numpy/numpy/blob/master/doc/howto_document.rst.txt>;`
两种样式是google使用缩进
分隔节,而numpy使用下划线。
:
def func(arg1,arg2):
"摘要行"。
函数的扩展描述。
args:
arg1(int):arg1的说明
arg2(str):arg2的说明
函数的扩展描述。
arg1的说明
arg2:str
arg2的说明
而google风格则倾向于使用更多的水平空间。google风格倾向于更容易阅读短而简单的docstring,而numpy风格倾向于更容易阅读长而深入的docstring。
the`khan
academy<;https://sites.google.com/a/khanacademy.org/forge/for developers/styleguide/python&toc docstrings>;`_
建议使用google风格。
为您的项目选择一种样式并与之保持一致。
有关完整文档,请参见https://sphinxcontrib napoleon.readthedocs.io
=======
更新
----
从Sphinx 1.3开始,Napoleon扩展将在Sphinx.ext.Napoleon下与Sphinx一起打包。`` sphinxcontrib.napoleon2``为更多指令提供
支持。它最适合于
`sphinx theme<;https://github.com/linxifan/sphinx theme>;``基于readthedocs.org的定制主题
``sphinxcontrolib.napolean2``基于
``sphinxcontrolib.napolean v0.6.0``<;https://bitbucket.org/robruana/sphinx contrib/src/default/napoleon/>;`_,由Rob Ruana编写。
+—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————(蓝色)``。注意,。另请参见,。参考` `
+——————————————————————————————————————————————————————提示。。示例```
+————————————————————————————————————————————————————————————————————————————————————————————————————————————————|危险(红色)``。危险,.error,.important```
+————————————————————————————————————————————————`_
>安装
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ br/>
:
>
``docs/source/conf.py````` docs/source/source/conf.py````扩展``列表中添加``sphinxcontrib.napolean ```到``扩展``列表中,然后将``sphinxxcontrib.napolean ``添加到``扩展``扩展``扩展`` ~参考到"sphinxcontrollib-napolean2/directives.py"中了解如何添加新的
指令。
-向"sphinxcontrolib-napolean2/docstring.py"中添加新的解析器方法。
请参阅标有"added"的行。
-添加"app.add"指令("示例",示例指令)``to``setup()`
函数位于``sphinxcontrib-napolean2/\uu init\uu.py``
-修改``sphinx theme/sass/\u theme\u rst.sass``以支持主题中的新指令。
-原始设计位于
`` sphinx theme/wyrm/sass/wyrm_core/_alert.sass``
intro
----
wrap
:type field_storage:filestorage
:param temporary:当文件
实例被破坏时是否删除文件
:type temporary:bool
:返回:缓冲的可写文件描述符
:rtype:bufferedfilestorage
`structuredtext<;http://docutils.sourceforge.net/rst.html>;``很好,但它创建了视觉密集、难以读取的文档字符串<;http://www.python.org/dev/peps/pep-0287/>;`。将上面的
乱码与根据"google python
style guide<;http://google.github.io/styleguide/pyguide.html>;`_
::
参数:
路径(str):要包装的文件的路径
字段存储(file storage):要包装的:类:`filestorage`实例
临时(bool):当文件
实例被破坏时是否删除文件
返回:
bufferedfilestorage:a buffered writable file descriptor
napoleon是一个"sphinx
扩展名<;http://sphinx doc.org/extensions.html>;``它使sphinx
能够同时解析
`numpy<;https://github。com/numpy/numpy/blob/master/doc/howto戋document.rst.txt>;`戋戋br/>和
`google<;http://google.github.io/styleguide/pyguide.html戋comments>;`戋戋br/>样式docstrings-由"khan
academy<推荐的样式;https://sites.google.com/a/khanacademy.org/forge/for developers/styleguide/python toc docstrings>;` http://google.github.io/styleguide/pyguide.html comments>;`这发生在sphinx处理文档的中间步骤中,因此它不会修改实际源代码文件中的任何文档字符串。
安装Napoleon扩展:
:
$pip安装SphinxContrib Napoleon
2。在将sphinx<;http://sphinx doc.org/tutorial.html>;``设置为
生成文档后,在sphinx conf.py文件中启用napoleon:
:
conf.py
"斯芬克森特里布。拿破仑"]
3.使用sphinx api doc来构建您的api文档:
:
$sphinx apidoc-f-o docs/source projectdir
docstrings on:``modules``,``classes`,``attributes`,``methods`,
``functions`,and``variables`。在每个docstring中,特别是格式化的"节"<;>;`_分析并转换为RestructuredText。
所有标准的RestructuredText格式仍按预期工作。
>支持以下所有节头:
-``args``*(参数别名)*
-``参数``*(参数的别名)*
-``属性`
-``示例`
-``示例`
-``关键字参数``*(关键字参数的别名)*
-``关键字参数`
-``方法`
-``注释`
-``注释`
-``其他参数`
-``parameters``
-``return``*(返回的别名)*
-``returns`
-``引发`
-``引用`
-``另请参见`
-``warning``
-``warnings``*(警告的别名)*
-``警告``
-``yield`*(返回的别名产量)*
-``产量`
添加在SphinxContrib-Napoleo2中:
-``引用``*(引用的别名)*
-``提示`
-``提示``
-``注意`
-``危险`
-``重要`
-``错误`
googlevs numpy
---------
napoleon支持两种类型的docstring:
`google<;http://google.github.io/styleguide/pyguide.html comments>;``
和
`numpy<;https://github.com/numpy/numpy/blob/master/doc/howto_document.rst.txt>;`
两种样式是google使用缩进
分隔节,而numpy使用下划线。
:
def func(arg1,arg2):
"摘要行"。
函数的扩展描述。
args:
arg1(int):arg1的说明
arg2(str):arg2的说明
函数的扩展描述。
arg1的说明
arg2:str
arg2的说明
而google风格则倾向于使用更多的水平空间。google风格倾向于更容易阅读短而简单的docstring,而numpy风格倾向于更容易阅读长而深入的docstring。
the`khan
academy<;https://sites.google.com/a/khanacademy.org/forge/for developers/styleguide/python&toc docstrings>;`_
建议使用google风格。
为您的项目选择一种样式并与之保持一致。
有关完整文档,请参见https://sphinxcontrib napoleon.readthedocs.io