blob: 8bf52f7f81933f0c28e6a96bce6baa690a1a6a53 [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 Brandlf16fbf92014-09-30 22:51:30 +020011sys.path.append(os.path.abspath('tools'))
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 Brandlf16fbf92014-09-30 22:51:30 +020018templates_path = ['tools']
Georg Brandl56eadd92008-01-27 20:25:12 +000019
Georg Brandl7155a092008-01-16 20:27:56 +000020# General substitutions.
21project = 'Python'
Georg Brandldd76e052008-01-21 20:20:53 +000022copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y')
Georg Brandl7155a092008-01-16 20:27:56 +000023
Georg Brandl8ec7f652007-08-15 14:28:01 +000024# The default replacements for |version| and |release|.
Georg Brandl8ec7f652007-08-15 14:28:01 +000025#
26# The short X.Y version.
27# version = '2.6'
Georg Brandl8ec7f652007-08-15 14:28:01 +000028# The full version, including alpha/beta/rc tags.
29# release = '2.6a0'
Georg Brandldd76e052008-01-21 20:20:53 +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 Brandl8ec7f652007-08-15 14:28:01 +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 Brandl8ec7f652007-08-15 14:28:01 +000042# List of files that shouldn't be included in the build.
Georg Brandl3e46d7c2014-09-21 00:42:40 +020043exclude_patterns = [
44 'maclib/scrap.rst',
45 'library/xmllib.rst',
46 'library/xml.etree.rst',
Georg Brandl8ec7f652007-08-15 14:28:01 +000047]
48
Benjamin Petersoncadaf552009-05-17 14:16:29 +000049# Ignore .rst in Sphinx its self.
Benjamin Peterson56054162009-05-17 16:59:27 +000050exclude_trees = ['tools/sphinx']
Benjamin Petersoncadaf552009-05-17 14:16:29 +000051
Georg Brandl7155a092008-01-16 20:27:56 +000052# Relative filename of the reference count data file.
53refcount_file = 'data/refcounts.dat'
54
Georg Brandl8ec7f652007-08-15 14:28:01 +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
Georg Brandleee1fc52007-12-16 19:36:51 +000061
Georg Brandl14b5a4d2014-10-02 08:26:26 +020062# Require Sphinx 1.2 for build.
63needs_sphinx = '1.2'
64
Georg Brandleee1fc52007-12-16 19:36:51 +000065
66# Options for HTML output
67# -----------------------
68
Georg Brandl27a49182012-01-21 08:58:22 +010069html_theme = 'default'
70html_theme_options = {'collapsiblesidebar': True}
71
Georg Brandleee1fc52007-12-16 19:36:51 +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
Georg Brandl7155a092008-01-16 20:27:56 +000080# Custom sidebar templates, filenames relative to this file.
81html_sidebars = {
Georg Brandl5bb647d2008-03-09 18:18:30 +000082 'index': 'indexsidebar.html',
Georg Brandl7155a092008-01-16 20:27:56 +000083}
84
85# Additional templates that should be rendered to pages.
86html_additional_pages = {
Georg Brandl5bb647d2008-03-09 18:18:30 +000087 'download': 'download.html',
Georg Brandl1df986b2008-04-19 21:28:38 +000088 'index': 'indexcontent.html',
Georg Brandl7155a092008-01-16 20:27:56 +000089}
90
Georg Brandl4f1f36b2008-04-27 20:03:05 +000091# Output an OpenSearch description file.
Georg Brandl27a49182012-01-21 08:58:22 +010092html_use_opensearch = 'http://docs.python.org/'
Georg Brandl4f1f36b2008-04-27 20:03:05 +000093
94# Additional static files.
Georg Brandlf16fbf92014-09-30 22:51:30 +020095html_static_path = ['tools/static']
Georg Brandl4f1f36b2008-04-27 20:03:05 +000096
Georg Brandl7155a092008-01-16 20:27:56 +000097# Output file base name for HTML help builder.
Georg Brandl47dff402008-03-02 06:45:40 +000098htmlhelp_basename = 'python' + release.replace('.', '')
Georg Brandl7155a092008-01-16 20:27:56 +000099
Georg Brandl5c15aba2008-06-17 09:01:35 +0000100# Split the index
101html_split_index = True
102
Georg Brandleee1fc52007-12-16 19:36:51 +0000103
104# Options for LaTeX output
105# ------------------------
106
Georg Brandl7155a092008-01-16 20:27:56 +0000107# The paper size ('letter' or 'a4').
108latex_paper_size = 'a4'
Georg Brandleee1fc52007-12-16 19:36:51 +0000109
Georg Brandl7155a092008-01-16 20:27:56 +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 = [
Georg Brandla51f61b2008-02-01 20:45:33 +0000117 ('c-api/index', 'c-api.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000118 'The Python/C API', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000119 ('distutils/index', 'distutils.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000120 'Distributing Python Modules', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000121 ('extending/index', 'extending.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000122 'Extending and Embedding Python', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000123 ('install/index', 'install.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000124 'Installing Python Modules', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000125 ('library/index', 'library.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000126 'The Python Library Reference', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000127 ('reference/index', 'reference.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000128 'The Python Language Reference', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000129 ('tutorial/index', 'tutorial.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000130 'Python Tutorial', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000131 ('using/index', 'using.tex',
Georg Brandl21946af2010-10-06 09:28:45 +0000132 'Python Setup and Usage', _stdauthor, 'manual'),
Georg Brandl3b85b9b2010-11-26 08:20:18 +0000133 ('faq/index', 'faq.tex',
134 'Python Frequently Asked Questions', _stdauthor, 'manual'),
Georg Brandla51f61b2008-02-01 20:45:33 +0000135 ('whatsnew/' + version, 'whatsnew.tex',
Georg Brandl7155a092008-01-16 20:27:56 +0000136 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
137]
138# Collect all HOWTOs individually
Georg Brandla51f61b2008-02-01 20:45:33 +0000139latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
Georg Brandl012a1ff2008-11-08 11:47:44 +0000140 '', _stdauthor, 'howto')
Georg Brandl7155a092008-01-16 20:27:56 +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}
Georg Brandl65e8fc72008-11-19 07:59:09 +0000150\let\Verbatim=\OriginalVerbatim
151\let\endVerbatim=\endOriginalVerbatim
Georg Brandl7155a092008-01-16 20:27:56 +0000152'''
153
154# Documents to append as an appendix to all manuals.
Georg Brandla51f61b2008-02-01 20:45:33 +0000155latex_appendices = ['glossary', 'about', 'license', 'copyright']
Georg Brandl17048282008-02-23 18:47:04 +0000156
Benjamin Peterson626c0aa2009-08-24 17:42:36 +0000157# Get LaTeX to handle Unicode correctly
Georg Brandl27a49182012-01-21 08:58:22 +0100158latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''}
Benjamin Peterson626c0aa2009-08-24 17:42:36 +0000159
Georg Brandl17048282008-02-23 18:47:04 +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}