Sphinx Introducation: Python Documentation Generator
0 Install Sphinx
easy_install -U Sphinx
1 Build Project
1.1 sphinx-quickstart
michael@ubuntu:~/release/sphinx$ sphinx-quickstart
Welcome to the Sphinx 1.1.3 quickstart utility.
Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).
1.2 Root path for the documentation
Enter the root path for documentation.
> Root path for the documentation [.]:
You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/N) [n]: y
1.3 Name prefix for templates and static dir
Inside the root directory, two more directories will be created; "_templates"
for custom HTML templates and "_static" for custom stylesheets and other static
files. You can enter another prefix (such as ".") to replace the underscore.
> Name prefix for templates and static dir [_]:
1.4 Project name
The project name will occur in several places in the built documentation.
> Project name: NginxCreed
1.5 Author name
> Author name(s): Chao Zhong
1.6 Project version
Sphinx has the notion of a "version" and a "release" for the
software. Each version can have multiple releases. For example, for
Python the version is something like 2.5 or 3.0, while the release is
something like 2.5.1 or 3.0a1. If you don't need this dual structure,
just set both to the same value.
> Project version: 0.1
> Project release [0.1]:
1.7 Source file suffix
The file name suffix for source files. Commonly, this is either ".txt"
or ".rst". Only files with this suffix are considered documents.
> Source file suffix [.rst]:
1.8 Name of your master document (without suffix)
One document is special in that it is considered the top node of the
"contents tree", that is, it is the root of the hierarchical structure
of the documents. Normally, this is "index", but if your "index"
document is a custom template, you can also set this to another filename.
> Name of your master document (without suffix) [index]:
1.9 Do you want to use the epub builder
Sphinx can also add configuration for epub output:
> Do you want to use the epub builder (y/N) [n]:
1.10 Other questions
Please indicate if you want to use one of the following Sphinx extensions:
> autodoc: automatically insert docstrings from modules (y/N) [n]:
> doctest: automatically test code snippets in doctest blocks (y/N) [n]:
> intersphinx: link between Sphinx documentation of different projects (y/N) [n]:
> todo: write "todo" entries that can be shown or hidden on build (y/N) [n]: y
> coverage: checks for documentation coverage (y/N) [n]:
> pngmath: include math, rendered as PNG images (y/N) [n]:
> mathjax: include math, rendered in the browser by MathJax (y/N) [n]:
> ifconfig: conditional inclusion of content based on config values (y/N) [n]:
> viewcode: include links to the source code of documented Python objects (y/N) [n]:
1.11 Create Makefile/Create Windows command file
A Makefile and a Windows command file can be generated for you so that you
only have to run e.g. `make html' instead of invoking sphinx-build
directly.
> Create Makefile? (Y/n) [y]:
> Create Windows command file? (Y/n) [y]:
2 Make HTML
在刚才执行 sphinx-quickstart 的目录下,运行:
make html
会将 Sphinx 提供的默认测试文件生成 HTML,然后配置好 Web 服务器,在浏览器里面通过 HTTP 协议访问,或者直接通过 FILE 协议访问。
Reference
- http://sphinx.pocoo.org
- http://www.cnblogs.com/qiyeshublog/articles/2379269.html
-
转载请注明来自柳大·Poechant(钟超)的CSDN博客:Blog.CSDN.net/Poechant
-
分享到:
相关推荐
Sphinx:Python项目文档生成工具1
《Python库sphinx_qt_documentation-0.3:构建优雅的Qt文档》 在Python的世界里,良好的文档是项目成功的关键因素之一。Sphinx是一个强大的文档生成工具,而`sphinx_qt_documentation`则是Sphinx的一个扩展,专门...
资源分类:Python库 所属语言:Python 资源全名:pocketsphinx-0.1.0.win32-py2.7.exe 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
在Python环境中,我们可以使用`pocketsphinx`,这是`cmusphinx`的一个轻量级版本,专门用于嵌入式设备和服务器。通过`pocketsphinx-python`这个Python绑定库,开发者可以轻松地将`cmusphinx-zh-cn-5.2`模型集成到...
Pocketsphinx Python Pocketsphinx是语音识别开源工具包的一部分。 该软件包为使用和创建的CMU 和库提供了python接口。支持平台视窗Linux Mac OS X安装# Make sure we have up-to-date versions of pip, setuptools ...
- **DocumentationPython**:表明该主题主要用于 Python 项目的文档撰写。 在 `flask-sphinx-themes-master` 压缩包中,通常会包含主题的源码、示例配置文件以及相关的说明文档。开发者可以通过研究这些内容来深入...
资源分类:Python库 所属语言:Python 资源全名:sphinx-automodapi-0.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
如果需要生成文档,还需要安装python-sphinx。 安装Proton库的步骤如下: 1. 创建一个build目录并进入。 2. 使用cmake配置安装路径,然后编译和安装。如果不需要文档,可以跳过生成文档的步骤。 3. 以root权限执行...
资源分类:Python库 所属语言:Python 资源全名:sphinx-docfx-yaml-1.2.10.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
Sphinx+Python+Oracle构建全文检索系统.pdf
Python 3.11.4是一种流行的编程语言Python的最新版本。Python是一种高级、通用、解释型的编程语言,具有简单易学...4. 文档工具和语言参考:Python 3.11.4官方文档提供了一些文档工具和语言参考,如Sphinx和reStructure
1. Sphinx:Sphinx是一个开源的全文搜索引擎,它允许开发者创建高性能、可配置的全文索引,并提供快速的搜索功能。Sphinx支持多种数据源,包括MySQL、PostgreSQL等,同时也支持实时索引和分布式搜索。在本项目中,...
14. **文档与注释**:Python强调代码的可读性,使用docstring编写文档,可以自动生成如Sphinx这样的高质量API文档。 15. **持续集成/持续部署(CI/CD)**:Python在CI/CD流程中也有应用,如使用Jenkins、GitLab CI/CD...
14. **文档编写**:Python项目通常包含文档,可能使用Sphinx或Markdown编写,并通过Read the Docs平台进行在线展示。 文件名`python-project-main`可能代表项目的主要入口文件或者主程序文件,它可能是整个项目的...
资源分类:Python库 所属语言:Python 使用前提:需要解压 资源全名:pocketsphinx-0.1.11-cp27-cp27m-win32.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
PythonStudy: Python系统化学习之路 在编程世界中,Python以其简洁、易读的语法和强大的功能成为初学者和专业人士的首选语言。"PythonStudy: Python系统化学习之路"是一套全面、系统的Python学习资源,旨在帮助用户...
资源分类:Python库 所属语言:Python 使用前提:需要解压 资源全名:domdf_sphinx_theme-22.1.1-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
10. **文档生成**:Python的Sphinx库可以用于生成专业的技术文档,包括需求规格书、设计文档等,方便团队成员和利益相关者查阅。 综上所述,Python在需求管理中扮演着重要角色,通过编写脚本和集成各种工具,可以...
资源分类:Python库 所属语言:Python 资源全名:sphinx_rtd_theme-0.2.2.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
15. **文档编写**:Python的docstring和sphinx工具可以帮助编写清晰的API文档,提高代码可读性。 通过谷粒教育的Python学习资料,你将有机会深入理解这些概念,并通过实践来提升你的编程技能。无论你是初学者还是有...