blob: 124cb7aff6b3bfb7f01b39f25a9b4cf1fbbc2910 [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',
Miss Islington (bot)c4c86fa2018-10-08 14:26:55 -070017 'pyspecific', 'c_annotations', 'escape4chm']
Christian Heimes26855632008-01-27 23:50:43 +000018
Christian Heimes679db4a2008-01-18 09:56:22 +000019# General substitutions.
20project = 'Python'
Berker Peksag2ec1bee2016-04-24 03:21:13 +030021copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
Christian Heimes679db4a2008-01-18 09:56:22 +000022
Georg Brandl86def6c2008-01-21 20:36:10 +000023# We look for the Include/patchlevel.h file in the current Python source tree
24# and replace the values accordingly.
25import patchlevel
26version, release = patchlevel.get_version_info()
Georg Brandl116aa622007-08-15 14:28:22 +000027
28# There are two options for replacing |today|: either, you set today to some
29# non-false value, then it is used:
30today = ''
31# Else, today_fmt is used as the format for a strftime call.
32today_fmt = '%B %d, %Y'
33
Georg Brandl64063702008-09-09 19:10:58 +000034# By default, highlight as Python 3.
35highlight_language = 'python3'
36
Julien Palardb6b77952018-12-09 06:56:59 +010037# Require Sphinx 1.7 for build.
38needs_sphinx = '1.7'
Larry Hastings3732ed22014-03-15 21:13:56 -070039
Senthil Kumaran889f9142016-06-04 22:22:26 -070040# Ignore any .rst files in the venv/ directory.
Ned Deily61292502017-10-12 16:04:57 -040041venvdir = os.getenv('VENVDIR', 'venv')
42exclude_patterns = [venvdir+'/*', 'README.rst']
Brett Cannon9b166662015-03-30 15:35:37 -040043
Julien Palardb6b77952018-12-09 06:56:59 +010044# Disable Docutils smartquotes for several translations
45smartquotes_excludes = {
46 'languages': ['ja', 'fr', 'zh_TW', 'zh_CN'], 'builders': ['man', 'text'],
47}
48
Christian Heimes2c181612007-12-17 20:04:13 +000049
50# Options for HTML output
51# -----------------------
52
Georg Brandl9a333a62014-10-29 08:04:27 +010053# Use our custom theme.
Yury Selivanov6aeda912015-07-01 21:06:59 -040054html_theme = 'pydoctheme'
Ned Deily14366f32014-09-30 18:41:37 -070055html_theme_path = ['tools']
Georg Brandla0745232010-07-30 11:31:03 +000056html_theme_options = {'collapsiblesidebar': True}
57
Georg Brandl9a333a62014-10-29 08:04:27 +010058# Short title used e.g. for <title> HTML tags.
Georg Brandlab712142012-03-25 20:31:57 +020059html_short_title = '%s Documentation' % release
60
Christian Heimes2c181612007-12-17 20:04:13 +000061# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
62# using the given strftime format.
63html_last_updated_fmt = '%b %d, %Y'
64
Georg Brandl9a333a62014-10-29 08:04:27 +010065# Path to find HTML templates.
Georg Brandla1f84862014-10-29 08:11:46 +010066templates_path = ['tools/templates']
Christian Heimes2c181612007-12-17 20:04:13 +000067
Christian Heimes679db4a2008-01-18 09:56:22 +000068# Custom sidebar templates, filenames relative to this file.
69html_sidebars = {
Zachary Warea3090a42016-09-09 13:11:27 -070070 # Defaults taken from http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars
71 # Removes the quick search block
72 '**': ['localtoc.html', 'relations.html', 'customsourcelink.html'],
73 'index': ['indexsidebar.html'],
Christian Heimes679db4a2008-01-18 09:56:22 +000074}
75
76# Additional templates that should be rendered to pages.
77html_additional_pages = {
Georg Brandl45832ea2008-03-12 08:52:43 +000078 'download': 'download.html',
Christian Heimesa342c012008-04-20 21:01:16 +000079 'index': 'indexcontent.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000080}
81
Georg Brandle7570052008-05-03 20:52:18 +000082# Output an OpenSearch description file.
Georg Brandle73778c2014-10-29 08:36:35 +010083html_use_opensearch = 'https://docs.python.org/' + version
Georg Brandle7570052008-05-03 20:52:18 +000084
85# Additional static files.
Georg Brandl97e9ec62014-09-30 22:51:30 +020086html_static_path = ['tools/static']
Georg Brandle7570052008-05-03 20:52:18 +000087
Christian Heimes679db4a2008-01-18 09:56:22 +000088# Output file base name for HTML help builder.
Christian Heimesb558a2e2008-03-02 22:46:37 +000089htmlhelp_basename = 'python' + release.replace('.', '')
Christian Heimes679db4a2008-01-18 09:56:22 +000090
Amaury Forgeot d'Arc35c86582008-06-17 21:11:29 +000091# Split the index
92html_split_index = True
93
Christian Heimes2c181612007-12-17 20:04:13 +000094
95# Options for LaTeX output
96# ------------------------
97
Julien Palard7324b5c2017-12-02 23:24:39 +010098latex_engine = 'xelatex'
99
Ryan Gonzaleze7ffb992017-02-10 22:47:37 -0600100# Get LaTeX to handle Unicode correctly
François Magimelda9b4cf2017-09-22 19:16:57 +0200101latex_elements = {
François Magimelda9b4cf2017-09-22 19:16:57 +0200102}
Ryan Gonzaleze7ffb992017-02-10 22:47:37 -0600103
104# Additional stuff for the LaTeX preamble.
105latex_elements['preamble'] = r'''
106\authoraddress{
François Magimelda9b4cf2017-09-22 19:16:57 +0200107 \sphinxstrong{Python Software Foundation}\\
108 Email: \sphinxemail{docs@python.org}
Ryan Gonzaleze7ffb992017-02-10 22:47:37 -0600109}
110\let\Verbatim=\OriginalVerbatim
111\let\endVerbatim=\endOriginalVerbatim
112'''
113
Christian Heimes679db4a2008-01-18 09:56:22 +0000114# The paper size ('letter' or 'a4').
Ryan Gonzaleze7ffb992017-02-10 22:47:37 -0600115latex_elements['papersize'] = 'a4'
Christian Heimes2c181612007-12-17 20:04:13 +0000116
Christian Heimes679db4a2008-01-18 09:56:22 +0000117# The font size ('10pt', '11pt' or '12pt').
François Magimelda9b4cf2017-09-22 19:16:57 +0200118latex_elements['pointsize'] = '10pt'
Christian Heimes679db4a2008-01-18 09:56:22 +0000119
120# Grouping the document tree into LaTeX files. List of tuples
121# (source start file, target name, title, author, document class [howto/manual]).
Georg Brandl9ab33ea2014-10-29 08:14:04 +0100122_stdauthor = r'Guido van Rossum\\and the Python development team'
Christian Heimes679db4a2008-01-18 09:56:22 +0000123latex_documents = [
Christian Heimes292d3512008-02-03 16:51:08 +0000124 ('c-api/index', 'c-api.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000125 'The Python/C API', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700126 ('distributing/index', 'distributing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000127 'Distributing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000128 ('extending/index', 'extending.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000129 'Extending and Embedding Python', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700130 ('installing/index', 'installing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000131 'Installing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000132 ('library/index', 'library.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000133 'The Python Library Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000134 ('reference/index', 'reference.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000135 'The Python Language Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000136 ('tutorial/index', 'tutorial.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000137 'Python Tutorial', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000138 ('using/index', 'using.tex',
Georg Brandl8d582162010-09-03 22:33:27 +0000139 'Python Setup and Usage', _stdauthor, 'manual'),
Georg Brandle5b5ff42010-11-12 06:19:48 +0000140 ('faq/index', 'faq.tex',
141 'Python Frequently Asked Questions', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000142 ('whatsnew/' + version, 'whatsnew.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000143 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
144]
145# Collect all HOWTOs individually
Christian Heimes292d3512008-02-03 16:51:08 +0000146latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
Benjamin Petersonf608c612008-11-16 18:33:53 +0000147 '', _stdauthor, 'howto')
Christian Heimes679db4a2008-01-18 09:56:22 +0000148 for fn in os.listdir('howto')
149 if fn.endswith('.rst') and fn != 'index.rst')
150
Christian Heimes679db4a2008-01-18 09:56:22 +0000151# Documents to append as an appendix to all manuals.
Christian Heimes292d3512008-02-03 16:51:08 +0000152latex_appendices = ['glossary', 'about', 'license', 'copyright']
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000153
Senthil Kumarancbe63562016-01-08 01:01:56 -0800154# Options for Epub output
155# -----------------------
156
157epub_author = 'Python Documentation Authors'
158epub_publisher = 'Python Software Foundation'
Georg Brandl9a333a62014-10-29 08:04:27 +0100159
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000160# Options for the coverage checker
161# --------------------------------
162
163# The coverage checker will ignore all modules/functions/classes whose names
164# match any of the following regexes (using re.match).
165coverage_ignore_modules = [
166 r'[T|t][k|K]',
167 r'Tix',
168 r'distutils.*',
169]
170
171coverage_ignore_functions = [
172 'test($|_)',
173]
174
175coverage_ignore_classes = [
176]
177
178# Glob patterns for C source files for C API coverage, relative to this directory.
179coverage_c_path = [
180 '../Include/*.h',
181]
182
183# Regexes to find C items in the source files.
184coverage_c_regexes = {
185 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
186 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
187 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
188}
189
190# The coverage checker will ignore all C items whose names match these regexes
191# (using re.match) -- the keys must be the same as in coverage_c_regexes.
192coverage_ignore_c_items = {
193# 'cfunction': [...]
194}
Georg Brandl9a333a62014-10-29 08:04:27 +0100195
Georg Brandl0ef49662014-10-29 10:57:01 +0100196
197# Options for the link checker
198# ----------------------------
199
200# Ignore certain URLs.
201linkcheck_ignore = [r'https://bugs.python.org/(issue)?\d+',
202 # Ignore PEPs for now, they all have permanent redirects.
203 r'http://www.python.org/dev/peps/pep-\d+']
204
205
Georg Brandl9a333a62014-10-29 08:04:27 +0100206# Options for extensions
207# ----------------------
208
209# Relative filename of the reference count data file.
210refcount_file = 'data/refcounts.dat'