Debian Codegraph @

doc/conf.py

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 # Configuration file for the Sphinx documentation builder.
2 #
3 # For the full list of built-in configuration values, see the documentation:
4 # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
6 import os.path
7 import sys
8
9 from docutils.nodes import Element
10 from sphinx.writers.html5 import HTML5Translator
11
12 sys.path.insert(0, os.path.abspath('.'))
13
14 # -- Project information -----------------------------------------------------
15 # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
16
17 project = 'typing_extensions'
18 copyright = '2023, Guido van Rossum and others'
19 author = 'Guido van Rossum and others'
20 release = '4.6.0'
21
22 # -- General configuration ---------------------------------------------------
23 # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
24
25 extensions = ['sphinx.ext.intersphinx', '_extensions.gh_link']
26
27 templates_path = ['_templates']
28 exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
29
30 # Use Python 3.15 for new features and Python 3.14 as a fallback for APIs that
31 # were removed in Python 3.15.
32 intersphinx_mapping = {
33 'py': ('https://docs.python.org/3.15', None),
34 'py314': ('https://docs.python.org/3.14', None),
35 }
36
37 add_module_names = False
38
39 # -- Options for HTML output -------------------------------------------------
40 # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
41
42 html_theme = 'alabaster'
43
44 html_theme_options = {
45 "description": "Backported and experimental type hints for Python",
46 # Make the sidebar "sticky" so that is stays visible when scrolling.
47 # Also makes the sidebar appear at the top of the page on mobile.
48 "fixed_sidebar": True,
49 }
50
51 html_sidebars = {
52 '**': [
53 'about.html',
54 'searchfield.html',
55 'localtoc.html',
56 ]
57 }
58
59 # Don't include object entries (e.g. functions, classes) in the table of contents.
60 toc_object_entries = False
61
62 # Warn about all references where the target cannot be found.
63 nitpicky = True
64
65
66 class MyTranslator(HTML5Translator):
67 """Adds a link target to name without `typing_extensions.` prefix."""
68 def visit_desc_signature(self, node: Element) -> None:
69 desc_name = node.get("fullname")
70 if desc_name:
71 self.body.append(f'<span id="{desc_name}"></span>')
72 super().visit_desc_signature(node)
73
74
75 def setup(app):
76 app.set_translator('html', MyTranslator)