Skip to content

Commit

Permalink
add autosummary documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
codingfabi committed May 5, 2024
1 parent bb5d955 commit 23bb8e7
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 10 deletions.
19 changes: 19 additions & 0 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{ fullname | escape | underline}}

{{ module }}

{{ objname }}

{% block attributes %} {% if attributes %} .. rubric:: Attributes

{% for item in attributes %}
~{{ fullname }}.{{ item }}

{%- endfor %} {% endif %} {% endblock %}

{% block methods %} {% if methods %} .. rubric:: Methods

{% for item in methods %}
{%- if item != '__init__' %} ~{{ fullname }}.{{ item }} {%- endif -%}

{%- endfor %} {% endif %} {% endblock %}
3 changes: 3 additions & 0 deletions docs/_templates/autosummary/function.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{ fullname | escape | underline}}

{{ module }}
8 changes: 8 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
API Docs
========

.. autosummary::
:toctree: generated
:recursive:

co2calculator
9 changes: 0 additions & 9 deletions docs/commuting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,3 @@ motorbike.
Tram, bicycle or pedelec commute
--------------------------------
For tram, bicylce or pedelec, no specifica have to be provided.


Aggregating emissions to the group level
----------------------------------------
If it can be assumed that a representative sample (``n_participants``) of the entire group (``n_members``) have entered
their commuting data, an estimate of the commuting emissions for the entire group can be obtained using the following
function:

.. autofunction:: co2calculator.calculate.commuting_emissions_group
4 changes: 4 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@
"sphinx.ext.napoleon",
"sphinx.ext.autosectionlabel",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"myst_parser",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# generate autosummary
autosummary_generate = True

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Contents
calculate/heating_electricity
calculate/emission_factors
calculate/transport_modes

api

Indices and tables
==================
Expand Down

0 comments on commit 23bb8e7

Please sign in to comment.