link:https://blog.csdn.net/sinat_29957455/article/details/83657029

1. 安装插件:

pip3 install sphinx
pip3 install sphinx_rtd_theme

2. 新建一个项目:

3. 使用sphinx建立API文档项目:

进入到doc目录下,输入sphinx-quickstart命令,会输出选项。

注意看图中需要输入的内容!
项目创建后目录结构如下:

build:用来存放通过make html生成文档网页文件的目录
source:存放用于生成文档的源文件
conf.py:Sphinx的配置文件
index.rst:主文档

4. 修改source/conf.py文件中的配置信息:

模板如下,使用模板注意修改源文件位置等内容

# -*- coding: utf-8 -*-# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html# -- Path setup --------------------------------------------------------------# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))# -- Project information -----------------------------------------------------import os
import sys
sys.path.insert(0, os.path.abspath('E:/zhibenzhu/xxx/client/python/dqlib'))
sys.path.insert(0, os.path.abspath('E:/zhibenzhu/xxx/client/python/'))project = 'test01汉语'
copyright = '2022, test1'
author = 'test1汉语'# The full version, including alpha/beta/rc tags
release = '1.0'# -- General configuration ---------------------------------------------------# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc','sphinx.ext.doctest','sphinx.ext.intersphinx','sphinx.ext.todo','sphinx.ext.coverage','sphinx.ext.napoleon','sphinx.ext.autodoc','sphinx.ext.mathjax']# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'zh_CN'# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []# -- Options for HTML output -------------------------------------------------# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


因为我们需要从Python代码的注释中自动导出API文档,所以需要将autodoc: automatically insert docstrings from modules (y/n) [n]: y如果忘记设置,可以在conf.py中的extensions中添加’sphinx.ext.autodoc’。选项后面没有输入的,直接按回车键使用默认设置。选项后面有输入的,按照我的设置即可,如果不使用中文文档,可以在language配置中使用默认设置。

其中,sphinx.ext.napoleon可以为sphinx添加额外的扩展,如果想要将html文档转换为PDF,只需要先安装扩展,然后再此处添加即可使用。由于我们的注释代码主要同时支持googlestyle和numpy style,所以我们需要添加一个扩展来支持。

html_theme = 'sphinx_rtd_theme'

5. 将命令行切换到doc目录下,将source和src修改为自己source和src所在路径,执行命令:

sphinx-apidoc -o source ../src/

6. 清理文件(doc目录下):

./make clean

7. 生成html文件(doc目录下):

tip:再次确认conf.py和index.rst两文件的编码格式是UTF-8,否则会乱码。

./make html

8. 打开build/html/index.html


home内容,版权所有内容和创作者内容可在conf.py中修改。
各级标题内容可在index.rst中修改。
修改后./make clean ,然后生成./make html。

9. 若不想显示某些module下的文件文档,可在source目录下删除对应.rst文件即可。

