diff --git a/.gitignore b/.gitignore index 72d7fb3..ca656bf 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,11 @@ # PIP stuff *.egg-info # Visual studio code -.vscode \ No newline at end of file +.vscode + +# editor files +*~ + +# generated files +docs/build +docs/source/api/*.rst \ No newline at end of file diff --git a/docs/source/_templates/autosummary/module.rst b/docs/source/_templates/autosummary/module.rst new file mode 100644 index 0000000..0449164 --- /dev/null +++ b/docs/source/_templates/autosummary/module.rst @@ -0,0 +1,61 @@ +{{ fullname | escape | underline}} + +.. automodule:: {{ fullname }} + :members: + + {% block attributes %} + {% if attributes %} + .. rubric:: Module Attributes + + .. autosummary:: + {% for item in attributes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block functions %} + {% if functions %} + .. rubric:: {{ _('Functions') }} + + .. autosummary:: + {% for item in functions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block classes %} + {% if classes %} + .. rubric:: {{ _('Classes') }} + + .. autosummary:: + {% for item in classes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block exceptions %} + {% if exceptions %} + .. rubric:: {{ _('Exceptions') }} + + .. autosummary:: + {% for item in exceptions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + +{% block modules %} +{% if modules %} +.. rubric:: Modules + +.. autosummary:: + :toctree: + :recursive: +{% for item in modules %} + {{ item }} +{%- endfor %} +{% endif %} +{% endblock %} diff --git a/docs/source/conf.py b/docs/source/conf.py index 70c3e06..1ef14ee 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -38,6 +38,7 @@ release = '3.2.0' extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'sphinx.ext.napoleon', 'sphinx.ext.todo', + 'sphinx.ext.autosummary', ## 'sphinx_sitemap', 'sphinx_rtd_theme'] @@ -55,6 +56,11 @@ templates_path = ['_templates'] # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [] +# https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html +# We use a customized _templates/autosummary/module.rst to document members, too. +autosummary_generate = True +autosummary_imported_members = False +autosummary_generate_overwrite = True # -- Options for HTML output -------------------------------------------------