blob: 28dd80f8590f49bd8a11389559e68fc4e4d6ab81 [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'))
Georg Brandl86def6c2008-01-21 20:36:10 +000011
Christian Heimes2c181612007-12-17 20:04:13 +000012# General configuration
13# ---------------------
Georg Brandl116aa622007-08-15 14:28:22 +000014
Georg Brandl5c01d992013-10-12 19:54:30 +020015extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest',
16 'pyspecific', 'c_annotations']
Christian Heimes26855632008-01-27 23:50:43 +000017
Christian Heimes679db4a2008-01-18 09:56:22 +000018# General substitutions.
19project = 'Python'
Georg Brandl86def6c2008-01-21 20:36:10 +000020copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y')
Christian Heimes679db4a2008-01-18 09:56:22 +000021
Georg Brandl86def6c2008-01-21 20:36:10 +000022# We look for the Include/patchlevel.h file in the current Python source tree
23# and replace the values accordingly.
24import patchlevel
25version, release = patchlevel.get_version_info()
Georg Brandl116aa622007-08-15 14:28:22 +000026
27# There are two options for replacing |today|: either, you set today to some
28# non-false value, then it is used:
29today = ''
30# Else, today_fmt is used as the format for a strftime call.
31today_fmt = '%B %d, %Y'
32
Georg Brandl64063702008-09-09 19:10:58 +000033# By default, highlight as Python 3.
34highlight_language = 'python3'
35
Georg Brandlea7ec2b2014-10-02 08:27:05 +020036# Require Sphinx 1.2 for build.
Georg Brandl90d76ca2014-09-22 21:18:24 +020037needs_sphinx = '1.2'
Larry Hastings3732ed22014-03-15 21:13:56 -070038
Brett Cannon9b166662015-03-30 15:35:37 -040039# Ignore any .rst files in the venv/ directory.
40exclude_patterns = ['venv/*']
41
Christian Heimes2c181612007-12-17 20:04:13 +000042
43# Options for HTML output
44# -----------------------
45
Georg Brandl9a333a62014-10-29 08:04:27 +010046# Use our custom theme.
Georg Brandlab712142012-03-25 20:31:57 +020047html_theme = 'pydoctheme'
Ned Deily14366f32014-09-30 18:41:37 -070048html_theme_path = ['tools']
Georg Brandla0745232010-07-30 11:31:03 +000049html_theme_options = {'collapsiblesidebar': True}
50
Georg Brandl9a333a62014-10-29 08:04:27 +010051# Short title used e.g. for <title> HTML tags.
Georg Brandlab712142012-03-25 20:31:57 +020052html_short_title = '%s Documentation' % release
53
Christian Heimes2c181612007-12-17 20:04:13 +000054# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
55# using the given strftime format.
56html_last_updated_fmt = '%b %d, %Y'
57
Georg Brandl9a333a62014-10-29 08:04:27 +010058# Path to find HTML templates.
Georg Brandla1f84862014-10-29 08:11:46 +010059templates_path = ['tools/templates']
Christian Heimes2c181612007-12-17 20:04:13 +000060
Christian Heimes679db4a2008-01-18 09:56:22 +000061# Custom sidebar templates, filenames relative to this file.
62html_sidebars = {
Georg Brandl45832ea2008-03-12 08:52:43 +000063 'index': 'indexsidebar.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000064}
65
66# Additional templates that should be rendered to pages.
67html_additional_pages = {
Georg Brandl45832ea2008-03-12 08:52:43 +000068 'download': 'download.html',
Christian Heimesa342c012008-04-20 21:01:16 +000069 'index': 'indexcontent.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000070}
71
Georg Brandle7570052008-05-03 20:52:18 +000072# Output an OpenSearch description file.
Georg Brandle73778c2014-10-29 08:36:35 +010073html_use_opensearch = 'https://docs.python.org/' + version
Georg Brandle7570052008-05-03 20:52:18 +000074
75# Additional static files.
Georg Brandl97e9ec62014-09-30 22:51:30 +020076html_static_path = ['tools/static']
Georg Brandle7570052008-05-03 20:52:18 +000077
Christian Heimes679db4a2008-01-18 09:56:22 +000078# Output file base name for HTML help builder.
Christian Heimesb558a2e2008-03-02 22:46:37 +000079htmlhelp_basename = 'python' + release.replace('.', '')
Christian Heimes679db4a2008-01-18 09:56:22 +000080
Amaury Forgeot d'Arc35c86582008-06-17 21:11:29 +000081# Split the index
82html_split_index = True
83
Christian Heimes2c181612007-12-17 20:04:13 +000084
85# Options for LaTeX output
86# ------------------------
87
Christian Heimes679db4a2008-01-18 09:56:22 +000088# The paper size ('letter' or 'a4').
89latex_paper_size = 'a4'
Christian Heimes2c181612007-12-17 20:04:13 +000090
Christian Heimes679db4a2008-01-18 09:56:22 +000091# The font size ('10pt', '11pt' or '12pt').
92latex_font_size = '10pt'
93
94# Grouping the document tree into LaTeX files. List of tuples
95# (source start file, target name, title, author, document class [howto/manual]).
Georg Brandl9ab33ea2014-10-29 08:14:04 +010096_stdauthor = r'Guido van Rossum\\and the Python development team'
Christian Heimes679db4a2008-01-18 09:56:22 +000097latex_documents = [
Christian Heimes292d3512008-02-03 16:51:08 +000098 ('c-api/index', 'c-api.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +000099 'The Python/C API', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700100 ('distributing/index', 'distributing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000101 'Distributing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000102 ('extending/index', 'extending.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000103 'Extending and Embedding Python', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700104 ('installing/index', 'installing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000105 'Installing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000106 ('library/index', 'library.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000107 'The Python Library Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000108 ('reference/index', 'reference.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000109 'The Python Language Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000110 ('tutorial/index', 'tutorial.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000111 'Python Tutorial', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000112 ('using/index', 'using.tex',
Georg Brandl8d582162010-09-03 22:33:27 +0000113 'Python Setup and Usage', _stdauthor, 'manual'),
Georg Brandle5b5ff42010-11-12 06:19:48 +0000114 ('faq/index', 'faq.tex',
115 'Python Frequently Asked Questions', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000116 ('whatsnew/' + version, 'whatsnew.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000117 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
118]
119# Collect all HOWTOs individually
Christian Heimes292d3512008-02-03 16:51:08 +0000120latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
Benjamin Petersonf608c612008-11-16 18:33:53 +0000121 '', _stdauthor, 'howto')
Christian Heimes679db4a2008-01-18 09:56:22 +0000122 for fn in os.listdir('howto')
123 if fn.endswith('.rst') and fn != 'index.rst')
124
125# Additional stuff for the LaTeX preamble.
126latex_preamble = r'''
127\authoraddress{
128 \strong{Python Software Foundation}\\
129 Email: \email{docs@python.org}
130}
Benjamin Peterson6cadba72008-11-19 22:38:29 +0000131\let\Verbatim=\OriginalVerbatim
132\let\endVerbatim=\endOriginalVerbatim
Christian Heimes679db4a2008-01-18 09:56:22 +0000133'''
134
135# Documents to append as an appendix to all manuals.
Christian Heimes292d3512008-02-03 16:51:08 +0000136latex_appendices = ['glossary', 'about', 'license', 'copyright']
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000137
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000138# Get LaTeX to handle Unicode correctly
Georg Brandl4bf70682010-07-27 18:19:21 +0000139latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''}
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000140
Georg Brandl9a333a62014-10-29 08:04:27 +0100141
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000142# Options for the coverage checker
143# --------------------------------
144
145# The coverage checker will ignore all modules/functions/classes whose names
146# match any of the following regexes (using re.match).
147coverage_ignore_modules = [
148 r'[T|t][k|K]',
149 r'Tix',
150 r'distutils.*',
151]
152
153coverage_ignore_functions = [
154 'test($|_)',
155]
156
157coverage_ignore_classes = [
158]
159
160# Glob patterns for C source files for C API coverage, relative to this directory.
161coverage_c_path = [
162 '../Include/*.h',
163]
164
165# Regexes to find C items in the source files.
166coverage_c_regexes = {
167 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
168 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
169 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
170}
171
172# The coverage checker will ignore all C items whose names match these regexes
173# (using re.match) -- the keys must be the same as in coverage_c_regexes.
174coverage_ignore_c_items = {
175# 'cfunction': [...]
176}
Georg Brandl9a333a62014-10-29 08:04:27 +0100177
Georg Brandl0ef49662014-10-29 10:57:01 +0100178
179# Options for the link checker
180# ----------------------------
181
182# Ignore certain URLs.
183linkcheck_ignore = [r'https://bugs.python.org/(issue)?\d+',
184 # Ignore PEPs for now, they all have permanent redirects.
185 r'http://www.python.org/dev/peps/pep-\d+']
186
187
Georg Brandl9a333a62014-10-29 08:04:27 +0100188# Options for extensions
189# ----------------------
190
191# Relative filename of the reference count data file.
192refcount_file = 'data/refcounts.dat'