< ^ >

Softwave docu using Sphinx

Creating the new docs of ngstrefftz I used Sphinx. You can find the docs of ngstrefftz here: docs

To build docs using Sphinx you first need to

pip install sphinx

and get your project a docs folder

mkdir docs

Sphinx offers a sphinx-quickstart which will auto-generate some files and folders for you, but essentially you need a conf.py and an index.rst. Once you have those, you can build your html docu using

sphinx-build -b html . _build

The config file

The conf.py should at least contain the following:

# -- Project information -----------------------------------------------------
project = 'Projectname'
copyright = 'Year, Name'
author = 'Name'
release = v0.0.0

# -- General configuration ---------------------------------------------------
extensions = []

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

language = 'hi'

# -- Options for HTML output -------------------------------------------------
html_theme = 'alabaster'
html_static_path = ['_static']

More on the config is given here and different sphinx themes can be found here

I wanted to use my jupyter notebooks and some python code with sphinx. Sphinx can include jupyter notebook as seperate html pages, some python code can be included in the documentation inline and is run when the docu is generated. I use the following extensions to do that

extensions = ["sphinx.ext.autodoc",

some of which need to be installed using pip. m2r2 loves to create some mess with the dependencies, so take care and be sure to save your requirements once everything is running. Here are mine.

There are a bunch of additional settings for sphinx and also for each package, for the notebooks I use

## Run notebook configuration
# The template used when exporting from nbconvert
#   full  - Outputs the full HTML document [Default]
#   basic - Outputs a single div (with no additional resources)
run_notebook_export_template = 'basic'  # Default: 'full'

# Display the source links to the generated evaluated files
run_notebook_display_source_links = False  # Default: True

# Whether or not to evaluate the notebooks prior to embedding them
evaluate_notebooks = True  # Default: True

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

## Set and exclude paths
templates_path = ['_templates']
html_static_path = ['_static']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'paper','env']

One can further customize the looks of the html output

html_theme = 'alabaster'
html_theme_options = {
html_sidebars = {
   'index': [
        # 'relations.html',
   '**': ['about.html',

The index file

You can write the index file in markdown of reStructuredText. I was not familiar with rst, but why not learn something new while learning something new.. surely this type of recursion has no confusing side effects.

This is a header

This is a smaller header

Commands and special environments are started with .. command:: and need to be indented. For example, you can use LaTeX math

.. math::

    \begin{align*} \begin{split}
        -\Lap u = 0 &\text{ in } \Omega, \\
        u=g &\text{ on } \partial \Omega,
    \end{split} \end{align*}

of python, where it is possible to hide in- or output

.. jupyter-execute::

    from ngstrefftz import *

Documentation for a function or class is generated like so

.. autofunction:: ngstrefftz.TWave

.. autoclass:: ngstrefftz.TrefftzTents

   .. automethod:: Propagate
   .. automethod:: SetInitial
   .. automethod:: SetBoundaryCF