forked from python/devguide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.py
174 lines (157 loc) · 6.73 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
import os
import sys
import time
# Location of custom extensions.
sys.path.insert(0, os.path.abspath(".") + "/_extensions")
extensions = [
'custom_roles',
'notfound.extension',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx_copybutton',
'sphinxext.opengraph',
'sphinxext.rediraffe',
]
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = "Python Developer's Guide"
copyright = f'2011-{time.strftime("%Y")}, Python Software Foundation'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = [
'_build',
'venv*',
'env*',
'README.rst',
'.github',
]
html_theme = 'furo'
html_theme_options = {
"source_repository": "https://github.com/python/devguide",
"source_branch": "main",
}
html_static_path = ['_static']
html_css_files = [
'devguide_overrides.css',
]
html_logo = "_static/python-logo.svg"
html_favicon = "_static/favicon.png"
# Set to '' to prevent appending "documentation" to the site title
html_title = ""
linkcheck_allowed_redirects = {
# Edit page
r"https://docs.google.com/document/d/.*/": r"https://docs.google.com/document/d/.*/edit", # noqa: E501
# Canonical
r"https://docs.python.org/": r"https://docs.python.org/3/",
# Translations with country codes
r"https://docs.python.org/[a-z-]+/": r"https://docs.python.org/[a-z-]+/3/",
# Personal /my/ links redirect to login page
r"https://discuss.python.org/my/.*": r"https://discuss.python.org/login-preferences", # noqa: E501
# Login page
r"https://github.com/python/core-workflow/issues/new.*": r"https://github.com/login.*", # noqa: E501
# Archive redirect
r"https://github.com/python/cpython/archive/main.zip": r"https://codeload.github.com/python/cpython/zip/refs/heads/main", # noqa: E501
# Blob to tree
r"https://github.com/python/cpython/blob/.*": r"https://github.com/python/cpython/tree/.*", # noqa: E501
# HackMD shortcuts
r"https://hackmd.io/s/.*": r"https://hackmd.io/@.*",
# Read the Docs
r"https://virtualenv.pypa.io/": r"https://virtualenv.pypa.io/en/latest/",
r"https://www.sphinx-doc.org/": r"https://www.sphinx-doc.org/en/master/",
# Cookie consent
r"https://www.youtube.com/playlist.*": r"https://consent.youtube.com/ml.*",
}
# ignore linkcheck anchors for /#/$ANCHOR since it is used for
# dynamic pages such as http://buildbot.python.org/all/#/console
# http://www.sphinx-doc.org/en/stable/config.html?highlight=linkcheck#confval-linkcheck_anchors_ignore
linkcheck_anchors_ignore = [
# match any anchor that starts with a '/' since this is an invalid HTML anchor
r'\/.*',
]
linkcheck_ignore = [
# The voters repo is private and appears as a 404
'https://github.com/python/voters',
# The python-core team link is private, redirects to login
'https://github.com/orgs/python/teams/python-core',
# The Discourse groups are private unless you are logged in
'https://discuss.python.org/groups/staff',
'https://discuss.python.org/groups/moderators',
'https://discuss.python.org/groups/admins',
# The crawler gets "Anchor not found" for GitHub anchors
r'https://github.com.+?#L\d+',
r'https://github.com/cli/cli#installation',
r'https://github.com/github/renaming#renaming-existing-branches',
# Discord doesn't allow robot crawlers: "403 Client Error: Forbidden"
r'https://support.discord.com/hc/en-us/articles/219070107-Server-Nicknames',
]
rediraffe_redirects = {
# Development Tools
"clang.rst": "development-tools/clang.rst",
"coverity.rst": "development-tools/coverity.rst",
"gdb.rst": "development-tools/gdb.rst",
# Advanced Tools was renamed Development Tools in gh-1149
"advanced-tools/clang.rst": "development-tools/clang.rst",
"advanced-tools/coverity.rst": "development-tools/coverity.rst",
"advanced-tools/gdb.rst": "development-tools/gdb.rst",
# Core Developers
"coredev.rst": "core-developers/become-core-developer.rst",
"committing.rst": "core-developers/committing.rst",
"developers.rst": "core-developers/developer-log.rst",
"experts.rst": "core-developers/experts.rst",
"motivations.rst": "core-developers/motivations.rst",
# Developer Workflow
"c-api.rst": "developer-workflow/c-api.rst",
"communication.rst": "developer-workflow/communication-channels.rst",
"devcycle.rst": "developer-workflow/development-cycle.rst",
"extensions.rst": "developer-workflow/extension-modules.rst",
"grammar.rst": "developer-workflow/grammar.rst",
"langchanges.rst": "developer-workflow/lang-changes.rst",
"porting.rst": "developer-workflow/porting.rst",
"stdlibchanges.rst": "developer-workflow/stdlib.rst",
# Documentation
"docquality.rst": "documentation/help-documenting.rst",
"documenting.rst": "documentation/start-documenting.rst",
# Getting Started
"fixingissues.rst": "getting-started/fixing-issues.rst",
"help.rst": "getting-started/getting-help.rst",
"gitbootcamp.rst": "getting-started/git-boot-camp.rst",
"pullrequest.rst": "getting-started/pull-request-lifecycle.rst",
"setup.rst": "getting-started/setup-building.rst",
# CPython Internals
"compiler.rst": "internals/compiler.rst",
"exploring.rst": "internals/exploring.rst",
"garbage_collector.rst": "internals/garbage-collector.rst",
"parser.rst": "internals/parser.rst",
# Testing and Buildbots
"buildbots.rst": "testing/buildbots.rst",
"coverage.rst": "testing/coverage.rst",
"buildworker.rst": "testing/new-buildbot-worker.rst",
"runtests.rst": "testing/run-write-tests.rst",
"silencewarnings.rst": "testing/silence-warnings.rst",
# Issues and Triaging
"gh-faq.rst": "triage/github-bpo-faq.rst",
"tracker.rst": "triage/issue-tracker.rst",
"gh-labels.rst": "triage/labels.rst",
"triaging.rst": "triage/triaging.rst",
}
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}
todo_include_todos = True
# sphinx-notfound-page
notfound_urls_prefix = "/"
# sphinxext-opengraph config
ogp_site_url = "https://devguide.python.org/"
ogp_site_name = "Python Developer's Guide"
ogp_image = "_static/og-image-200x200.png"
ogp_custom_meta_tags = [
'<meta property="og:image:width" content="200">',
'<meta property="og:image:height" content="200">',
'<meta name="theme-color" content="#3776ab">',
]
# Strip the dollar prompt when copying code
# https://sphinx-copybutton.readthedocs.io/en/latest/use.html#strip-and-configure-input-prompts-for-code-cells
copybutton_prompt_text = "$ "
# https://sphinx-copybutton.readthedocs.io/en/latest/use.html#honor-line-continuation-characters-when-copying-multline-snippets
copybutton_line_continuation_character = "\\"