blob: 2c271e844ae5443283d9ff829b436ebbc40911d9 [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
Georg Brandl7155a092008-01-16 20:27:56 +000085# The paper size ('letter' or 'a4').
86latex_paper_size = 'a4'
Georg Brandleee1fc52007-12-16 19:36:51 +000087
Georg Brandl7155a092008-01-16 20:27:56 +000088# The font size ('10pt', '11pt' or '12pt').
89latex_font_size = '10pt'
90
91# Grouping the document tree into LaTeX files. List of tuples
92# (source start file, target name, title, author, document class [howto/manual]).
Georg Brandlecc0cc02014-10-29 08:14:04 +010093_stdauthor = r'Guido van Rossum\\and the Python development team'
Georg Brandl7155a092008-01-16 20:27:56 +000094latex_documents = [
Georg Brandla51f61b2008-02-01 20:45:33 +000095 ('c-api/index', 'c-api.tex',
Georg Brandl7155a092008-01-16 20:27:56 +000096 'The Python/C API', _stdauthor, 'manual'),
Donald Stufft527d4ac2014-11-20 09:38:31 -050097 ('distributing/index', 'distributing.tex',
Georg Brandl7155a092008-01-16 20:27:56 +000098 'Distributing Python Modules', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +000099 ('extending/index', 'extending.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000100 'Extending and Embedding Python', _stdauthor, 'manual'),
Donald Stufft527d4ac2014-11-20 09:38:31 -0500101 ('installing/index', 'installing.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000102 'Installing Python Modules', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000103 ('library/index', 'library.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000104 'The Python Library Reference', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000105 ('reference/index', 'reference.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000106 'The Python Language Reference', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000107 ('tutorial/index', 'tutorial.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000108 'Python Tutorial', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000109 ('using/index', 'using.tex',
Georg Brandl21946af2010-10-06 09:28:45 +0000110 'Python Setup and Usage', _stdauthor, 'manual'),
Georg Brandl3b85b9b2010-11-26 08:20:18 +0000111 ('faq/index', 'faq.tex',
112 'Python Frequently Asked Questions', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000113 ('whatsnew/' + version, 'whatsnew.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000114 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
115]
116# Collect all HOWTOs individually
Georg Brandla51f61b2008-02-01 20:45:33 +0000117latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
Georg Brandl012a1ff2008-11-08 11:47:44 +0000118 '', _stdauthor, 'howto')
Georg Brandl7155a092008-01-16 20:27:56 +0000119 for fn in os.listdir('howto')
120 if fn.endswith('.rst') and fn != 'index.rst')
121
122# Additional stuff for the LaTeX preamble.
123latex_preamble = r'''
124\authoraddress{
125 \strong{Python Software Foundation}\\
126 Email: \email{docs@python.org}
127}
Georg Brandl65e8fc72008-11-19 07:59:09 +0000128\let\Verbatim=\OriginalVerbatim
129\let\endVerbatim=\endOriginalVerbatim
Georg Brandl7155a092008-01-16 20:27:56 +0000130'''
131
132# Documents to append as an appendix to all manuals.
Georg Brandla51f61b2008-02-01 20:45:33 +0000133latex_appendices = ['glossary', 'about', 'license', 'copyright']
Georg Brandl17048282008-02-23 18:47:04 +0000134
Benjamin Peterson626c0aa2009-08-24 17:42:36 +0000135# Get LaTeX to handle Unicode correctly
Georg Brandl27a49182012-01-21 08:58:22 +0100136latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''}
Benjamin Peterson626c0aa2009-08-24 17:42:36 +0000137
Senthil Kumaranee988602016-01-08 01:05:57 -0800138
139# Options for Epub output
140# -----------------------
141
142epub_author = 'Python Documentation Authors'
143epub_publisher = 'Python Software Foundation'
144
145
Georg Brandl17048282008-02-23 18:47:04 +0000146# Options for the coverage checker
147# --------------------------------
148
149# The coverage checker will ignore all modules/functions/classes whose names
150# match any of the following regexes (using re.match).
151coverage_ignore_modules = [
152 r'[T|t][k|K]',
153 r'Tix',
154 r'distutils.*',
155]
156
157coverage_ignore_functions = [
158 'test($|_)',
159]
160
161coverage_ignore_classes = [
162]
163
164# Glob patterns for C source files for C API coverage, relative to this directory.
165coverage_c_path = [
166 '../Include/*.h',
167]
168
169# Regexes to find C items in the source files.
170coverage_c_regexes = {
171 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
172 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
173 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
174}
175
176# The coverage checker will ignore all C items whose names match these regexes
177# (using re.match) -- the keys must be the same as in coverage_c_regexes.
178coverage_ignore_c_items = {
179# 'cfunction': [...]
180}
Georg Brandl160cbce2014-10-29 08:41:02 +0100181
Georg Brandlcea27252014-10-29 10:57:01 +0100182
183# Options for the link checker
184# ----------------------------
185
186# Ignore certain URLs.
187linkcheck_ignore = [r'https://bugs.python.org/(issue)?\d+',
188 # Ignore PEPs for now, they all have permanent redirects.
189 r'http://www.python.org/dev/peps/pep-\d+']
190
191
Georg Brandl160cbce2014-10-29 08:41:02 +0100192# Options for extensions
193# ----------------------
194
195# Relative filename of the reference count data file.
196refcount_file = 'data/refcounts.dat'