Sphinx

Posted on Thu 15 July 2021 in Python

Installation

Run this command to install Sphinx:

$ pip install Sphinx

Create the documentation layout using this command:

$ sphinx-quickstart docs

This will start an utility for preparing the docs directory:

~/git/repo/docs $ tree -L 1
.
├── _build
├── conf.py
├── index.rst
├── make.bat
├── Makefile
├── _static
└── _templates

3 directories, 4 files

Theme

Install the theme:

$ pip install sphinx-rtd-theme

Edit config.py to use the new theme:

html_theme = 'sphinx_rtd_theme'

Build the documentation:

~/git/repo/docs $ make html

Start a web server for the documentation:

~/git/repo/docs/_build/html $ python -m http.server

References