blob: b9d9ab5ac80a9eb298dde20f4b53770c0f3ea406 [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001# -*- coding: utf-8 -*-
2#
3# Python documentation build configuration file
4#
Christian Heimes679db4a2008-01-18 09:56:22 +00005# This file is execfile()d with the current directory set to its containing dir.
6#
Georg Brandl116aa622007-08-15 14:28:22 +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).
Christian Heimes2c181612007-12-17 20:04:13 +00009
Georg Brandl86def6c2008-01-21 20:36:10 +000010import sys, os, time
Christian Heimes33fe8092008-04-13 13:53:33 +000011sys.path.append(os.path.abspath('tools/sphinxext'))
Georg Brandl86def6c2008-01-21 20:36:10 +000012
Christian Heimes2c181612007-12-17 20:04:13 +000013# General configuration
14# ---------------------
Georg Brandl116aa622007-08-15 14:28:22 +000015
Christian Heimesfe337bf2008-03-23 21:54:12 +000016extensions = ['sphinx.ext.refcounting', 'sphinx.ext.coverage',
Martin v. Löwis5680d0c2008-04-10 03:06:53 +000017 'sphinx.ext.doctest', 'pyspecific']
Georg Brandl45832ea2008-03-12 08:52:43 +000018templates_path = ['tools/sphinxext']
Christian Heimes26855632008-01-27 23:50:43 +000019
Christian Heimes679db4a2008-01-18 09:56:22 +000020# General substitutions.
21project = 'Python'
Georg Brandl86def6c2008-01-21 20:36:10 +000022copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y')
Christian Heimes679db4a2008-01-18 09:56:22 +000023
Georg Brandl116aa622007-08-15 14:28:22 +000024# The default replacements for |version| and |release|.
Georg Brandl116aa622007-08-15 14:28:22 +000025#
26# The short X.Y version.
27# version = '2.6'
Georg Brandl116aa622007-08-15 14:28:22 +000028# The full version, including alpha/beta/rc tags.
29# release = '2.6a0'
Georg Brandl86def6c2008-01-21 20:36:10 +000030
31# We look for the Include/patchlevel.h file in the current Python source tree
32# and replace the values accordingly.
33import patchlevel
34version, release = patchlevel.get_version_info()
Georg Brandl116aa622007-08-15 14:28:22 +000035
36# There are two options for replacing |today|: either, you set today to some
37# non-false value, then it is used:
38today = ''
39# Else, today_fmt is used as the format for a strftime call.
40today_fmt = '%B %d, %Y'
41
Georg Brandl116aa622007-08-15 14:28:22 +000042# List of files that shouldn't be included in the build.
Christian Heimes3feef612008-02-11 06:19:17 +000043unused_docs = [
Christian Heimes3feef612008-02-11 06:19:17 +000044 'maclib/scrap',
45 'library/xmllib',
46 'library/xml.etree',
Georg Brandl116aa622007-08-15 14:28:22 +000047]
48
Benjamin Petersonfa0d7032009-06-01 22:42:33 +000049# Ignore .rst in Sphinx its self.
50exclude_trees = ['tools/sphinx']
51
Christian Heimes679db4a2008-01-18 09:56:22 +000052# Relative filename of the reference count data file.
53refcount_file = 'data/refcounts.dat'
54
Georg Brandl116aa622007-08-15 14:28:22 +000055# If true, '()' will be appended to :func: etc. cross-reference text.
56add_function_parentheses = True
57
58# If true, the current module name will be prepended to all description
59# unit titles (such as .. function::).
60add_module_names = True
Christian Heimes2c181612007-12-17 20:04:13 +000061
Georg Brandl64063702008-09-09 19:10:58 +000062# By default, highlight as Python 3.
63highlight_language = 'python3'
64
Christian Heimes2c181612007-12-17 20:04:13 +000065
66# Options for HTML output
67# -----------------------
68
Georg Brandla0745232010-07-30 11:31:03 +000069html_theme = 'default'
70html_theme_options = {'collapsiblesidebar': True}
71
Christian Heimes2c181612007-12-17 20:04:13 +000072# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
73# using the given strftime format.
74html_last_updated_fmt = '%b %d, %Y'
75
76# If true, SmartyPants will be used to convert quotes and dashes to
77# typographically correct entities.
78html_use_smartypants = True
79
Christian Heimes679db4a2008-01-18 09:56:22 +000080# Custom sidebar templates, filenames relative to this file.
81html_sidebars = {
Georg Brandl45832ea2008-03-12 08:52:43 +000082 'index': 'indexsidebar.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000083}
84
85# Additional templates that should be rendered to pages.
86html_additional_pages = {
Georg Brandl45832ea2008-03-12 08:52:43 +000087 'download': 'download.html',
Christian Heimesa342c012008-04-20 21:01:16 +000088 'index': 'indexcontent.html',
Christian Heimes679db4a2008-01-18 09:56:22 +000089}
90
Georg Brandle7570052008-05-03 20:52:18 +000091# Output an OpenSearch description file.
Benjamin Petersonda181252009-10-01 00:57:32 +000092html_use_opensearch = 'http://docs.python.org/dev/py3k'
Georg Brandle7570052008-05-03 20:52:18 +000093
94# Additional static files.
95html_static_path = ['tools/sphinxext/static']
96
Christian Heimes679db4a2008-01-18 09:56:22 +000097# Output file base name for HTML help builder.
Christian Heimesb558a2e2008-03-02 22:46:37 +000098htmlhelp_basename = 'python' + release.replace('.', '')
Christian Heimes679db4a2008-01-18 09:56:22 +000099
Amaury Forgeot d'Arc35c86582008-06-17 21:11:29 +0000100# Split the index
101html_split_index = True
102
Christian Heimes2c181612007-12-17 20:04:13 +0000103
104# Options for LaTeX output
105# ------------------------
106
Christian Heimes679db4a2008-01-18 09:56:22 +0000107# The paper size ('letter' or 'a4').
108latex_paper_size = 'a4'
Christian Heimes2c181612007-12-17 20:04:13 +0000109
Christian Heimes679db4a2008-01-18 09:56:22 +0000110# The font size ('10pt', '11pt' or '12pt').
111latex_font_size = '10pt'
112
113# Grouping the document tree into LaTeX files. List of tuples
114# (source start file, target name, title, author, document class [howto/manual]).
115_stdauthor = r'Guido van Rossum\\Fred L. Drake, Jr., editor'
116latex_documents = [
Christian Heimes292d3512008-02-03 16:51:08 +0000117 ('c-api/index', 'c-api.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000118 'The Python/C API', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000119 ('distutils/index', 'distutils.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000120 'Distributing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000121 ('documenting/index', 'documenting.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000122 'Documenting Python', 'Georg Brandl', 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000123 ('extending/index', 'extending.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000124 'Extending and Embedding Python', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000125 ('install/index', 'install.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000126 'Installing Python Modules', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000127 ('library/index', 'library.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000128 'The Python Library Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000129 ('reference/index', 'reference.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000130 'The Python Language Reference', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000131 ('tutorial/index', 'tutorial.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000132 'Python Tutorial', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000133 ('using/index', 'using.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000134 'Using Python', _stdauthor, 'manual'),
Christian Heimes292d3512008-02-03 16:51:08 +0000135 ('whatsnew/' + version, 'whatsnew.tex',
Christian Heimes679db4a2008-01-18 09:56:22 +0000136 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
137]
138# Collect all HOWTOs individually
Christian Heimes292d3512008-02-03 16:51:08 +0000139latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
Benjamin Petersonf608c612008-11-16 18:33:53 +0000140 '', _stdauthor, 'howto')
Christian Heimes679db4a2008-01-18 09:56:22 +0000141 for fn in os.listdir('howto')
142 if fn.endswith('.rst') and fn != 'index.rst')
143
144# Additional stuff for the LaTeX preamble.
145latex_preamble = r'''
146\authoraddress{
147 \strong{Python Software Foundation}\\
148 Email: \email{docs@python.org}
149}
Benjamin Peterson6cadba72008-11-19 22:38:29 +0000150\let\Verbatim=\OriginalVerbatim
151\let\endVerbatim=\endOriginalVerbatim
Christian Heimes679db4a2008-01-18 09:56:22 +0000152'''
153
154# Documents to append as an appendix to all manuals.
Christian Heimes292d3512008-02-03 16:51:08 +0000155latex_appendices = ['glossary', 'about', 'license', 'copyright']
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000156
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000157# Get LaTeX to handle Unicode correctly
Georg Brandl4bf70682010-07-27 18:19:21 +0000158latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''}
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000159
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000160# Options for the coverage checker
161# --------------------------------
162
163# The coverage checker will ignore all modules/functions/classes whose names
164# match any of the following regexes (using re.match).
165coverage_ignore_modules = [
166 r'[T|t][k|K]',
167 r'Tix',
168 r'distutils.*',
169]
170
171coverage_ignore_functions = [
172 'test($|_)',
173]
174
175coverage_ignore_classes = [
176]
177
178# Glob patterns for C source files for C API coverage, relative to this directory.
179coverage_c_path = [
180 '../Include/*.h',
181]
182
183# Regexes to find C items in the source files.
184coverage_c_regexes = {
185 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
186 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
187 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
188}
189
190# The coverage checker will ignore all C items whose names match these regexes
191# (using re.match) -- the keys must be the same as in coverage_c_regexes.
192coverage_ignore_c_items = {
193# 'cfunction': [...]
194}