Debian Codegraph @

docs/conf.py

raw
1 #!/usr/bin/env python3
2 #
3 # frozenlist documentation build configuration file, created by
4 # sphinx-quickstart on Wed Mar 5 12:35:35 2014.
5 #
6 # This file is execfile()d with the current directory set to its
7 # containing dir.
8 #
9 # Note that not all possible configuration values are present in this
10 # autogenerated file.
11 #
12 # All configuration values have a default; values that are commented out
13 # serve to show the default.
14
15 import os
16 import re
17 from contextlib import suppress
18 from pathlib import Path
19
20 PROJECT_ROOT_DIR = Path(__file__).parents[1].resolve()
21 IS_RELEASE_ON_RTD = (
22 os.getenv("READTHEDOCS", "False") == "True"
23 and os.environ["READTHEDOCS_VERSION_TYPE"] == "tag"
24 )
25 if IS_RELEASE_ON_RTD:
26 tags.add("is_release")
27
28
29 _docs_path = Path(__file__).parent
30 _version_path = _docs_path / ".." / "frozenlist" / "__init__.py"
31
32
33 with _version_path.open(encoding="utf-8") as fp:
34 try:
35 _version_info = re.search(
36 r'^__version__ = "'
37 r"(?P<major>\d+)"
38 r"\.(?P<minor>\d+)"
39 r"\.(?P<patch>\d+)"
40 r'(?P<tag>.*)?"$',
41 fp.read(),
42 re.M,
43 ).groupdict()
44 except IndexError:
45 raise RuntimeError("Unable to determine version.")
46
47
48 # -- General configuration ------------------------------------------------
49
50 # If your documentation needs a minimal Sphinx version, state it here.
51 # needs_sphinx = '1.0'
52
53 # Add any Sphinx extension module names here, as strings. They can be
54 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
55 # ones.
56 extensions = [
57 # stdlib-party extensions:
58 "sphinx.ext.extlinks",
59 "sphinx.ext.viewcode",
60 "sphinx.ext.intersphinx",
61 # Third-party extensions:
62 "sphinxcontrib.towncrier.ext", # provides `towncrier-draft-entries` directive
63 ]
64
65
66 with suppress(ImportError):
67 # spelling extension is optional, only add it when installed
68 import sphinxcontrib.spelling # noqa # type: ignore
69
70 extensions.append("sphinxcontrib.spelling")
71
72
73 intersphinx_mapping = {
74 "python": ("https://docs.python.org/3", None),
75 "aiohttp": ("https://docs.aiohttp.org/en/stable/", None),
76 }
77
78 # Add any paths that contain templates here, relative to this directory.
79 templates_path = ["_templates"]
80
81 # The suffix of source filenames.
82 source_suffix = ".rst"
83
84 # The encoding of source files.
85 # source_encoding = 'utf-8-sig'
86
87 # The master toctree document.
88 master_doc = "index"
89
90 # General information about the project.
91
92 github_url = "https://github.com"
93 github_repo_org = "aio-libs"
94 github_repo_name = "frozenlist"
95 github_repo_slug = f"{github_repo_org}/{github_repo_name}"
96 github_repo_url = f"{github_url}/{github_repo_slug}"
97 github_sponsors_url = f"{github_url}/sponsors"
98
99 project = github_repo_name
100 copyright = "2013, frozenlist contributors"
101
102 # The version info for the project you're documenting, acts as replacement for
103 # |version| and |release|, also used in various other places throughout the
104 # built documents.
105 #
106 # The short X.Y version.
107 version = "{major}.{minor}".format(**_version_info)
108 # The full version, including alpha/beta/rc tags.
109 release = "{major}.{minor}.{patch}{tag}".format(**_version_info)
110
111 rst_epilog = f"""
112 .. |project| replace:: {project}
113 """ # pylint: disable=invalid-name
114
115 # The language for content autogenerated by Sphinx. Refer to documentation
116 # for a list of supported languages.
117 # language = None
118
119 # There are two options for replacing |today|: either, you set today to some
120 # non-false value, then it is used:
121 # today = ''
122 # Else, today_fmt is used as the format for a strftime call.
123 # today_fmt = '%B %d, %Y'
124
125 # List of patterns, relative to source directory, that match files and
126 # directories to ignore when looking for source files.
127 exclude_patterns = ["_build"]
128
129 # The reST default role (used for this markup: `text`) to use for all
130 # documents.
131 # default_role = None
132
133 # If true, '()' will be appended to :func: etc. cross-reference text.
134 # add_function_parentheses = True
135
136 # If true, the current module name will be prepended to all description
137 # unit titles (such as .. function::).
138 # add_module_names = True
139
140 # If true, sectionauthor and moduleauthor directives will be shown in the
141 # output. They are ignored by default.
142 # show_authors = False
143
144 # The name of the Pygments (syntax highlighting) style to use.
145 # pygments_style = 'sphinx'
146
147 # The default language to highlight source code in.
148 highlight_language = "python3"
149
150 # A list of ignored prefixes for module index sorting.
151 # modindex_common_prefix = []
152
153 # If true, keep warnings as "system message" paragraphs in the built documents.
154 # keep_warnings = False
155
156
157 # -- Extension configuration -------------------------------------------------
158
159 # -- Options for extlinks extension ---------------------------------------
160 extlinks = {
161 "issue": (f"{github_repo_url}/issues/%s", "#%s"),
162 "pr": (f"{github_repo_url}/pull/%s", "PR #%s"),
163 "commit": (f"{github_repo_url}/commit/%s", "%s"),
164 "gh": (f"{github_url}/%s", "GitHub: %s"),
165 "user": (f"{github_sponsors_url}/%s", "@%s"),
166 }
167
168
169 # -- Options for HTML output ----------------------------------------------
170
171 # The theme to use for HTML and HTML Help pages. See the documentation for
172 # a list of builtin themes.
173 html_theme = "aiohttp_theme"
174
175 # Theme options are theme-specific and customize the look and feel of a theme
176 # further. For a list of options available for each theme, see the
177 # documentation.
178 html_theme_options = {
179 "logo": None,
180 "description": (
181 "A list-like structure which implements collections.abc.MutableSequence"
182 ),
183 "canonical_url": "https://frozenlist.aio-libs.org/en/stable/",
184 "github_user": github_repo_org,
185 "github_repo": github_repo_name,
186 "github_button": True,
187 "github_type": "star",
188 "github_banner": True,
189 "badges": [
190 {
191 "image": f"{github_repo_url}/workflows/CI/badge.svg",
192 "target": f"{github_repo_url}/actions",
193 "height": "20",
194 "alt": "Github CI status for master branch",
195 },
196 {
197 "image": (
198 f"https://codecov.io/github/{github_repo_slug}/coverage.svg"
199 "?branch=master&flag=pytest"
200 ),
201 "target": f"https://codecov.io/github/{github_repo_slug}?flags[]=pytest",
202 "height": "20",
203 "alt": "Code coverage status",
204 },
205 {
206 "image": f"https://badge.fury.io/py/{github_repo_name}.svg",
207 "target": f"https://badge.fury.io/py/{github_repo_name}",
208 "height": "20",
209 "alt": "Latest PyPI package version",
210 },
211 {
212 "image": "https://img.shields.io/matrix/aio-libs-space:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs-space%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat",
213 "target": "https://matrix.to/#/%23aio-libs-space:matrix.org",
214 "height": "20",
215 "alt": "Matrix Space",
216 },
217 ],
218 }
219
220 # Add any paths that contain custom themes here, relative to this directory.
221 # html_theme_path = [alabaster.get_path()]
222
223 # The name for this set of Sphinx documents. If None, it defaults to
224 # "<project> v<release> documentation".
225 # html_title = None
226
227 # A shorter title for the navigation bar. Default is the same as html_title.
228 # html_short_title = None
229
230 # The name of an image file (relative to this directory) to place at the top
231 # of the sidebar.
232 # html_logo = 'frozenlist-icon.svg'
233
234 # The name of an image file (within the static path) to use as favicon of the
235 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
236 # pixels large.
237 # html_favicon = 'favicon.ico'
238
239 # Add any paths that contain custom static files (such as style sheets) here,
240 # relative to this directory. They are copied after the builtin static files,
241 # so a file named "default.css" will overwrite the builtin "default.css".
242 # html_static_path = []
243
244 # Add any extra paths that contain custom files (such as robots.txt or
245 # .htaccess) here, relative to this directory. These files are copied
246 # directly to the root of the documentation.
247 # html_extra_path = []
248
249 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
250 # using the given strftime format.
251 # html_last_updated_fmt = '%b %d, %Y'
252
253 # If true, SmartyPants will be used to convert quotes and dashes to
254 # typographically correct entities.
255 # html_use_smartypants = True
256
257 # Custom sidebar templates, maps document names to template names.
258 html_sidebars = {
259 "**": [
260 "about.html",
261 "navigation.html",
262 "searchbox.html",
263 ]
264 }
265
266 # Additional templates that should be rendered to pages, maps page names to
267 # template names.
268 # html_additional_pages = {}
269
270 # If false, no module index is generated.
271 # html_domain_indices = True
272
273 # If false, no index is generated.
274 # html_use_index = True
275
276 # If true, the index is split into individual pages for each letter.
277 # html_split_index = False
278
279 # If true, links to the reST sources are added to the pages.
280 # html_show_sourcelink = True
281
282 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
283 # html_show_sphinx = True
284
285 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
286 # html_show_copyright = True
287
288 # If true, an OpenSearch description file will be output, and all pages will
289 # contain a <link> tag referring to it. The value of this option must be the
290 # base URL from which the finished HTML is served.
291 # html_use_opensearch = ''
292
293 # This is the file name suffix for HTML files (e.g. ".xhtml").
294 # html_file_suffix = None
295
296 # Output file base name for HTML help builder.
297 htmlhelp_basename = f"{github_repo_name}doc"
298
299
300 # -- Options for LaTeX output ---------------------------------------------
301
302 latex_elements = {
303 # The paper size ('letterpaper' or 'a4paper').
304 # 'papersize': 'letterpaper',
305 # The font size ('10pt', '11pt' or '12pt').
306 # 'pointsize': '10pt',
307 # Additional stuff for the LaTeX preamble.
308 # 'preamble': '',
309 }
310
311 # Grouping the document tree into LaTeX files. List of tuples
312 # (source start file, target name, title,
313 # author, documentclass [howto, manual, or own class]).
314 latex_documents = [
315 (
316 "index",
317 f"{github_repo_name}.tex",
318 f"{github_repo_name} Documentation",
319 f"{github_repo_name} contributors",
320 "manual",
321 ),
322 ]
323
324 # The name of an image file (relative to this directory) to place at the top of
325 # the title page.
326 # latex_logo = None
327
328 # For "manual" documents, if this is true, then toplevel headings are parts,
329 # not chapters.
330 # latex_use_parts = False
331
332 # If true, show page references after internal links.
333 # latex_show_pagerefs = False
334
335 # If true, show URL addresses after external links.
336 # latex_show_urls = False
337
338 # Documents to append as an appendix to all manuals.
339 # latex_appendices = []
340
341 # If false, no module index is generated.
342 # latex_domain_indices = True
343
344
345 # -- Options for manual page output ---------------------------------------
346
347 # One entry per manual page. List of tuples
348 # (source start file, name, description, authors, manual section).
349 man_pages = [
350 (
351 "index",
352 github_repo_name,
353 f"{github_repo_name} Documentation",
354 [github_repo_name],
355 1,
356 )
357 ]
358
359 # If true, show URL addresses after external links.
360 # man_show_urls = False
361
362
363 # -- Options for Texinfo output -------------------------------------------
364
365 # Grouping the document tree into Texinfo files. List of tuples
366 # (source start file, target name, title, author,
367 # dir menu entry, description, category)
368 texinfo_documents = [
369 (
370 "index",
371 github_repo_name,
372 f"{github_repo_name} Documentation",
373 f"{github_repo_name} contributors",
374 github_repo_name,
375 "One line description of project.",
376 "Miscellaneous",
377 ),
378 ]
379
380 # Documents to append as an appendix to all manuals.
381 # texinfo_appendices = []
382
383 # If false, no module index is generated.
384 # texinfo_domain_indices = True
385
386 # How to display URL addresses: 'footnote', 'no', or 'inline'.
387 # texinfo_show_urls = 'footnote'
388
389 # If true, do not generate a @detailmenu in the "Top" node's menu.
390 # texinfo_no_detailmenu = False
391
392 # -- Strictness options --------------------------------------------------
393 nitpicky = True
394 nitpick_ignore = []
395
396 # -- Options for towncrier_draft extension -----------------------------------
397
398 towncrier_draft_autoversion_mode = "draft" # or: 'sphinx-version', 'sphinx-release'
399 towncrier_draft_include_empty = True
400 towncrier_draft_working_directory = PROJECT_ROOT_DIR