Skip to content

Documentation

Mostafa Jahanifar edited this page Feb 17, 2021 · 1 revision

We use "Read the docs" for documentation building and hosting. Documentation is generated using Sphinx. The latest documentation is available at https://tia-toolbox.readthedocs.io/en/latest/.

Sphinx

Sphinx is the tool used to generate the documentation for Read the Docs. Sphinx takes restructed text files (similar to markdown) and converts them to themed web based documentation.

Sphinx QuickStart

https://www.sphinx-doc.org/en/stable/usage/quickstart.html

 

reStructured Text Primer

https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html

 

Auto-Doc

We use the autodoc extension for Sphinx. This allow for the conversion of docstrings into documentation entries automatically.

 

Warning

This section is copied from the autodoc page linked above. It is important to note that the files get imported when generating documentation.

autodoc imports the modules to be documented. If any modules have side effects on import, these will be executed by autodoc when sphinx-build is run.

If you document scripts (as opposed to library modules), make sure their main routine is protected by a if __name__ == '__main__' condition.

 

Napoleon (Google Format Docstrings)

We use the napoleon extension for Sphinx. This allows for the use of Google form docstrings. The extension automatically converts these to restructured text that Sphinx can parse.

Using Markdown Instead of Restructured Text

It is possible to use markdown instead of restructured text. Currently this is not enabled.

For more see:

There are some notable disadvantages to using markdown however. One is that you cannot include another file in markdown as you can so with restructured (rst) files. However, an rst file can include a markdown file.

This kind of functional command which can be included in rst files is called a directive. See the Sphinx QuickStart and the reStructured Text Primer for more on this.

PDF (LaTeX) Output

Sphinx can also output documentation as a LaTeX rendered PDF document, provided that LaTeX is installed.

See the sphinx-build page for more:

https://www.sphinx-doc.org/en/master/man/sphinx-build.html

References/Citations

Please use MLA (First on Google Scholar) for citation style