-
Install Sphynx.
-
MOST IMPORTANT: Write code in Python by following the rule from 'sphynx-and-numpydoc'.
-
Type
sphinx-quickstart
in the terminal on the project root. Just createdocs
folder. It's more
Welcome to the Sphinx 1.4 quickstart utility.
Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).
Enter the root path for documentation.
> Root path for the documentation [.]: docs
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]:n
....
....
....
Please indicate if you want to use one of the following Sphinx extensions:
> autodoc: automatically insert docstrings from modules (y/n) [n]: y
> doctest: automatically test code snippets in doctest blocks (y/n) [n]: n
> intersphinx: link between Sphinx documentation of different projects (y/n) [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]: n
> imgmath: include math, rendered as PNG or SVG images (y/n) [n]: n
> mathjax: include math, rendered in the browser by MathJax (y/n) [n]: n
> ifconfig: conditional inclusion of content based on config values (y/n) [n]: n
> viewcode: include links to the source code of documented Python objects (y/n) [n]: y
> githubpages: create .nojekyll file to publish the document on GitHub pages (y/n) [n]: n
.......
-
Check whether
index.rst
file is created indocs/source
folder. -
Change
conf.py
indocs/source
folder to access upper module folder.
# 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.
sys.path.insert(0, os.path.abspath('..'))
-
Call the command like below to generate
*.rst
file for this module. See the reference.sphinx-apidoc -T -M -d 1 -o docs dooboo
-
Go to
docs
folder bycd docs
. -
Run
make html
to create the HTML document. -
Keep
docs/conf.py
,docs/Makefile
,docs/index.rst
under version control. Because it would be basic document configuration. So justsphinx-apidoc -T -M -d 1 -o docs dooboo
and runmake html
to generatedooboo
packages' document.