This repository gives a minimal example of the building and publishing documentation for a Python module using Sphinx, GitHub actions and github-pages.
Key points are:
- automatic and recursive building of the documentation from documented Python modules using sphinx autosummary
- working sphinx-gallery -- see for exemple matplotlib's gallery.
- automatic building and publishing using GitHub actions when committing changes to repo.
- clone the repository
- install requirements
pip install -r requirements.txt - build the documentation locally
cddocs && make htmland check the files in_build/html(openindex.html` in a browser) - push the repo on a github repo. Check that the github actions worked fine.
- enable github pages, with source
gh-pages/(root) - you should be able to see the documentation at
https://user.github.io/repo/
- be sure to have some docstrings written inside your python module (see here.)
- create a
docsfolder, and run insidesphinx-quickstart - tune your
conf.pyas you may wish. Note that it must include everything linked tosphinx-galleryif you wish to include one - run
make.htmland pray.
Important things:
- Look at
api.rstandindex.rstfile structures, it is important. - If you wish to document imports inside
__init__.pyfiles, setautosummary_imported_members = Truein yourconf.py.
-
Sphinx documentation:
-
building and publishing using github actions: