blob: afe66270c10e8cf6b11d180aa46429d646a8c4b6 [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001#
2# Python documentation build configuration file
3#
Christian Heimes679db4a2008-01-18 09:56:22 +00004# This file is execfile()d with the current directory set to its containing dir.
5#
Georg Brandl116aa622007-08-15 14:28:22 +00006# The contents of this file are pickled, so don't put values in the namespace
7# that aren't pickleable (module imports are okay, they're removed automatically).
Christian Heimes2c181612007-12-17 20:04:13 +00008
Georg Brandl86def6c2008-01-21 20:36:10 +00009import sys, os, time
Georg Brandle0390292014-10-29 08:07:37 +010010sys.path.append(os.path.abspath('tools/extensions'))
Marco Buttu909a6f62017-03-18 17:59:33 +010011sys.path.append(os.path.abspath('includes'))
Georg Brandl86def6c2008-01-21 20:36:10 +000012
Christian Heimes2c181612007-12-17 20:04:13 +000013# General configuration
14# ---------------------
Georg Brandl116aa622007-08-15 14:28:22 +000015
Georg Brandl5c01d992013-10-12 19:54:30 +020016extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest',
animalize6261ae92018-10-08 16:20:54 -050017 'pyspecific', 'c_annotations', 'escape4chm']
Christian Heimes26855632008-01-27 23:50:43 +000018
Stéphane Wirtel859c0682018-10-12 09:51:05 +020019
20doctest_global_setup = '''
21try:
22 import _tkinter
23except ImportError:
24 _tkinter = None
25'''
Christian Heimes679db4a2008-01-18 09:56:22 +000026# General substitutions.
27project = 'Python'
Berker Peksag2ec1bee2016-04-24 03:21:13 +030028copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
Christian Heimes679db4a2008-01-18 09:56:22 +000029
Georg Brandl86def6c2008-01-21 20:36:10 +000030# We look for the Include/patchlevel.h file in the current Python source tree
31# and replace the values accordingly.
32import patchlevel
33version, release = patchlevel.get_version_info()
Georg Brandl116aa622007-08-15 14:28:22 +000034
35# There are two options for replacing |today|: either, you set today to some
36# non-false value, then it is used:
37today = ''
38# Else, today_fmt is used as the format for a strftime call.
39today_fmt = '%B %d, %Y'
40
Georg Brandl64063702008-09-09 19:10:58 +000041# By default, highlight as Python 3.
42highlight_language = 'python3'
43
Anthony Sottilea16ab002019-02-15 18:41:15 -050044# Minimum version of sphinx required
45needs_sphinx = '1.8'
Larry Hastings3732ed22014-03-15 21:13:56 -070046
Senthil Kumaran889f9142016-06-04 22:22:26 -070047# Ignore any .rst files in the venv/ directory.
Ned Deily61292502017-10-12 16:04:57 -040048venvdir = os.getenv('VENVDIR', 'venv')
49exclude_patterns = [venvdir+'/*', 'README.rst']
Brett Cannon9b166662015-03-30 15:35:37 -040050
Adrian Liawc03bf0a2018-11-05 05:04:51 +080051# Disable Docutils smartquotes for several translations
52smartquotes_excludes = {
53 'languages': ['ja', 'fr', 'zh_TW', 'zh_CN'], 'builders': ['man', 'text'],
54}
55
Jean-François Bfc8284e2018-12-22 23:31:08 +010056# Avoid a warning with Sphinx >= 2.0
57master_doc = 'contents'
Christian Heimes2c181612007-12-17 20:04:13 +000058
59# Options for HTML output
60# -----------------------
61
Georg Brandl9a333a62014-10-29 08:04:27 +010062# Use our custom theme.
Jon Wayne Parrottbf63e8d2018-03-01 13:02:50 -080063html_theme = 'python_docs_theme'
Ned Deily14366f32014-09-30 18:41:37 -070064html_theme_path = ['tools']
Jon Wayne Parrottbf63e8d2018-03-01 13:02:50 -080065html_theme_options = {
66 'collapsiblesidebar': True,
67 'issues_url': 'https://docs.python.org/3/bugs.html',
68 'root_include_title': False # We use the version switcher instead.
69}
Georg Brandla0745232010-07-30 11:31:03 +000070
Georg Brandl9a333a62014-10-29 08:04:27 +010071# Short title used e.g. for <title> HTML tags.
Georg Brandlab712142012-03-25 20:31:57 +020072html_short_title = '%s Documentation' % release
73
Christian Heimes2c181612007-12-17 20:04:13 +000074# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
75# using the given strftime format.
76html_last_updated_fmt = '%b %d, %Y'
77
Georg Brandl9a333a62014-10-29 08:04:27 +010078# Path to find HTML templates.
Georg Brandla1f84862014-10-29 08:11:46 +010079templates_path = ['tools/templates']
Christian Heimes2c181612007-12-17 20:04:13 +000080
Christian Heimes679db4a2008-01-18 09:56:22 +000081# Custom sidebar templates, filenames relative to this file.
82html_sidebars = {
Zachary Warea3090a42016-09-09 13:11:27 -070083 # Defaults taken from http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars
84 # Removes the quick search block
85 '**': ['localtoc.html', 'relations.html', 'customsourcelink.html'],
86 'index': ['indexsidebar.html'],
Christian Heimes679db4a2008-01-18 09:56:22 +000087}
88
89# Additional templates that should be rendered to pages.
90html_additional_pages = {
Georg Brandl45832ea2008-03-12 08:52:43 +000091 'download': 'download.html',
Christian Heimesa342c012008-04-20 21:01:16 +000092 'index': 'indexcontent.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000093}
94
Georg Brandle7570052008-05-03 20:52:18 +000095# Output an OpenSearch description file.
Georg Brandle73778c2014-10-29 08:36:35 +010096html_use_opensearch = 'https://docs.python.org/' + version
Georg Brandle7570052008-05-03 20:52:18 +000097
98# Additional static files.
Georg Brandl97e9ec62014-09-30 22:51:30 +020099html_static_path = ['tools/static']
Georg Brandle7570052008-05-03 20:52:18 +0000100
Christian Heimes679db4a2008-01-18 09:56:22 +0000101# Output file base name for HTML help builder.
Christian Heimesb558a2e2008-03-02 22:46:37 +0000102htmlhelp_basename = 'python' + release.replace('.', '')
Christian Heimes679db4a2008-01-18 09:56:22 +0000103
Amaury Forgeot d'Arc35c86582008-06-17 21:11:29 +0000104# Split the index
105html_split_index = True
106
Christian Heimes2c181612007-12-17 20:04:13 +0000107
108# Options for LaTeX output
109# ------------------------
110
Julien Palard7324b5c2017-12-02 23:24:39 +0100111latex_engine = 'xelatex'
112
Ryan Gonzaleze7ffb992017-02-10 22:47:37 -0600113# Get LaTeX to handle Unicode correctly
François Magimelda9b4cf2017-09-22 19:16:57 +0200114latex_elements = {
François Magimelda9b4cf2017-09-22 19:16:57 +0200115}
Ryan Gonzaleze7ffb992017-02-10 22:47:37 -0600116
117# Additional stuff for the LaTeX preamble.
118latex_elements['preamble'] = r'''
119\authoraddress{
François Magimelda9b4cf2017-09-22 19:16:57 +0200120 \sphinxstrong{Python Software Foundation}\\
121 Email: \sphinxemail{docs@python.org}
Ryan Gonzaleze7ffb992017-02-10 22:47:37 -0600122}
123\let\Verbatim=\OriginalVerbatim
124\let\endVerbatim=\endOriginalVerbatim
125'''
126
Christian Heimes679db4a2008-01-18 09:56:22 +0000127# The paper size ('letter' or 'a4').
Ryan Gonzaleze7ffb992017-02-10 22:47:37 -0600128latex_elements['papersize'] = 'a4'
Christian Heimes2c181612007-12-17 20:04:13 +0000129
Christian Heimes679db4a2008-01-18 09:56:22 +0000130# The font size ('10pt', '11pt' or '12pt').
François Magimelda9b4cf2017-09-22 19:16:57 +0200131latex_elements['pointsize'] = '10pt'
Christian Heimes679db4a2008-01-18 09:56:22 +0000132
133# Grouping the document tree into LaTeX files. List of tuples
134# (source start file, target name, title, author, document class [howto/manual]).
Georg Brandl9ab33ea2014-10-29 08:14:04 +0100135_stdauthor = r'Guido van Rossum\\and the Python development team'
Christian Heimes679db4a2008-01-18 09:56:22 +0000136latex_documents = [
Christian Heimes292d3512008-02-03 16:51:08 +0000137 ('c-api/index', 'c-api.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000138 'The Python/C API', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700139 ('distributing/index', 'distributing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000140 'Distributing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000141 ('extending/index', 'extending.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000142 'Extending and Embedding Python', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700143 ('installing/index', 'installing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000144 'Installing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000145 ('library/index', 'library.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000146 'The Python Library Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000147 ('reference/index', 'reference.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000148 'The Python Language Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000149 ('tutorial/index', 'tutorial.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000150 'Python Tutorial', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000151 ('using/index', 'using.tex',
Georg Brandl8d582162010-09-03 22:33:27 +0000152 'Python Setup and Usage', _stdauthor, 'manual'),
Georg Brandle5b5ff42010-11-12 06:19:48 +0000153 ('faq/index', 'faq.tex',
154 'Python Frequently Asked Questions', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000155 ('whatsnew/' + version, 'whatsnew.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000156 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
157]
158# Collect all HOWTOs individually
Christian Heimes292d3512008-02-03 16:51:08 +0000159latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
Benjamin Petersonf608c612008-11-16 18:33:53 +0000160 '', _stdauthor, 'howto')
Christian Heimes679db4a2008-01-18 09:56:22 +0000161 for fn in os.listdir('howto')
162 if fn.endswith('.rst') and fn != 'index.rst')
163
Christian Heimes679db4a2008-01-18 09:56:22 +0000164# Documents to append as an appendix to all manuals.
Christian Heimes292d3512008-02-03 16:51:08 +0000165latex_appendices = ['glossary', 'about', 'license', 'copyright']
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000166
Senthil Kumarancbe63562016-01-08 01:01:56 -0800167# Options for Epub output
168# -----------------------
169
170epub_author = 'Python Documentation Authors'
171epub_publisher = 'Python Software Foundation'
Georg Brandl9a333a62014-10-29 08:04:27 +0100172
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000173# Options for the coverage checker
174# --------------------------------
175
176# The coverage checker will ignore all modules/functions/classes whose names
177# match any of the following regexes (using re.match).
178coverage_ignore_modules = [
179 r'[T|t][k|K]',
180 r'Tix',
181 r'distutils.*',
182]
183
184coverage_ignore_functions = [
185 'test($|_)',
186]
187
188coverage_ignore_classes = [
189]
190
191# Glob patterns for C source files for C API coverage, relative to this directory.
192coverage_c_path = [
193 '../Include/*.h',
194]
195
196# Regexes to find C items in the source files.
197coverage_c_regexes = {
198 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
199 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
200 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
201}
202
203# The coverage checker will ignore all C items whose names match these regexes
204# (using re.match) -- the keys must be the same as in coverage_c_regexes.
205coverage_ignore_c_items = {
206# 'cfunction': [...]
207}
Georg Brandl9a333a62014-10-29 08:04:27 +0100208
Georg Brandl0ef49662014-10-29 10:57:01 +0100209
210# Options for the link checker
211# ----------------------------
212
213# Ignore certain URLs.
214linkcheck_ignore = [r'https://bugs.python.org/(issue)?\d+',
215 # Ignore PEPs for now, they all have permanent redirects.
216 r'http://www.python.org/dev/peps/pep-\d+']
217
218
Georg Brandl9a333a62014-10-29 08:04:27 +0100219# Options for extensions
220# ----------------------
221
222# Relative filename of the reference count data file.
223refcount_file = 'data/refcounts.dat'