Debian Codegraph @

docs/conf.py

raw ◀ ▶
2 Debian patches touch this file
1 # Copyright 2009-2026 Joshua Bronson. All rights reserved.
2 #
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7 # bidict documentation build configuration file, created by
8 # sphinx-quickstart on Fri Aug 29 11:38:22 2014.
9 #
10 # This file is execfile()d with the current directory set to its
11 # containing dir.
12 #
13 # Note that not all possible configuration values are present in this
14 # autogenerated file.
15 #
16 # All configuration values have a default; values that are commented out
17 # serve to show the default.
18
19 """Sphinx configuration."""
20
21 import importlib.util
22 from importlib.metadata import metadata
23
24
25 # -- General configuration ------------------------------------------------
26
27 # suppress_warnings = [
28 # ]
29
30 # If your documentation needs a minimal Sphinx version, state it here.
31 # needs_sphinx = '1.0'
32
33 # Add any Sphinx extension module names here, as strings. They can be
34 # extensions coming with Sphinx (named 'sphinx.ext.*') or custom ones.
35 extensions = [
36 'sphinx.ext.autodoc',
37 'sphinx.ext.autosectionlabel',
38 'sphinx.ext.coverage',
39 'sphinx.ext.doctest',
40 'sphinx.ext.extlinks',
41 'sphinx.ext.viewcode',
42 ]
43 if importlib.util.find_spec('sphinx_copybutton'):
44 extensions.append('sphinx_copybutton')
45
46
47 # Add any paths that contain templates here, relative to this directory.
48 # templates_path = ['_templates']
49
50 # The suffix of source filenames.
51 source_suffix = '.rst'
52
53 # The encoding of source files.
54 # source_encoding = 'utf-8-sig'
55
56 # The master toctree document.
57 master_doc = 'index'
58
59 bidict_metadata = metadata('bidict') # bidict must be on PYTHONPATH (e.g. installed)
60 project = bidict_metadata['Name']
61 # Extract author name from "Name <email>" format
62 author_email = bidict_metadata['Author-email']
63 author = author_email.split('<')[0].strip() if author_email else 'Joshua Bronson'
64 copyright = f'2009-2026 {author}' # ruff: ignore[builtin-variable-shadowing] # Sphinx requires this name
65
66 # The version info for the project you're documenting, acts as replacement for
67 # |version| and |release|, also used in various other places throughout the
68 # built documents.
69 # The full version, including alpha/beta/rc tags.
70 release = bidict_metadata['Version']
71 # The short X.Y version.
•72 version = ".".join(release.split(".")[:2])
73
74 # The language for content autogenerated by Sphinx. Refer to documentation
75 # for a list of supported languages.
76 # language = None
77
78 # There are two options for replacing |today|: either, you set today to some
79 # non-false value, then it is used:
80 # today = ''
81 # Else, today_fmt is used as the format for a strftime call.
82 # today_fmt = '%B %d, %Y'
83
84 # List of patterns, relative to source directory, that match files and
85 # directories to ignore when looking for source files.
•86 exclude_patterns = ["_build"]
87
88 # The reST default role (used for this markup: `text`) to use for all
89 # documents.
90 # default_role = None
91
92 # If true, '()' will be appended to :func: etc. cross-reference text.
93 # add_function_parentheses = True
94
95 # If true, the current module name will be prepended to all description
96 # unit titles (such as .. function::).
97 # add_module_names = True
98
99 # If true, sectionauthor and moduleauthor directives will be shown in the
100 # output. They are ignored by default.
101 # show_authors = False
102
103 # The name of the Pygments (syntax highlighting) style to use.
104 # pygments_style = 'colorful'
105
106 # A list of ignored prefixes for module index sorting.
•107 modindex_common_prefix = ["bidict."]
108
109 # If true, keep warnings as "system message" paragraphs in the built documents.
110 # keep_warnings = False
111
112
113 # -- Options for HTML output ----------------------------------------------
114
115 # The theme to use for HTML and HTML Help pages. See the documentation for
116 # a list of builtin themes.
•117 html_theme = "furo"
118
119 # Theme options are theme-specific and customize the look and feel of a theme
120 # further. For a list of options available for each theme, see the
121 # documentation.
122 # https://pradyunsg.me/furo/customisation/#theme-options
123 # html_theme_options = dict(
124 # )
125
126 # Add any paths that contain custom themes here, relative to this directory.
127 # html_theme_path = []
128
129 # The name for this set of Sphinx documents. If None, it defaults to
130 # "<project> v<release> documentation".
•131 html_title = "bidict"
132
133 # A shorter title for the navigation bar. Default is the same as html_title.
134 # html_short_title = 'bidict'
135
136 # The name of an image file (relative to this directory) to place at the top
137 # of the sidebar.
138 # html_logo = '_static/logo-256.png'
139
140 # The name of an image file (within the static path) to use as favicon of the
141 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
142 # pixels large.
•143 html_favicon = "_static/favicon.ico"
144
145 # Add any paths that contain custom static files (such as style sheets) here,
146 # relative to this directory. They are copied after the builtin static files,
147 # so a file named "default.css" will overwrite the builtin "default.css".
•148 html_static_path = ["_static"]
149
150 # Add any extra paths that contain custom files (such as robots.txt or
151 # .htaccess) here, relative to this directory. These files are copied
152 # directly to the root of the documentation.
153 # html_extra_path = []
154
155 # https://docs.readthedocs.io/en/stable/guides/adding-custom-css.html#adding-custom-css-or-javascript-to-sphinx-documentation
156 # html_css_files = ['custom.css']
157
158 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
159 # using the given strftime format.
•160 html_last_updated_fmt = "%b %d, %Y"
161
162 # If true, SmartyPants will be used to convert quotes and dashes to
163 # typographically correct entities.
164 # html_use_smartypants = True
165
166 # Custom sidebar templates, maps document names to template names.
167 # https://pradyunsg.me/furo/customisation/sidebar/#using-html-sidebars
168 html_sidebars = {
•169 "**": [
170 "sidebar/brand.html",
171 "sidebar/search.html",
172 "sidebar/scroll-start.html",
173 "sidebar/navigation.html",
174 "sidebar/scroll-end.html",
175 ],
176 }
177
178 # Additional templates that should be rendered to pages, maps page names to
179 # template names.
180 # html_additional_pages = {}
181
182 # If false, no module index is generated.
183 # html_domain_indices = True
184
185 # If false, no index is generated.
186 # html_use_index = True
187
188 # If true, the index is split into individual pages for each letter.
189 html_split_index = True
190
191 # If true, links to the reST sources are added to the pages.
192 html_show_sourcelink = False
193
194 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
195 html_show_sphinx = False
196
197 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
198 html_show_copyright = True
199
200 # If true, an OpenSearch description file will be output, and all pages will
201 # contain a <link> tag referring to it. The value of this option must be the
202 # base URL from which the finished HTML is served.
203 # html_use_opensearch = ''
204
205 # This is the file name suffix for HTML files (e.g. ".xhtml").
206 # html_file_suffix = None
207
208 # Output file base name for HTML help builder.
209 htmlhelp_basename = 'bidictdoc'
210
211
212 # https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
213 extlinks = {
214 'issue': ('https://github.com/jab/bidict/issues/%s', '#%s'),
215 }
216
217
218 # Ignore urls matching these regex strings when doing "make linkcheck"
219 linkcheck_ignore = [
220 r'https://codecov\.io/.*', # gives 405 for HEAD requests
221 r'https://pypistats\.org/.*', # unreliable
222 # alternative links for readers on GitHub (which don't work on readthedocs.io):
223 r'docs/learning-from-bidict\.rst',
224 r'CHANGELOG\.rst',
225 r'docs/intro\.rst',
226 r'CONTRIBUTING\.rst',
227 r'CODE_OF_CONDUCT\.rst',
228 ]
229 linkcheck_timeout = 10 # 5s default too low
230
231 nitpicky = True
232
233 nitpick_ignore_regex = [
234 # work around https://github.com/sphinx-doc/sphinx/issues/10974
235 ('py:(class|obj)', r'(bidict\._typing\.)?(KT|VT|DT|Maplike|MapOrItems|MissingT)'),
236 ('py:class', r'(bidict\._base\.)?BT'),
237 ('py:class', r't\.(Any|ClassVar|MutableMapping)'),
238 ]
239
240 # http://www.sphinx-doc.org/en/stable/ext/autosectionlabel.html#configuration
241 autosectionlabel_prefix_document = True
242
243 # https://www.sphinx-doc.org/en/3.x/usage/extensions/autodoc.html#confval-autodoc_typehints
244 autodoc_typehints = 'description'
245
246 # pytest-sphinx does not support doctest_global_setup. We use conftest.py instead.
247 # Ref: https://github.com/thisch/pytest-sphinx/issues/5#issuecomment-618072237
248 # doctest_global_setup = """"""
249
250 # https://sphinx-copybutton.readthedocs.io/en/latest/#strip-and-configure-input-prompts-for-code-cells
251 copybutton_prompt_text = '>>> '