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"2018-{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
|
|
|
|
26
|
|
|
# -- General configuration --------------------------------------------------- |
27
|
|
|
|
28
|
|
|
# If your documentation needs a minimal Sphinx version, state it here. |
29
|
|
|
# |
30
|
|
|
needs_sphinx = "8.1" |
31
|
|
|
|
32
|
|
|
# Add any Sphinx extension module names here, as strings. They can be |
33
|
|
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
34
|
|
|
# ones. |
35
|
|
|
extensions = ["myst_parser", "sphinx_copybutton"] |
36
|
|
|
|
37
|
|
|
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " |
38
|
|
|
copybutton_prompt_is_regexp = True |
39
|
|
|
copybutton_line_continuation_character = "\\" |
40
|
|
|
|
41
|
|
|
# Add any paths that contain templates here, relative to this directory. |
42
|
|
|
templates_path = [] |
43
|
|
|
|
44
|
|
|
# The suffix(es) of source filenames. |
45
|
|
|
# You can specify multiple suffix as a list of string: |
46
|
|
|
# |
47
|
|
|
source_suffix = { |
48
|
|
|
".rst": "restructuredtext", |
49
|
|
|
".md": "markdown", |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
# The master document. |
54
|
|
|
master_doc = "index" |
55
|
|
|
|
56
|
|
|
# The language for content generated by Sphinx. Refer to documentation |
57
|
|
|
# for a list of supported languages. |
58
|
|
|
# |
59
|
|
|
# This is also used if you do content translation via gettext catalogs. |
60
|
|
|
# Usually you set "language" from the command line for these cases. |
61
|
|
|
language = "en" |
62
|
|
|
|
63
|
|
|
# List of patterns, relative to source directory, that match files and |
64
|
|
|
# directories to ignore when looking for source files. |
65
|
|
|
# This pattern also affects html_static_path and html_extra_path. |
66
|
|
|
exclude_patterns = ["images"] |
67
|
|
|
|
68
|
|
|
# The name of the syntax highlighting style to use. |
69
|
|
|
pygments_style = "sphinx" |
70
|
|
|
|
71
|
|
|
|
72
|
|
|
# -- Options for HTML output ------------------------------------------------- |
73
|
|
|
|
74
|
|
|
# The theme to use for HTML and HTML Help pages. See the documentation for |
75
|
|
|
# a list of builtin themes. |
76
|
|
|
# |
77
|
|
|
|
78
|
|
|
html_theme = "sphinx_rtd_theme" |
79
|
|
|
|
80
|
|
|
# Theme options are theme-specific and customize the look and feel of a theme |
81
|
|
|
# further. For a list of options available for each theme, see the |
82
|
|
|
# documentation. |
83
|
|
|
# |
84
|
|
|
# html_theme_options = {} |
85
|
|
|
|
86
|
|
|
# Add any paths that contain custom static files (such as style sheets) here, |
87
|
|
|
# relative to this directory. They are copied after the builtin static files, |
88
|
|
|
# so a file named "default.css" will overwrite the builtin "default.css". |
89
|
|
|
html_static_path = [] |
90
|
|
|
|
91
|
|
|
# Custom sidebar templates, must be a dictionary that maps document names |
92
|
|
|
# to template names. |
93
|
|
|
# |
94
|
|
|
# The default sidebars (for documents that don't match any pattern) are |
95
|
|
|
# defined by theme itself. |
96
|
|
|
# |
97
|
|
|
# html_sidebars = {} |
98
|
|
|
|