-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconf.py
208 lines (174 loc) · 6.46 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#!/usr/bin/env python3
import datetime
import os
import pathlib
import sys
from importlib import metadata
from unittest import mock
sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath("../canaille"))
from canaille.app.configuration import export_config
from canaille.app.configuration import settings_factory
# Readthedocs does not support C modules, so
# we have to mock them.
class Mock(mock.MagicMock):
@classmethod
def __getattr__(cls, name):
return mock.MagicMock()
MOCK_MODULES = ["ldap"]
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
# -- General configuration ------------------------------------------------
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.doctest",
"sphinx.ext.graphviz",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx_click",
"sphinx_design",
"sphinx_issues",
"sphinxcontrib.autodoc_pydantic",
"jinja_autodoc",
"sphinxcontrib.screenshot",
]
source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}
master_doc = "index"
project = "canaille"
year = datetime.datetime.now().strftime("%Y")
copyright = f"{year}, Yaal Coop"
author = "Yaal Coop"
version = metadata.version("canaille")
language = "en"
exclude_patterns = []
pygments_style = "sphinx"
todo_include_todos = True
toctree_collapse = False
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"authlib": ("https://docs.authlib.org/en/latest", None),
"flask": ("https://flask.palletsprojects.com", None),
"flask-alembic": ("https://flask-alembic.readthedocs.io/en/latest", None),
"flask-babel": ("https://python-babel.github.io/flask-babel", None),
"flask-caching": ("https://flask-caching.readthedocs.io/en/latest/", None),
"flask-wtf": ("https://flask-wtf.readthedocs.io", None),
"hypercorn": ("https://hypercorn.readthedocs.io/en/latest", None),
"jinja": ("https://jinja.palletsprojects.com", None),
"pydantic": ("https://docs.pydantic.dev/latest", None),
"pytest-iam": ("https://pytest-iam.readthedocs.io/en/latest/", None),
"wtforms": ("https://wtforms.readthedocs.io", None),
"scim2-cli": ("https://scim2-cli.readthedocs.io/en/latest", None),
}
issues_uri = "https://gitlab.com/yaal/canaille/-/issues/{issue}"
issues_pr_uri = "https://gitlab.com/yaal/canaille/-/merge_requests/{pr}"
issues_commit_uri = "https://gitlab.com/yaal/canaille/-/commit/{commit}"
# -- Options for HTML output ----------------------------------------------
html_theme = "shibuya"
html_static_path = ["_static"]
html_baseurl = "https://canaille.readthedocs.io/"
html_theme_options = {
"globaltoc_expand_depth": 3,
"accent_color": "yellow",
"light_logo": "_static/canaille-label-black.webp",
"dark_logo": "_static/canaille-label-white.webp",
"gitlab_url": "https://gitlab.com/yaal/canaille",
"mastodon_url": "https://toot.aquilenet.fr/@yaal",
"discussion_url": "https://matrix.to/#/#canaille-discuss:yaal.coop",
"nav_links": [
{
"title": "Demo",
"children": [
{
"title": "Canaille demo server",
"url": "https://demo.canaille.yaal.coop",
},
{
"title": "OIDC Client 1",
"url": "https://demo.client1.yaal.coop",
},
{
"title": "OIDC Client 2",
"url": "https://demo.client2.yaal.coop",
},
],
},
{"title": "PyPI", "url": "https://pypi.org/project/Canaille"},
{
"title": "Weblate",
"url": "https://hosted.weblate.org/projects/canaille/canaille",
},
],
}
html_context = {
"source_type": "gitlab",
"source_user": "yaal",
"source_repo": "canaille",
"source_version": "main",
"source_docs_path": "/doc/",
"languages": [
("English", "/en/latest/%s.html"),
("Français", "/fr/latest/%s.html"),
],
}
# -- Options for HTMLHelp output ------------------------------------------
htmlhelp_basename = "canailledoc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {}
latex_documents = [
(master_doc, "canaille.tex", "canaille Documentation", "Yaal", "manual")
]
# -- Options for manual page output ---------------------------------------
man_pages = [(master_doc, "canaille", "canaille Documentation", [author], 1)]
# -- Options for Texinfo output -------------------------------------------
texinfo_documents = [
(
master_doc,
"canaille",
"canaille Documentation",
author,
"canaille",
"One line description of project.",
"Miscellaneous",
)
]
# -- Options for autosectionlabel -----------------------------------------
autosectionlabel_prefix_document = True
autosectionlabel_maxdepth = 2
# -- Options for autodoc_pydantic_settings -------------------------------------------
autodoc_pydantic_settings_show_json = False
autodoc_pydantic_settings_show_config_summary = False
autodoc_pydantic_settings_show_config_summary = False
autodoc_pydantic_settings_show_validator_summary = False
autodoc_pydantic_settings_show_validator_members = False
autodoc_pydantic_settings_show_field_summary = False
autodoc_pydantic_settings_signature_prefix = ""
autodoc_pydantic_field_signature_prefix = ""
autodoc_pydantic_field_list_validators = False
autodoc_pydantic_field_doc_policy = "docstring"
# -- Translation options ------------------------------------------------------
# Advised by https://docs.readthedocs.io/en/latest/guides/manage-translations-sphinx.html#create-translatable-files
gettext_uuid = True
gettext_compact = "doc"
# -- Templates options ------------------------------------------------------
jinja_template_path = str(
pathlib.Path(__file__).parent.parent.resolve() / "canaille/templates"
)
# -- Screenshots options ------------------------------------------------------
screenshot_apps = {
"canaille": "doc.doc_app:create_doc_app",
}
screenshot_contexts = {
"admin": "doc.doc_app:admin_login",
"user": "doc.doc_app:user_login",
"james": "doc.doc_app:james_login",
}
screenshot_default_browser = "firefox"
screenshot_default_viewport_width = 770
screenshot_default_viewport_height = 1
screenshot_default_full_page = True
config_obj = settings_factory(all_options=True, init_with_examples=True)
export_config(config_obj, "config.sample.toml")