描述
- 基于Sphinx的python SDK文档生成器,直接生成html静态页面
环境安装
[ ~ ] pip install sphinx
[ ~ ] pip install sphinx_rtd_theme
[ ~ ] pip install sphinx-autobuild
[ ~ ] pip install recommonmark
步骤
- 准备一个工具包test,里面包含一个test/test.py
class A():
"""
测试
"""
def __init__(self):
pass
def test(self):
"""
测试函数
:return: 返回None
"""
[ ~ ] mkdir docs && cd docs
[ ~ ] sphinx-quickstart
> Separate source and build directories (y/n) [n]: y
> Name prefix for templates and static dir [_]:
> Project name: test1
> Author name(s): ljc
> Project release []: 0.1.0
> Project language [en]: zh_CN
[ ~ ]
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))
extensions = ['sphinx.ext.autodoc', 'recommonmark']
html_theme = 'sphinx_rtd_theme'
make clean
make sphinx-apidoc -f -o ./source ../../test/
make html
- 最后打开index.html
