blob: 557fe1e72f277662057d2a39579e66e47acd0054 [file] [log] [blame]
Georg Brandl8ec7f652007-08-15 14:28:01 +00001# -*- coding: utf-8 -*-
2#
3# Python documentation build configuration file
4#
Georg Brandl7155a092008-01-16 20:27:56 +00005# This file is execfile()d with the current directory set to its containing dir.
6#
Georg Brandl8ec7f652007-08-15 14:28:01 +00007# The contents of this file are pickled, so don't put values in the namespace
8# that aren't pickleable (module imports are okay, they're removed automatically).
Georg Brandleee1fc52007-12-16 19:36:51 +00009
Georg Brandldd76e052008-01-21 20:20:53 +000010import sys, os, time
Georg Brandl160cbce2014-10-29 08:41:02 +010011sys.path.append(os.path.abspath('tools/extensions'))
Georg Brandldd76e052008-01-21 20:20:53 +000012
Georg Brandleee1fc52007-12-16 19:36:51 +000013# General configuration
14# ---------------------
Georg Brandl8ec7f652007-08-15 14:28:01 +000015
Benjamin Peterson342fd182014-09-05 10:03:26 -040016extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest',
17 'pyspecific', 'c_annotations']
Georg Brandl56eadd92008-01-27 20:25:12 +000018
Georg Brandl7155a092008-01-16 20:27:56 +000019# General substitutions.
20project = 'Python'
Georg Brandldd76e052008-01-21 20:20:53 +000021copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y')
Georg Brandl7155a092008-01-16 20:27:56 +000022
Georg Brandldd76e052008-01-21 20:20:53 +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 Brandl8ec7f652007-08-15 14:28:01 +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 Brandl8ec7f652007-08-15 14:28:01 +000034# List of files that shouldn't be included in the build.
Georg Brandl3e46d7c2014-09-21 00:42:40 +020035exclude_patterns = [
36 'maclib/scrap.rst',
37 'library/xmllib.rst',
38 'library/xml.etree.rst',
Georg Brandl8ec7f652007-08-15 14:28:01 +000039]
40
Georg Brandl14b5a4d2014-10-02 08:26:26 +020041# Require Sphinx 1.2 for build.
42needs_sphinx = '1.2'
43
Georg Brandleee1fc52007-12-16 19:36:51 +000044
45# Options for HTML output
46# -----------------------
47
Georg Brandl27a49182012-01-21 08:58:22 +010048html_theme = 'default'
49html_theme_options = {'collapsiblesidebar': True}
50
Georg Brandleee1fc52007-12-16 19:36:51 +000051# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
52# using the given strftime format.
53html_last_updated_fmt = '%b %d, %Y'
54
Georg Brandl160cbce2014-10-29 08:41:02 +010055# Path to find HTML templates.
56templates_path = ['tools/templates']
Georg Brandleee1fc52007-12-16 19:36:51 +000057
Georg Brandl7155a092008-01-16 20:27:56 +000058# Custom sidebar templates, filenames relative to this file.
59html_sidebars = {
Georg Brandl5bb647d2008-03-09 18:18:30 +000060 'index': 'indexsidebar.html',
Georg Brandl7155a092008-01-16 20:27:56 +000061}
62
63# Additional templates that should be rendered to pages.
64html_additional_pages = {
Georg Brandl5bb647d2008-03-09 18:18:30 +000065 'download': 'download.html',
Georg Brandl1df986b2008-04-19 21:28:38 +000066 'index': 'indexcontent.html',
Georg Brandl7155a092008-01-16 20:27:56 +000067}
68
Georg Brandl4f1f36b2008-04-27 20:03:05 +000069# Output an OpenSearch description file.
Georg Brandl06f3b3b2014-10-29 08:36:35 +010070html_use_opensearch = 'https://docs.python.org/'
Georg Brandl4f1f36b2008-04-27 20:03:05 +000071
72# Additional static files.
Georg Brandlf16fbf92014-09-30 22:51:30 +020073html_static_path = ['tools/static']
Georg Brandl4f1f36b2008-04-27 20:03:05 +000074
Georg Brandl7155a092008-01-16 20:27:56 +000075# Output file base name for HTML help builder.
Georg Brandl47dff402008-03-02 06:45:40 +000076htmlhelp_basename = 'python' + release.replace('.', '')
Georg Brandl7155a092008-01-16 20:27:56 +000077
Georg Brandl5c15aba2008-06-17 09:01:35 +000078# Split the index
79html_split_index = True
80
Georg Brandleee1fc52007-12-16 19:36:51 +000081
82# Options for LaTeX output
83# ------------------------
84
Zachary Ware4be66b62017-05-13 09:16:44 -050085# Get LaTeX to handle Unicode correctly
Zachary Wareda868742017-09-22 13:41:10 -050086latex_elements = {
87 'inputenc': r'\usepackage[utf8x]{inputenc}',
88 'utf8extra': '',
89 'fontenc': r'\usepackage[T1,T2A]{fontenc}',
90}
Zachary Ware4be66b62017-05-13 09:16:44 -050091
92# Additional stuff for the LaTeX preamble.
93latex_elements['preamble'] = r'''
94\authoraddress{
Zachary Wareda868742017-09-22 13:41:10 -050095 \sphinxstrong{Python Software Foundation}\\
96 Email: \sphinxemail{docs@python.org}
Zachary Ware4be66b62017-05-13 09:16:44 -050097}
98\let\Verbatim=\OriginalVerbatim
99\let\endVerbatim=\endOriginalVerbatim
100'''
101
Georg Brandl7155a092008-01-16 20:27:56 +0000102# The paper size ('letter' or 'a4').
Zachary Ware4be66b62017-05-13 09:16:44 -0500103latex_elements['papersize'] = 'a4'
Georg Brandleee1fc52007-12-16 19:36:51 +0000104
Georg Brandl7155a092008-01-16 20:27:56 +0000105# The font size ('10pt', '11pt' or '12pt').
Zachary Wareda868742017-09-22 13:41:10 -0500106latex_elements['pointsize'] = '10pt'
Georg Brandl7155a092008-01-16 20:27:56 +0000107
108# Grouping the document tree into LaTeX files. List of tuples
109# (source start file, target name, title, author, document class [howto/manual]).
Georg Brandlecc0cc02014-10-29 08:14:04 +0100110_stdauthor = r'Guido van Rossum\\and the Python development team'
Georg Brandl7155a092008-01-16 20:27:56 +0000111latex_documents = [
Georg Brandla51f61b2008-02-01 20:45:33 +0000112 ('c-api/index', 'c-api.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000113 'The Python/C API', _stdauthor, 'manual'),
Donald Stufft527d4ac2014-11-20 09:38:31 -0500114 ('distributing/index', 'distributing.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000115 'Distributing Python Modules', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000116 ('extending/index', 'extending.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000117 'Extending and Embedding Python', _stdauthor, 'manual'),
Donald Stufft527d4ac2014-11-20 09:38:31 -0500118 ('installing/index', 'installing.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000119 'Installing Python Modules', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000120 ('library/index', 'library.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000121 'The Python Library Reference', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000122 ('reference/index', 'reference.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000123 'The Python Language Reference', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000124 ('tutorial/index', 'tutorial.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000125 'Python Tutorial', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000126 ('using/index', 'using.tex',
Georg Brandl21946af2010-10-06 09:28:45 +0000127 'Python Setup and Usage', _stdauthor, 'manual'),
Georg Brandl3b85b9b2010-11-26 08:20:18 +0000128 ('faq/index', 'faq.tex',
129 'Python Frequently Asked Questions', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000130 ('whatsnew/' + version, 'whatsnew.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000131 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
132]
133# Collect all HOWTOs individually
Georg Brandla51f61b2008-02-01 20:45:33 +0000134latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
Georg Brandl012a1ff2008-11-08 11:47:44 +0000135 '', _stdauthor, 'howto')
Georg Brandl7155a092008-01-16 20:27:56 +0000136 for fn in os.listdir('howto')
137 if fn.endswith('.rst') and fn != 'index.rst')
138
Georg Brandl7155a092008-01-16 20:27:56 +0000139# Documents to append as an appendix to all manuals.
Georg Brandla51f61b2008-02-01 20:45:33 +0000140latex_appendices = ['glossary', 'about', 'license', 'copyright']
Georg Brandl17048282008-02-23 18:47:04 +0000141
Senthil Kumaranee988602016-01-08 01:05:57 -0800142# Options for Epub output
143# -----------------------
144
145epub_author = 'Python Documentation Authors'
146epub_publisher = 'Python Software Foundation'
147
Georg Brandl17048282008-02-23 18:47:04 +0000148# Options for the coverage checker
149# --------------------------------
150
151# The coverage checker will ignore all modules/functions/classes whose names
152# match any of the following regexes (using re.match).
153coverage_ignore_modules = [
154 r'[T|t][k|K]',
155 r'Tix',
156 r'distutils.*',
157]
158
159coverage_ignore_functions = [
160 'test($|_)',
161]
162
163coverage_ignore_classes = [
164]
165
166# Glob patterns for C source files for C API coverage, relative to this directory.
167coverage_c_path = [
168 '../Include/*.h',
169]
170
171# Regexes to find C items in the source files.
172coverage_c_regexes = {
173 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
174 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
175 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
176}
177
178# The coverage checker will ignore all C items whose names match these regexes
179# (using re.match) -- the keys must be the same as in coverage_c_regexes.
180coverage_ignore_c_items = {
181# 'cfunction': [...]
182}
Georg Brandl160cbce2014-10-29 08:41:02 +0100183
Georg Brandlcea27252014-10-29 10:57:01 +0100184
185# Options for the link checker
186# ----------------------------
187
188# Ignore certain URLs.
189linkcheck_ignore = [r'https://bugs.python.org/(issue)?\d+',
190 # Ignore PEPs for now, they all have permanent redirects.
191 r'http://www.python.org/dev/peps/pep-\d+']
192
193
Georg Brandl160cbce2014-10-29 08:41:02 +0100194# Options for extensions
195# ----------------------
196
197# Relative filename of the reference count data file.
198refcount_file = 'data/refcounts.dat'