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
|
|
|
# -- 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
|
|
|
|
52
|
|
|
# The master document. |
53
|
|
|
master_doc = "index" |
54
|
|
|
|
55
|
|
|
# The language for content generated by Sphinx. Refer to documentation |
56
|
|
|
# for a list of supported languages. |
57
|
|
|
# |
58
|
|
|
# This is also used if you do content translation via gettext catalogs. |
59
|
|
|
# Usually you set "language" from the command line for these cases. |
60
|
|
|
language = "en" |
61
|
|
|
|
62
|
|
|
# List of patterns, relative to source directory, that match files and |
63
|
|
|
# directories to ignore when looking for source files. |
64
|
|
|
# This pattern also affects html_static_path and html_extra_path. |
65
|
|
|
exclude_patterns = ["images"] |
66
|
|
|
|
67
|
|
|
# The name of the syntax highlighting style to use. |
68
|
|
|
pygments_style = "sphinx" |
69
|
|
|
|
70
|
|
|
|
71
|
|
|
# -- Options for HTML output ------------------------------------------------- |
72
|
|
|
|
73
|
|
|
# The theme to use for HTML and HTML Help pages. See the documentation for |
74
|
|
|
# a list of builtin themes. |
75
|
|
|
# |
76
|
|
|
|
77
|
|
|
html_theme = "sphinx_rtd_theme" |
78
|
|
|
|
79
|
|
|
# Theme options are theme-specific and customize the look and feel of a theme |
80
|
|
|
# further. For a list of options available for each theme, see the |
81
|
|
|
# documentation. |
82
|
|
|
# |
83
|
|
|
# html_theme_options = {} |
84
|
|
|
|
85
|
|
|
# Add any paths that contain custom static files (such as style sheets) here, |
86
|
|
|
# relative to this directory. They are copied after the builtin static files, |
87
|
|
|
# so a file named "default.css" will overwrite the builtin "default.css". |
88
|
|
|
html_static_path = [] |
89
|
|
|
|
90
|
|
|
# Custom sidebar templates, must be a dictionary that maps document names |
91
|
|
|
# to template names. |
92
|
|
|
# |
93
|
|
|
# The default sidebars (for documents that don't match any pattern) are |
94
|
|
|
# defined by theme itself. |
95
|
|
|
# |
96
|
|
|
# html_sidebars = {} |
97
|
|
|
|