Skip to content

Commit

Permalink
extend api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
OriolAbril committed Feb 27, 2024
1 parent ba1c2c3 commit 73220df
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ instance/
# Sphinx documentation
docs/_build/
docs/build
docs/source/api/generated
docs/source/api/**/generated
docs/jupyter_execute
*.part.rst

# PyBuilder
.pybuilder/
Expand Down
4 changes: 2 additions & 2 deletions docs/source/api/backend/bokeh.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=============
Boheh backend
Bokeh backend
=============

.. automodule:: arviz_plots.backend.bokeh

.. include:: interface.template.rst
.. include:: bokeh.part.rst
7 changes: 4 additions & 3 deletions docs/source/api/backend/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ Available backends
------------------

.. toctree::
:maxdepth: 1

matplotlib
bokeh
Matplotlib <matplotlib>
Bokeh <bokeh>

Common interface definition
---------------------------

.. include:: interface.template.rst
.. include:: interface.part.rst
2 changes: 1 addition & 1 deletion docs/source/api/backend/matplotlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Matplotlib backend

.. automodule:: arviz_plots.backend.matplotlib

.. include:: interface.template.rst
.. include:: mpl.part.rst
14 changes: 14 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# pylint: disable=redefined-builtin,invalid-name
import os
from importlib.metadata import metadata
from pathlib import Path

# -- Project information

Expand Down Expand Up @@ -44,9 +45,22 @@
".DS_Store",
".ipynb_checkpoints",
"*.template.rst",
"*.part.rst",
]
suppress_warnings = ["mystnb.unknown_mime_type"]

backend_modules = {
"interface": "arviz_plots.backend",
"mpl": "arviz_plots.backend.matplotlib",
"bokeh": "arviz_plots.backend.bokeh",
}
api_backend_dir = Path(__file__).parent.resolve() / "api" / "backend"
with open(api_backend_dir / "interface.template.rst", "r", encoding="utf-8") as f:
interface_template = f.read()
for file, module in backend_modules.items():
with open(api_backend_dir / f"{file}.part.rst", "w", encoding="utf-8") as f:
f.write(f".. currentmodule:: {module}\n\n" + interface_template)

# The reST default role (used for this markup: `text`) to use for all documents.
default_role = "autolink"

Expand Down

0 comments on commit 73220df

Please sign in to comment.