Skip to content

Sphinx AutoSummary to automate API documentation #5082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ tags

# Sphinx
_build
docs/jupyter_execute
docs/source/api

# Merge tool
*.orig
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

3 changes: 1 addition & 2 deletions conda-envs/environment-dev-py37.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ dependencies:
- pytest>=3.0
- python-graphviz
- python=3.7
- recommonmark>=0.4
- scipy>1.4.1
- sphinx-autobuild>=0.7
- sphinx-copybutton
- sphinx-notfound-page
- sphinx-panels
- sphinx>=1.5
Expand Down
3 changes: 1 addition & 2 deletions conda-envs/environment-dev-py38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ dependencies:
- pytest>=3.0
- python-graphviz
- python=3.8
- recommonmark>=0.4
- scipy>1.4.1
- sphinx-autobuild>=0.7
- sphinx-copybutton
- sphinx-notfound-page
- sphinx-panels
- sphinx>=1.5
Expand Down
3 changes: 1 addition & 2 deletions conda-envs/environment-dev-py39.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ dependencies:
- pytest>=3.0
- python-graphviz
- python=3.9
- recommonmark>=0.4
- scipy>1.4.1
- sphinx-autobuild>=0.7
- sphinx-copybutton
- sphinx-notfound-page
- sphinx-panels
- sphinx>=1.5
Expand Down
2 changes: 1 addition & 1 deletion conda-envs/windows-environment-dev-py38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ dependencies:
- pydata-sphinx-theme
- pytest-cov>=2.5
- pytest>=3.0
- recommonmark>=0.4
- sphinx-autobuild>=0.7
- sphinx-copybutton
- sphinx-notfound-page
- sphinx-panels
- sphinx>=1.5
Expand Down
Binary file added docs/logos/sponsors/numfocus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file removed docs/pymc_logo.jpg
Binary file not shown.
5 changes: 5 additions & 0 deletions docs/source/_templates/custom-class-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
5 changes: 5 additions & 0 deletions docs/source/_templates/custom-function-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autofunction:: {{ objname }}
69 changes: 69 additions & 0 deletions docs/source/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{{ fullname | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Module Attributes') }}

.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:toctree:
:template: custom-function-template.rst
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
:template: custom-class-template.rst
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
:template: custom-module-template.rst
:recursive:
{% for item in modules %}
{% if "tests" not in item %}
{{ item }}
{% endif %}
{%- endfor %}
{% endif %}
{% endblock %}
9 changes: 9 additions & 0 deletions docs/source/_templates/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<footer class="footer mt-5 mt-md-0">
<div class="container">
{% for footer_item in theme_footer_items %}
<div class="footer-item">
{% include footer_item %}
</div>
{% endfor %}
</div>
</footer>
26 changes: 13 additions & 13 deletions docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

<!-- Hide left sidebar in home page -->
{% block docs_sidebar %}
{% if pagename != 'index' %}
{{ super() }}
{% endif %}
{% if pagename != 'index' %}
{{ super() }}
{% endif %}
{% endblock %}

<!-- Hide right sidebar in home page -->
{% block docs_toc %}
{% if pagename != 'index' %}
{{ super() }}
{% endif %}
{% if pagename != 'index' %}
{{ super() }}
{% endif %}
{% endblock %}

<!-- Make body have full width in home page -->
{% block docs_main %}
{% if pagename == 'index' %}
<main class="col-12 py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
{% block body %} {% endblock %}
</main>
{% else %}
{{ super() }}
{% endif %}
{% if pagename == 'index' %}
<main class="col-12 py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
{% block body %} {% endblock %}
</main>
{% else %}
{{ super() }}
{% endif %}
{% endblock %}
5 changes: 0 additions & 5 deletions docs/source/about.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
:orphan:

..
_href from docs/source/index.rst

.. _about:

**********
Expand Down
36 changes: 5 additions & 31 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -1,36 +1,10 @@
:orphan:

..
_"api" is referenced in html_theme_options docs/source/conf.py

.. _api:

*************
API Reference
*************

.. toctree::
:maxdepth: 2

api/distributions
api/bounds
api/inference
api/glm
api/gp
api/plots
api/stats
api/backends
api/math
api/data
api/model
api/model_graph
api/variables
api/shape_utils
api/ode

Indices and tables
===================
.. autosummary::
:toctree: api
:template: custom-module-template.rst
:recursive:

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
pymc
24 changes: 0 additions & 24 deletions docs/source/api/backends.rst

This file was deleted.

57 changes: 0 additions & 57 deletions docs/source/api/bounds.rst

This file was deleted.

8 changes: 0 additions & 8 deletions docs/source/api/data.rst

This file was deleted.

14 changes: 0 additions & 14 deletions docs/source/api/distributions.rst

This file was deleted.

42 changes: 0 additions & 42 deletions docs/source/api/distributions/continuous.rst

This file was deleted.

Loading