# 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

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import os
import sys

sys.path.insert(0, os.path.abspath(".."))

import wejax

project = "WeJAX"
version = wejax.__version__
release = wejax.__version__
author = wejax.__author__
copyright = wejax.__copyright__

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
    "sphinx.ext.viewcode",
    "sphinx.ext.autodoc",
    "sphinx.ext.mathjax",
    "sphinx.ext.napoleon",
    "sphinx.ext.intersphinx",
    "sphinx_autodoc_typehints",
    "sphinxcontrib.bibtex",
    "sphinx_copybutton",
    "myst_nb",
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

intersphinc_mapping = {
    "python": ("https://docs.python.org/3", None),
    "jax": ("https://jax.readthedocs.io/en/latest", None),
}


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "furo"

html_static_path = ["_static"]

html_theme_options = {
    "announcement": "WeJAX is under development!",
    "source_repository": "https://gitlab.com/lisamission/wejax",
    "source_branch": "main",
    "source_directory": "docs",
    "light_logo": "img/wejax-light.svg",
    "dark_logo": "img/wejax-dark.svg",
    "footer_icons": [
        {
            "name": "Gitlub",
            "url": "https://gitlab.com/lisamission/wejax",
            "html": """
                <svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor"
                fill="currentColor" stroke-width="0" viewBox="0 0 512 512">
                    <path d="M503.5 204.6L502.8 202.8L433.1 21C431.7 17.5 429.2
                    14.4 425.9 12.4C423.5 10.8 420.8 9.9 417.9 9.6C415 9.3 412.2
                    9.7 409.5 10.7C406.8 11.7 404.4 13.3 402.4 15.5C400.5 17.6
                    399.1 20.1 398.3 22.9L351.3 166.9H160.8L113.7 22.9C112.9
                    20.1 111.5 17.6 109.6 15.5C107.6 13.4 105.2 11.7 102.5
                    10.7C99.9 9.7 97 9.3 94.1 9.6C91.3 9.9 88.5 10.8 86.1
                    12.4C82.8 14.4 80.3 17.5 78.9 21L9.3 202.8L8.5 204.6C-1.5
                    230.8-2.7 259.6 5 286.6C12.8 313.5 29.1 337.3 51.5
                    354.2L51.7 354.4L52.3 354.8L158.3 434.3L210.9 474L242.9
                    498.2C246.6 500.1 251.2 502.5 255.9 502.5C260.6 502.5 265.2
                    500.1 268.9 498.2L300.9 474L353.5 434.3L460.2 354.4L460.5
                    354.1C482.9 337.2 499.2 313.5 506.1 286.6C514.7 259.6 513.5
                    230.8 503.5 204.6z"/>
                </svg>
            """,
            "class": "",
        },
    ],
}


# -- Options for extensions --------------------------------------------------

typehints_defaults = "comma"
always_use_bars_union = True

autodoc_type_aliases = {
    "Iterable": "Iterable",
    "ArrayLike": "ArrayLike",
}

autosectionlabel_prefix_document = True

mathjax3_config = {
    "loader": {"load": ["[tex]/physics"]},
    "tex": {
        "packages": {"[+]": ["physics"]},
    },
}

bibtex_bibfiles = ["bibliography.bib"]
bibtex_default_style = "unsrt"

nb_execution_mode = "off"
