"""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
from typing import Optional

import shrinkix as info

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

project = info.__name__
copyright = f"{info.__author__} <{info.__email__}>"
author = info.__author__
version = info.__version__
release = info.__version__

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

extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.viewcode",
    "sphinx.ext.napoleon",
    "sphinx_rtd_theme",
    "sphinxcontrib.mermaid",
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "**tests**"]
todo_include_todos = False
if os.path.exists("resources/favicon.png"):  # noqa: PTH110
    html_favicon: Optional[str] = "resources/favicon.png"
elif os.path.exists("resources/favicon.jpg"):  # noqa: PTH110
    html_favicon = "resources/favicon.jpg"
else:
    html_favicon = None
# If no docstring, inherit from base class
autodoc_inherit_docstrings = True
# Remove 'view source code' from top of page (for html, not python)
html_show_sourcelink = False
# Enable 'expensive' imports for sphinx_autodoc_typehints
set_type_checking_flag = True

# Napoleon settings
napoleon_google_docstring = True
napoleon_numpy_docstring = False
napoleon_include_init_with_doc = True
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = True
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = True
napoleon_use_admonition_for_references = True
autodoc_typehints = "description"

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

html_theme = "sphinx_rtd_theme"
html_static_path = ["resources"]
