Skip to content

Commit

Permalink
Merge pull request #292 from pyiron/apidocs
Browse files Browse the repository at this point in the history
Add autodoc
  • Loading branch information
jan-janssen committed May 4, 2024
2 parents 26ee3e4 + d39ca59 commit 52c7636
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 2 deletions.
13 changes: 12 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,15 @@ repository:

launch_buttons:
notebook_interface : jupyterlab
binderhub_url : https://mybinder.org
binderhub_url : https://mybinder.org

sphinx:
extra_extensions:
- 'sphinx.ext.autodoc'
- 'sphinx.ext.napoleon'
- 'sphinx.ext.viewcode'
- 'sphinx.ext.autodoc'
- 'sphinx.ext.autosummary'
config:
autosummary_generate: True
templates_path: ['_templates']
32 changes: 32 additions & 0 deletions docs/_templates/custom-class-template.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 %}
66 changes: 66 additions & 0 deletions docs/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{ 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:
: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 %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
3 changes: 2 additions & 1 deletion docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ chapters:
- file: example.ipynb
- file: command.md
- file: advanced.md
- file: debug.md
- file: debug.md
- file: api.rst
11 changes: 11 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Interface
=========

Documentation of the classes and functions defined in the :code:`pysqa` package.

.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

pysqa

0 comments on commit 52c7636

Please sign in to comment.