diff --git a/.gitignore b/.gitignore index a70c434..abe9f58 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/docs/source/api/backend/bokeh.rst b/docs/source/api/backend/bokeh.rst index 6d6cecc..c277c8e 100644 --- a/docs/source/api/backend/bokeh.rst +++ b/docs/source/api/backend/bokeh.rst @@ -1,7 +1,7 @@ ============= -Boheh backend +Bokeh backend ============= .. automodule:: arviz_plots.backend.bokeh -.. include:: interface.template.rst +.. include:: bokeh.part.rst diff --git a/docs/source/api/backend/index.rst b/docs/source/api/backend/index.rst index e1ef4c4..92d1bc5 100644 --- a/docs/source/api/backend/index.rst +++ b/docs/source/api/backend/index.rst @@ -9,11 +9,12 @@ Available backends ------------------ .. toctree:: + :maxdepth: 1 - matplotlib - bokeh + Matplotlib + Bokeh Common interface definition --------------------------- -.. include:: interface.template.rst +.. include:: interface.part.rst diff --git a/docs/source/api/backend/matplotlib.rst b/docs/source/api/backend/matplotlib.rst index e6f37a5..72d8b49 100644 --- a/docs/source/api/backend/matplotlib.rst +++ b/docs/source/api/backend/matplotlib.rst @@ -4,4 +4,4 @@ Matplotlib backend .. automodule:: arviz_plots.backend.matplotlib -.. include:: interface.template.rst +.. include:: mpl.part.rst diff --git a/docs/source/conf.py b/docs/source/conf.py index 8f44647..63af649 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,6 +1,7 @@ # pylint: disable=redefined-builtin,invalid-name import os from importlib.metadata import metadata +from pathlib import Path # -- Project information @@ -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"