Skip to content

Commit

Permalink
use custom templates for autosummary (#219)
Browse files Browse the repository at this point in the history
This lets us tell autosummary to do :members:

also remove docs/reference/stubs from version control, because sphinx
rebuilds it automatically
  • Loading branch information
deargle authored Mar 4, 2021
1 parent 571b577 commit ac0c50e
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 161 deletions.
3 changes: 2 additions & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ venv/
backup_docs
dist/
test/
generated
generated
reference/stubs
32 changes: 32 additions & 0 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:show-inheritance:
:inherited-members:

{% block methods %}
.. automethod:: __init__

{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

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

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
64 changes: 64 additions & 0 deletions docs/_templates/autosummary/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{ 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:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

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

.. autosummary::
:toctree:
{% 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:
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

html_static_path = ["../examples/output"]

templates_path = ['_templates']
exclude_patterns.append('_templates')

# extensions.append('sphinx_gallery.gen_gallery')

import pathlib
Expand All @@ -35,4 +38,4 @@
})

html_short_title = project
htmlhelp_basename = 'KeplerMapperdoc'
htmlhelp_basename = 'KeplerMapperdoc'
26 changes: 0 additions & 26 deletions docs/reference/stubs/kmapper.Cover.rst

This file was deleted.

23 changes: 0 additions & 23 deletions docs/reference/stubs/kmapper.GraphNerve.rst

This file was deleted.

27 changes: 0 additions & 27 deletions docs/reference/stubs/kmapper.KeplerMapper.rst

This file was deleted.

30 changes: 0 additions & 30 deletions docs/reference/stubs/kmapper.adapter.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/reference/stubs/kmapper.draw_matplotlib.rst

This file was deleted.

29 changes: 0 additions & 29 deletions docs/reference/stubs/kmapper.jupyter.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/reference/stubs/kmapper.plotlyviz.mpl_to_plotly.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/reference/stubs/kmapper.plotlyviz.plotlyviz.rst

This file was deleted.

This file was deleted.

0 comments on commit ac0c50e

Please sign in to comment.