Skip to content

Commit

Permalink
Merge pull request #260 from pyiron/apidocs
Browse files Browse the repository at this point in the history
Add autodoc
  • Loading branch information
jan-janssen authored May 4, 2024
2 parents 6040239 + 9888fb1 commit 15146ec
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 @@ -9,4 +9,5 @@ chapters:
- file: bulk_modulus_with_gpaw.ipynb
- file: thermal_expansion_with_lammps.ipynb
- file: free_energy_calculation.ipynb
- file: phasediagram.md
- file: phasediagram.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:`atomistics` package.

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

atomistics

0 comments on commit 15146ec

Please sign in to comment.