conf   A
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 32
dl 0
loc 87
rs 10
c 0
b 0
f 0
1
"""The configuration module for sphinx."""
2
3
import datetime
4
import os
5
import sys
6
from pathlib import Path
7
8
import tomllib
9
10
with Path("..", "pyproject.toml").resolve().open("rb") as f:
11
    data = tomllib.load(f)
12
    project = data["project"]["name"]
13
    author = ",".join(author["name"] for author in data["project"]["authors"])
14
version = os.popen("hatch version").readline().strip()  # noqa: S605, S607
15
year = datetime.datetime.now(tz=datetime.UTC).date().year
16
# noinspection PyShadowingBuiltins
17
copyright = f"2023-{year}, {author}"  # noqa: A001
18
19
python_path = str(Path("..").resolve())
20
sys.path.insert(0, python_path)
21
os.environ["PYTHONPATH"] = python_path
22
23
on_rtd = os.environ.get("READTHEDOCS") == "True"
24
25
# -- General configuration ---------------------------------------------------
26
27
# If your documentation needs a minimal Sphinx version, state it here.
28
#
29
needs_sphinx = "8.1"
30
31
# Add any Sphinx extension module names here, as strings. They can be
32
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33
# ones.
34
extensions = ["myst_parser", "sphinx_copybutton"]
35
36
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
37
copybutton_prompt_is_regexp = True
38
copybutton_line_continuation_character = "\\"
39
40
# Add any paths that contain templates here, relative to this directory.
41
templates_path = []
42
43
# The suffix(es) of source filenames.
44
# You can specify multiple suffix as a list of string:
45
#
46
source_suffix = {
47
    ".rst": "restructuredtext",
48
    ".md": "markdown",
49
}
50
51
# The master document.
52
master_doc = "index"
53
54
# The language for content auto-generated by Sphinx. Refer to documentation
55
# for a list of supported languages.
56
#
57
# This is also used if you do content translation via gettext catalogs.
58
# Usually you set "language" from the command line for these cases.
59
language = "en"
60
61
# List of patterns, relative to source directory, that match files and
62
# directories to ignore when looking for source files.
63
# This pattern also affects html_static_path and html_extra_path.
64
exclude_patterns = ["images"]
65
66
# The name of the syntax highlighting style to use.
67
pygments_style = "sphinx"
68
69
# -- Options for HTML output -------------------------------------------------
70
71
# The theme to use for HTML and HTML Help pages.  See the documentation for
72
# a list of builtin themes.
73
#
74
75
html_theme = "sphinx_rtd_theme"
76
77
# Theme options are theme-specific and customize the look and feel of a theme
78
# further.  For a list of options available for each theme, see the
79
# documentation.
80
#
81
# html_theme_options = {}
82
83
# Add any paths that contain custom static files (such as style sheets) here,
84
# relative to this directory. They are copied after the builtin static files,
85
# so a file named "default.css" will overwrite the builtin "default.css".
86
html_static_path = []
87
88
# Custom sidebar templates, must be a dictionary that maps document names
89
# to template names.
90
#
91
# The default sidebars (for documents that don't match any pattern) are
92
# defined by theme itself.
93
#
94
# html_sidebars = {}
95