-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
conf.py
110 lines (92 loc) 路 3.1 KB
/
conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from __future__ import annotations
import sys
from pathlib import Path
if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib # type: ignore[import-not-found]
project_path = Path(__file__).parent.parent.resolve()
# Fetch general information about the project from pyproject.toml.
toml_path = project_path / "pyproject.toml"
toml_config = tomllib.loads(toml_path.read_text())
# Redistribute pyproject.toml config to Sphinx.
project_id = toml_config["tool"]["poetry"]["name"]
version = release = toml_config["tool"]["poetry"]["version"]
url = toml_config["tool"]["poetry"]["homepage"]
author = ", ".join(
a.split("<")[0].strip() for a in toml_config["tool"]["poetry"]["authors"]
)
# Title-case each word of the project ID.
project = " ".join(word.title() for word in project_id.split("-"))
htmlhelp_basename = project_id
# Addons.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.todo",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
# Adds a copy button to code blocks.
"sphinx_copybutton",
"sphinx_design",
# Link to GitHub issues and PRs.
"sphinx_issues",
"sphinxext.opengraph",
"myst_parser",
"sphinx.ext.autosectionlabel",
"sphinx_autodoc_typehints",
"click_extra.sphinx",
"sphinxcontrib.mermaid",
]
# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
myst_enable_extensions = [
"attrs_block",
"attrs_inline",
"deflist",
"replacements",
"smartquotes",
"strikethrough",
"tasklist",
]
myst_fence_as_directive = ["mermaid"]
master_doc = "index"
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
nitpicky = True
# Concatenates the docstrings of the class and the __init__ method.
autoclass_content = "both"
# Keep the same ordering as in original source code.
autodoc_member_order = "bysource"
autodoc_default_flags = ["members", "undoc-members", "show-inheritance"]
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# GitHub pre-implemented shortcuts.
github_user = "kdeldycke"
issues_github_path = f"{github_user}/{project_id}"
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
}
# Prefix document path to section labels, to use:
# `path/to/file:heading` instead of just `heading`
autosectionlabel_prefix_document = True
# Theme config.
html_theme = "furo"
html_title = project
html_logo = "assets/logo-square.svg"
html_theme_options = {
"sidebar_hide_name": True,
# Activates edit links.
"source_repository": f"https://github.com/{issues_github_path}",
"source_branch": "main",
"source_directory": "docs/",
"announcement": (
f"{project} works fine, but its sole maintainer is distracted by life "
"馃樁鈥嶐煂笍.<br/>You can influence it with purchase of "
"<strong><a class='reference external' "
f"href='https://github.com/sponsors/{github_user}'>"
"business support 馃 and sponsorship 馃</a></strong>."
),
}
# Footer content.
html_last_updated_fmt = "%Y-%m-%d"
copyright = f"{author} and contributors"
html_show_copyright = True
html_show_sphinx = False