123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- """
- Configuration file for the Sphinx documentation builder.
- For the full list of built-in configuration values, see the documentation:
- https://www.sphinx-doc.org/en/master/usage/configuration.html
- """
- import os
- from functools import wraps
- from pathlib import Path
- from sphinxcontrib_autodocgen import AutoDocGen
- os.environ["UNFCCC_GHG_ROOT_PATH"] = str(Path("..") / "..")
- import unfccc_ghg_data
- project = "Country greenhouse gas data submitted to the UNFCCC"
- authors = ", ".join(["Johannes Gütschow"])
- copyright_year = "2023"
- copyright = f"{copyright_year}, {authors}"
- extensions = [
-
-
- "sphinx.ext.autodoc",
-
- "sphinx.ext.autosummary",
-
- "sphinxcontrib_autodocgen",
-
-
- "sphinx.ext.napoleon",
-
-
-
-
-
-
- "sphinx_autodoc_typehints",
-
- "myst_nb",
-
- "sphinx.ext.intersphinx",
-
- "sphinx.ext.viewcode",
-
- "sphinx_copybutton",
-
- "sphinx.ext.mathjax",
-
- "sphinx_exec_code",
-
- "sphinx_markdown_tables",
- ]
- add_module_names = False
- templates_path = ["_templates"]
- exclude_patterns = ["conf.py"]
- source_encoding = "utf-8"
- autodoc_default_options = {
-
- "show-inheritance": True,
- }
- autosummary_generate = True
- autosummary_generate_overwrite = False
- autodocgen_config = [
- {
- "modules": [unfccc_ghg_data],
- "generated_source_dir": "docs/source/api",
-
- "module_title_decider": lambda modulename: "API Reference"
- if modulename == "unfccc_ghg_data"
- else modulename,
- }
- ]
- generate_module_rst_orig = AutoDocGen.generate_module_rst
- @wraps(generate_module_rst_orig)
- def _generate_module_rst_new(*args, **kwargs):
- default = generate_module_rst_orig(*args, **kwargs)
- out = default.lstrip("\n")
- if not out.endswith("\n"):
- out = f"{out}\n"
- return out
- AutoDocGen.generate_module_rst = _generate_module_rst_new
- napoleon_numpy_docstring = True
- napoleon_google_docstring = False
- napoleon_use_rtype = False
- typehints_fully_qualified = True
- typehints_document_rtype = True
- typehints_use_rtype = False
- mathjax3_config = {"chtml": {"displayAlign": "center"}}
- myst_enable_extensions = ["amsmath", "dollarmath"]
- nb_execution_mode = "cache"
- nb_execution_raise_on_error = True
- nb_execution_show_tb = True
- nb_execution_timeout = 120
- nb_custom_formats = {".py": ["jupytext.reads", {"fmt": "py:percent"}]}
- exec_code_working_dir = "."
- exec_code_source_folders = [Path("..") / ".." / "src" / "unfccc_ghg_data"]
- exec_code_example_dir = "."
- html_theme = "sphinx_book_theme"
- html_static_path = ["_static"]
- html_theme_options = {
- "repository_url": "https://github.com/JGuetschow/UNFCCC_non-AnnexI_data",
- "repository_branch": "main",
- "path_to_docs": "docs/source",
- "use_repository_button": True,
- "use_issues_button": True,
- "use_edit_page_button": True,
- }
- def setup(app):
- """
- Set up the Sphinx app
- """
- app.registry.source_suffix.pop(".ipynb", None)
- intersphinx_mapping = {
- "numpy": ("https://docs.scipy.org/doc/numpy", None),
- "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
- "python": ("https://docs.python.org/3", None),
- "pyam": ("https://pyam-iamc.readthedocs.io/en/latest", None),
- "scmdata": ("https://scmdata.readthedocs.io/en/latest", None),
- "xarray": ("http://xarray.pydata.org/en/stable", None),
- "pint": (
- "https://pint.readthedocs.io/en/latest",
- None,
- ),
- }
|