blob: 3bd82b1095235c626711d6081d35996ab2f88369 [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
Georg Brandl116aa622007-08-15 14:28:22 +000041# List of files that shouldn't be included in the build.
Christian Heimes3feef612008-02-11 06:19:17 +000042unused_docs = [
Christian Heimes3feef612008-02-11 06:19:17 +000043 'maclib/scrap',
44 'library/xmllib',
45 'library/xml.etree',
Georg Brandl116aa622007-08-15 14:28:22 +000046]
47
Benjamin Petersonfa0d7032009-06-01 22:42:33 +000048# Ignore .rst in Sphinx its self.
49exclude_trees = ['tools/sphinx']
50
Christian Heimes679db4a2008-01-18 09:56:22 +000051# Relative filename of the reference count data file.
52refcount_file = 'data/refcounts.dat'
53
Georg Brandl116aa622007-08-15 14:28:22 +000054# If true, '()' will be appended to :func: etc. cross-reference text.
55add_function_parentheses = True
56
57# If true, the current module name will be prepended to all description
58# unit titles (such as .. function::).
59add_module_names = True
Christian Heimes2c181612007-12-17 20:04:13 +000060
Georg Brandl64063702008-09-09 19:10:58 +000061# By default, highlight as Python 3.
62highlight_language = 'python3'
63
Georg Brandl90d76ca2014-09-22 21:18:24 +020064needs_sphinx = '1.2'
Larry Hastings3732ed22014-03-15 21:13:56 -070065
Christian Heimes2c181612007-12-17 20:04:13 +000066
67# Options for HTML output
68# -----------------------
69
Georg Brandlab712142012-03-25 20:31:57 +020070html_theme = 'pydoctheme'
Ned Deily14366f32014-09-30 18:41:37 -070071html_theme_path = ['tools']
Georg Brandla0745232010-07-30 11:31:03 +000072html_theme_options = {'collapsiblesidebar': True}
73
Georg Brandlab712142012-03-25 20:31:57 +020074html_short_title = '%s Documentation' % release
75
Christian Heimes2c181612007-12-17 20:04:13 +000076# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
77# using the given strftime format.
78html_last_updated_fmt = '%b %d, %Y'
79
80# If true, SmartyPants will be used to convert quotes and dashes to
81# typographically correct entities.
82html_use_smartypants = True
83
Christian Heimes679db4a2008-01-18 09:56:22 +000084# Custom sidebar templates, filenames relative to this file.
85html_sidebars = {
Georg Brandl45832ea2008-03-12 08:52:43 +000086 'index': 'indexsidebar.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000087}
88
89# Additional templates that should be rendered to pages.
90html_additional_pages = {
Georg Brandl45832ea2008-03-12 08:52:43 +000091 'download': 'download.html',
Christian Heimesa342c012008-04-20 21:01:16 +000092 'index': 'indexcontent.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000093}
94
Georg Brandle7570052008-05-03 20:52:18 +000095# Output an OpenSearch description file.
Georg Brandl014397e2012-04-07 19:24:40 +020096html_use_opensearch = 'http://docs.python.org/' + version
Georg Brandle7570052008-05-03 20:52:18 +000097
98# Additional static files.
Georg Brandl97e9ec62014-09-30 22:51:30 +020099html_static_path = ['tools/static']
Georg Brandle7570052008-05-03 20:52:18 +0000100
Christian Heimes679db4a2008-01-18 09:56:22 +0000101# Output file base name for HTML help builder.
Christian Heimesb558a2e2008-03-02 22:46:37 +0000102htmlhelp_basename = 'python' + release.replace('.', '')
Christian Heimes679db4a2008-01-18 09:56:22 +0000103
Amaury Forgeot d'Arc35c86582008-06-17 21:11:29 +0000104# Split the index
105html_split_index = True
106
Christian Heimes2c181612007-12-17 20:04:13 +0000107
108# Options for LaTeX output
109# ------------------------
110
Christian Heimes679db4a2008-01-18 09:56:22 +0000111# The paper size ('letter' or 'a4').
112latex_paper_size = 'a4'
Christian Heimes2c181612007-12-17 20:04:13 +0000113
Christian Heimes679db4a2008-01-18 09:56:22 +0000114# The font size ('10pt', '11pt' or '12pt').
115latex_font_size = '10pt'
116
117# Grouping the document tree into LaTeX files. List of tuples
118# (source start file, target name, title, author, document class [howto/manual]).
119_stdauthor = r'Guido van Rossum\\Fred L. Drake, Jr., editor'
120latex_documents = [
Christian Heimes292d3512008-02-03 16:51:08 +0000121 ('c-api/index', 'c-api.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000122 'The Python/C API', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700123 ('distributing/index', 'distributing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000124 'Distributing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000125 ('extending/index', 'extending.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000126 'Extending and Embedding Python', _stdauthor, 'manual'),
Larry Hastings3732ed22014-03-15 21:13:56 -0700127 ('installing/index', 'installing.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000128 'Installing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000129 ('library/index', 'library.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000130 'The Python Library Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000131 ('reference/index', 'reference.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000132 'The Python Language Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000133 ('tutorial/index', 'tutorial.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000134 'Python Tutorial', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000135 ('using/index', 'using.tex',
Georg Brandl8d582162010-09-03 22:33:27 +0000136 'Python Setup and Usage', _stdauthor, 'manual'),
Georg Brandle5b5ff42010-11-12 06:19:48 +0000137 ('faq/index', 'faq.tex',
138 'Python Frequently Asked Questions', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000139 ('whatsnew/' + version, 'whatsnew.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000140 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
141]
142# Collect all HOWTOs individually
Christian Heimes292d3512008-02-03 16:51:08 +0000143latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
Benjamin Petersonf608c612008-11-16 18:33:53 +0000144 '', _stdauthor, 'howto')
Christian Heimes679db4a2008-01-18 09:56:22 +0000145 for fn in os.listdir('howto')
146 if fn.endswith('.rst') and fn != 'index.rst')
147
148# Additional stuff for the LaTeX preamble.
149latex_preamble = r'''
150\authoraddress{
151 \strong{Python Software Foundation}\\
152 Email: \email{docs@python.org}
153}
Benjamin Peterson6cadba72008-11-19 22:38:29 +0000154\let\Verbatim=\OriginalVerbatim
155\let\endVerbatim=\endOriginalVerbatim
Christian Heimes679db4a2008-01-18 09:56:22 +0000156'''
157
158# Documents to append as an appendix to all manuals.
Christian Heimes292d3512008-02-03 16:51:08 +0000159latex_appendices = ['glossary', 'about', 'license', 'copyright']
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000160
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000161# Get LaTeX to handle Unicode correctly
Georg Brandl4bf70682010-07-27 18:19:21 +0000162latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''}
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000163
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000164# Options for the coverage checker
165# --------------------------------
166
167# The coverage checker will ignore all modules/functions/classes whose names
168# match any of the following regexes (using re.match).
169coverage_ignore_modules = [
170 r'[T|t][k|K]',
171 r'Tix',
172 r'distutils.*',
173]
174
175coverage_ignore_functions = [
176 'test($|_)',
177]
178
179coverage_ignore_classes = [
180]
181
182# Glob patterns for C source files for C API coverage, relative to this directory.
183coverage_c_path = [
184 '../Include/*.h',
185]
186
187# Regexes to find C items in the source files.
188coverage_c_regexes = {
189 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
190 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
191 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
192}
193
194# The coverage checker will ignore all C items whose names match these regexes
195# (using re.match) -- the keys must be the same as in coverage_c_regexes.
196coverage_ignore_c_items = {
197# 'cfunction': [...]
198}