python python的代码文档
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/635419/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
code documentation for python
提问by Alex. S.
What is out there on conventions and tools for documenting python source code?
用于记录 Python 源代码的约定和工具有哪些?
采纳答案by Jarret Hardie
Epydocis also a good tool for documenting source code, and handles cross-referencing classes, modules, variables, etc, into HTML, PDF, LaTeX. Draws some nice class inheritance diagrams too. It's used by a number of open-source projects, so it's fairly actively developed.
Epydoc也是记录源代码的好工具,可以将交叉引用的类、模块、变量等处理成 HTML、PDF、LaTeX。也绘制了一些不错的类继承图。许多开源项目都在使用它,因此它的开发相当活跃。
回答by vartec
Conventions: PEP 257and PEP 8. Note, that docstrings can be written in reStructuredText
约定:PEP 257和PEP 8。请注意,文档字符串可以写在reStructuredText 中
Tools for generating documentation: for example Sphinx
用于生成文档的工具:例如Sphinx
回答by S.Lott
First, put comments in your docstrings using RestructuredText format.
首先,使用 RestructuredText 格式在文档字符串中添加注释。
Second, get sphinx.
其次,获得sphinx。
Third, create an index that uses the autodoc extension.
第三,创建一个使用autodoc 扩展名的索引。
Then, run Sphinx to get really nice documentation.
然后,运行 Sphinx 以获得非常好的文档。
回答by dwc
It's very nice to put code documentation in the code itself. See:
将代码文档放在代码本身中是非常好的。看:
回答by sancelot
using doxypy filter with doxygen is a good thing also
使用带有 doxygen 的 doxypy 过滤器也是一件好事