Sphinx使用说明相关推荐

  1. sphinx结合scws的mysql全文检索

    主要目的:打造千万级数据全文搜索的数据库,提升查询效率 系统环境 主机名 IP地址 相关服务 版本 SQL 172.169.18.128 mysql5.6(主) Sphinx 172.169.18.2 ...

  2. php+中文分词scws+sphinx+mysql打造千万级数据全文搜索

    Sphinx是由俄罗斯人Andrew Aksyonoff开发的一个全文检索引擎.意图为其他应用提供高速.低空间占用.高结果 相关度的全文搜索功能.Sphinx可以非常容易的与SQL数据库和脚本语言集成 ...

  3. abaqus高性能服务器怎么用,高性能计算平台ABAQUS任务调度使用说明作者陈林E-Mailchenlin.PDF...

    高性能计算平台ABAQUS任务调度使用说明作者陈林E-Mailchenlin.PDF 高性能计算平台ABAQUS 任务调度使用说明 作者:陈林 E-Mail:chenlin@ 日期:2017-1-10 ...

  4. linux 文件拷贝并替换,Linux_cmd replace 文件替换使用说明,帮助信息: 复制代码 代码如 - phpStudy...

    cmd replace 文件替换使用说明 帮助信息: 复制代码 代码如下: 替换文件. REPLACE [drive1:][path1]filename [drive2:][path2] [/A] [ ...

  5. 在Ubuntu 14.04 64bit上使用Sphinx转换MonaServer项目文档

    这几天看到网上出了个Cumulus的后继项目MonaServer, 官网是 http://www.monaserver.ovh/ 看介绍相当强悍, 包括支持RTMP, RTMFP, RTSP, HTT ...

  6. 使用PHP+Sphinx建立高效的站内搜索引擎

    1.    为什么要使用Sphinx   假设你现在运营着一个论坛,论坛数据已经超过100W,很多用户都反映论坛搜索的速度非常慢,那么这时你就可以考虑使用Sphinx了(当然其他的全文检索程序或方法也 ...

  7. linux安装sphinx

    从sphnix网站下载sphinx源码包,当前最新版本是: http://sphinxsearch.com/files/sphinx-0.9.9.tar.gz.当然,还需要保证你的系统已经安装了mys ...

  8. Simple Dynamic Strings(SDS)源码解析和使用说明二

    在<Simple Dynamic Strings(SDS)源码解析和使用说明一>文中,我们分析了SDS库中数据的基本结构和创建.释放等方法.本文将介绍其一些其他方法及实现.(转载请指明出于 ...

  9. MySQL · 引擎介绍 · Sphinx源码剖析(三)

    在本节中我会介绍Sphinx在构建索引之前做的一些事情,主要是从mysql拉取数据保存,然后分词排序保存到内存等等一系列的操作.下面是几个相关指令 sql_query = \SELECT id, gr ...

  10. Delphi开发的IOCP测试Demo以及使用说明。

    Delphi开发的IOCP,此为压力测试Demo和使用说明.

最新文章

  1. BZOJ3996 [TJOI2015]线性代数 【最小割】
  2. j2ee安全介绍--转
  3. Javascript 笔记(1)----函数
  4. webdriver 执行完毕关闭chromedriver进程
  5. 芯片:设计、制造、封测
  6. 查看linux是否为虚拟机,以及其它信息,cpu,主机型号,主板型号等
  7. vant-UI组件初使用:浅谈 - 解说篇
  8. html+cs入门实例,CS50 HTML和CSS基础(介绍最简单的HTML和CSS)
  9. Windows下FFmpeg各版本库文件下载
  10. 【联系】—— Beta 分布与二项分布、共轭分布
  11. Python-Matplotlib可视化(5)——添加自定义形状绘制复杂图形
  12. ZStack实践汇 | 制造业企业IT经理的虚拟化方案选型经历
  13. 苹果手机怎么投屏到电脑上?屏幕镜像即可投屏
  14. itext设置字体间距_Word文档怎样调节行间距?单行间距怎么调?
  15. Scrapy爬虫代理IP的使用
  16. C++智能指针之01
  17. 文明游戏5的计算机配置,文明5和文明6哪个好玩 文明5最低电脑配置要求
  18. mac笔记本怎么外接显示屏_苹果MAC笔记本怎么外接显示屏
  19. 广工操作系统课设--多用户多级目录的文件系统
  20. 使用 JavaScript 实现 SHA256 以及 HMAC-SHA256

热门文章

  1. CODEVS1296
  2. APS车间排产软件实现企业生产数据可视化
  3. ActiveMQ详细入门教程系列(一)
  4. dede列表分页php,织梦分页列表样式的修改dedepagelist
  5. Gartner 魔力四象限 -- 应用安全检测
  6. 投入产出表matlab,投入产出分析投入产出表.doc
  7. ERP 毛需求PAB初值净需求量计划产出量pab计划投入量 atp求法
  8. 导出excel合并单元格
  9. LG Sprite Software Root漏洞
  10. MDCC为移动开发者服务:一看、一聊、一聚