blob: d663d827d3520546e111f03e37656a7802a5e32e [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 Brandl97e9ec62014-09-30 22:51:30 +020010sys.path.append(os.path.abspath('tools'))
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']
Georg Brandl97e9ec62014-09-30 22:51:30 +020017templates_path = ['tools']
Christian Heimes26855632008-01-27 23:50:43 +000018
Christian Heimes679db4a2008-01-18 09:56:22 +000019# General substitutions.
20project = 'Python'
Georg Brandl86def6c2008-01-21 20:36:10 +000021copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y')
Christian Heimes679db4a2008-01-18 09:56:22 +000022
Georg Brandl116aa622007-08-15 14:28:22 +000023# The default replacements for |version| and |release|.
Georg Brandl116aa622007-08-15 14:28:22 +000024#
25# The short X.Y version.
26# version = '2.6'
Georg Brandl116aa622007-08-15 14:28:22 +000027# The full version, including alpha/beta/rc tags.
28# release = '2.6a0'
Georg Brandl86def6c2008-01-21 20:36:10 +000029
30# 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
Benjamin Petersonfa0d7032009-06-01 22:42:33 +000041# Ignore .rst in Sphinx its self.
42exclude_trees = ['tools/sphinx']
43
Christian Heimes679db4a2008-01-18 09:56:22 +000044# Relative filename of the reference count data file.
45refcount_file = 'data/refcounts.dat'
46
Georg Brandl116aa622007-08-15 14:28:22 +000047# If true, '()' will be appended to :func: etc. cross-reference text.
48add_function_parentheses = True
49
50# If true, the current module name will be prepended to all description
51# unit titles (such as .. function::).
52add_module_names = True
Christian Heimes2c181612007-12-17 20:04:13 +000053
Georg Brandl64063702008-09-09 19:10:58 +000054# By default, highlight as Python 3.
55highlight_language = 'python3'
56
Georg Brandlea7ec2b2014-10-02 08:27:05 +020057# Require Sphinx 1.2 for build.
Georg Brandl90d76ca2014-09-22 21:18:24 +020058needs_sphinx = '1.2'
Larry Hastings3732ed22014-03-15 21:13:56 -070059
Christian Heimes2c181612007-12-17 20:04:13 +000060
61# Options for HTML output
62# -----------------------
63
Georg Brandlab712142012-03-25 20:31:57 +020064html_theme = 'pydoctheme'
Ned Deily14366f32014-09-30 18:41:37 -070065html_theme_path = ['tools']
Georg Brandla0745232010-07-30 11:31:03 +000066html_theme_options = {'collapsiblesidebar': True}
67
Georg Brandlab712142012-03-25 20:31:57 +020068html_short_title = '%s Documentation' % release
69
Christian Heimes2c181612007-12-17 20:04:13 +000070# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
71# using the given strftime format.
72html_last_updated_fmt = '%b %d, %Y'
73
74# If true, SmartyPants will be used to convert quotes and dashes to
75# typographically correct entities.
76html_use_smartypants = True
77
Christian Heimes679db4a2008-01-18 09:56:22 +000078# Custom sidebar templates, filenames relative to this file.
79html_sidebars = {
Georg Brandl45832ea2008-03-12 08:52:43 +000080 'index': 'indexsidebar.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000081}
82
83# Additional templates that should be rendered to pages.
84html_additional_pages = {
Georg Brandl45832ea2008-03-12 08:52:43 +000085 'download': 'download.html',
Christian Heimesa342c012008-04-20 21:01:16 +000086 'index': 'indexcontent.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000087}
88
Georg Brandle7570052008-05-03 20:52:18 +000089# Output an OpenSearch description file.
Georg Brandl014397e2012-04-07 19:24:40 +020090html_use_opensearch = 'http://docs.python.org/' + version
Georg Brandle7570052008-05-03 20:52:18 +000091
92# Additional static files.
Georg Brandl97e9ec62014-09-30 22:51:30 +020093html_static_path = ['tools/static']
Georg Brandle7570052008-05-03 20:52:18 +000094
Christian Heimes679db4a2008-01-18 09:56:22 +000095# Output file base name for HTML help builder.
Christian Heimesb558a2e2008-03-02 22:46:37 +000096htmlhelp_basename = 'python' + release.replace('.', '')
Christian Heimes679db4a2008-01-18 09:56:22 +000097
Amaury Forgeot d'Arc35c86582008-06-17 21:11:29 +000098# Split the index
99html_split_index = True
100
Christian Heimes2c181612007-12-17 20:04:13 +0000101
102# Options for LaTeX output
103# ------------------------
104
Christian Heimes679db4a2008-01-18 09:56:22 +0000105# The paper size ('letter' or 'a4').
106latex_paper_size = 'a4'
Christian Heimes2c181612007-12-17 20:04:13 +0000107
Christian Heimes679db4a2008-01-18 09:56:22 +0000108# The font size ('10pt', '11pt' or '12pt').
109latex_font_size = '10pt'
110
111# Grouping the document tree into LaTeX files. List of tuples
112# (source start file, target name, title, author, document class [howto/manual]).
113_stdauthor = r'Guido van Rossum\\Fred L. Drake, Jr., editor'
114latex_documents = [
Christian Heimes292d3512008-02-03 16:51:08 +0000115 ('c-api/index', 'c-api.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000116 'The Python/C API', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700117 ('distributing/index', 'distributing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000118 'Distributing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000119 ('extending/index', 'extending.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000120 'Extending and Embedding Python', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700121 ('installing/index', 'installing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000122 'Installing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000123 ('library/index', 'library.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000124 'The Python Library Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000125 ('reference/index', 'reference.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000126 'The Python Language Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000127 ('tutorial/index', 'tutorial.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000128 'Python Tutorial', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000129 ('using/index', 'using.tex',
Georg Brandl8d582162010-09-03 22:33:27 +0000130 'Python Setup and Usage', _stdauthor, 'manual'),
Georg Brandle5b5ff42010-11-12 06:19:48 +0000131 ('faq/index', 'faq.tex',
132 'Python Frequently Asked Questions', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000133 ('whatsnew/' + version, 'whatsnew.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000134 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
135]
136# Collect all HOWTOs individually
Christian Heimes292d3512008-02-03 16:51:08 +0000137latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
Benjamin Petersonf608c612008-11-16 18:33:53 +0000138 '', _stdauthor, 'howto')
Christian Heimes679db4a2008-01-18 09:56:22 +0000139 for fn in os.listdir('howto')
140 if fn.endswith('.rst') and fn != 'index.rst')
141
142# Additional stuff for the LaTeX preamble.
143latex_preamble = r'''
144\authoraddress{
145 \strong{Python Software Foundation}\\
146 Email: \email{docs@python.org}
147}
Benjamin Peterson6cadba72008-11-19 22:38:29 +0000148\let\Verbatim=\OriginalVerbatim
149\let\endVerbatim=\endOriginalVerbatim
Christian Heimes679db4a2008-01-18 09:56:22 +0000150'''
151
152# Documents to append as an appendix to all manuals.
Christian Heimes292d3512008-02-03 16:51:08 +0000153latex_appendices = ['glossary', 'about', 'license', 'copyright']
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000154
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000155# Get LaTeX to handle Unicode correctly
Georg Brandl4bf70682010-07-27 18:19:21 +0000156latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''}
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000157
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000158# Options for the coverage checker
159# --------------------------------
160
161# The coverage checker will ignore all modules/functions/classes whose names
162# match any of the following regexes (using re.match).
163coverage_ignore_modules = [
164 r'[T|t][k|K]',
165 r'Tix',
166 r'distutils.*',
167]
168
169coverage_ignore_functions = [
170 'test($|_)',
171]
172
173coverage_ignore_classes = [
174]
175
176# Glob patterns for C source files for C API coverage, relative to this directory.
177coverage_c_path = [
178 '../Include/*.h',
179]
180
181# Regexes to find C items in the source files.
182coverage_c_regexes = {
183 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
184 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
185 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
186}
187
188# The coverage checker will ignore all C items whose names match these regexes
189# (using re.match) -- the keys must be the same as in coverage_c_regexes.
190coverage_ignore_c_items = {
191# 'cfunction': [...]
192}