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