Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 1 | # |
| 2 | # Python documentation build configuration file |
| 3 | # |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 4 | # This file is execfile()d with the current directory set to its containing dir. |
| 5 | # |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 6 | # 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 Heimes | 2c18161 | 2007-12-17 20:04:13 +0000 | [diff] [blame] | 8 | |
Georg Brandl | 86def6c | 2008-01-21 20:36:10 +0000 | [diff] [blame] | 9 | import sys, os, time |
Georg Brandl | e039029 | 2014-10-29 08:07:37 +0100 | [diff] [blame] | 10 | sys.path.append(os.path.abspath('tools/extensions')) |
Marco Buttu | 909a6f6 | 2017-03-18 17:59:33 +0100 | [diff] [blame] | 11 | sys.path.append(os.path.abspath('includes')) |
Georg Brandl | 86def6c | 2008-01-21 20:36:10 +0000 | [diff] [blame] | 12 | |
Christian Heimes | 2c18161 | 2007-12-17 20:04:13 +0000 | [diff] [blame] | 13 | # General configuration |
| 14 | # --------------------- |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 15 | |
Georg Brandl | 5c01d99 | 2013-10-12 19:54:30 +0200 | [diff] [blame] | 16 | extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest', |
| 17 | 'pyspecific', 'c_annotations'] |
Christian Heimes | 2685563 | 2008-01-27 23:50:43 +0000 | [diff] [blame] | 18 | |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 19 | # General substitutions. |
| 20 | project = 'Python' |
Berker Peksag | 2ec1bee | 2016-04-24 03:21:13 +0300 | [diff] [blame] | 21 | copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y') |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 22 | |
Georg Brandl | 86def6c | 2008-01-21 20:36:10 +0000 | [diff] [blame] | 23 | # We look for the Include/patchlevel.h file in the current Python source tree |
| 24 | # and replace the values accordingly. |
| 25 | import patchlevel |
| 26 | version, release = patchlevel.get_version_info() |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 27 | |
| 28 | # There are two options for replacing |today|: either, you set today to some |
| 29 | # non-false value, then it is used: |
| 30 | today = '' |
| 31 | # Else, today_fmt is used as the format for a strftime call. |
| 32 | today_fmt = '%B %d, %Y' |
| 33 | |
Georg Brandl | 6406370 | 2008-09-09 19:10:58 +0000 | [diff] [blame] | 34 | # By default, highlight as Python 3. |
| 35 | highlight_language = 'python3' |
| 36 | |
Georg Brandl | ea7ec2b | 2014-10-02 08:27:05 +0200 | [diff] [blame] | 37 | # Require Sphinx 1.2 for build. |
Georg Brandl | 90d76ca | 2014-09-22 21:18:24 +0200 | [diff] [blame] | 38 | needs_sphinx = '1.2' |
Larry Hastings | 3732ed2 | 2014-03-15 21:13:56 -0700 | [diff] [blame] | 39 | |
Senthil Kumaran | 889f914 | 2016-06-04 22:22:26 -0700 | [diff] [blame] | 40 | # Ignore any .rst files in the venv/ directory. |
Ned Deily | 6129250 | 2017-10-12 16:04:57 -0400 | [diff] [blame] | 41 | venvdir = os.getenv('VENVDIR', 'venv') |
| 42 | exclude_patterns = [venvdir+'/*', 'README.rst'] |
Brett Cannon | 9b16666 | 2015-03-30 15:35:37 -0400 | [diff] [blame] | 43 | |
Christian Heimes | 2c18161 | 2007-12-17 20:04:13 +0000 | [diff] [blame] | 44 | |
| 45 | # Options for HTML output |
| 46 | # ----------------------- |
| 47 | |
Georg Brandl | 9a333a6 | 2014-10-29 08:04:27 +0100 | [diff] [blame] | 48 | # Use our custom theme. |
Yury Selivanov | 6aeda91 | 2015-07-01 21:06:59 -0400 | [diff] [blame] | 49 | html_theme = 'pydoctheme' |
Ned Deily | 14366f3 | 2014-09-30 18:41:37 -0700 | [diff] [blame] | 50 | html_theme_path = ['tools'] |
Georg Brandl | a074523 | 2010-07-30 11:31:03 +0000 | [diff] [blame] | 51 | html_theme_options = {'collapsiblesidebar': True} |
| 52 | |
Georg Brandl | 9a333a6 | 2014-10-29 08:04:27 +0100 | [diff] [blame] | 53 | # Short title used e.g. for <title> HTML tags. |
Georg Brandl | ab71214 | 2012-03-25 20:31:57 +0200 | [diff] [blame] | 54 | html_short_title = '%s Documentation' % release |
| 55 | |
Christian Heimes | 2c18161 | 2007-12-17 20:04:13 +0000 | [diff] [blame] | 56 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
| 57 | # using the given strftime format. |
| 58 | html_last_updated_fmt = '%b %d, %Y' |
| 59 | |
Georg Brandl | 9a333a6 | 2014-10-29 08:04:27 +0100 | [diff] [blame] | 60 | # Path to find HTML templates. |
Georg Brandl | a1f8486 | 2014-10-29 08:11:46 +0100 | [diff] [blame] | 61 | templates_path = ['tools/templates'] |
Christian Heimes | 2c18161 | 2007-12-17 20:04:13 +0000 | [diff] [blame] | 62 | |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 63 | # Custom sidebar templates, filenames relative to this file. |
| 64 | html_sidebars = { |
Zachary Ware | a3090a4 | 2016-09-09 13:11:27 -0700 | [diff] [blame] | 65 | # Defaults taken from http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars |
| 66 | # Removes the quick search block |
| 67 | '**': ['localtoc.html', 'relations.html', 'customsourcelink.html'], |
| 68 | 'index': ['indexsidebar.html'], |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | # Additional templates that should be rendered to pages. |
| 72 | html_additional_pages = { |
Georg Brandl | 45832ea | 2008-03-12 08:52:43 +0000 | [diff] [blame] | 73 | 'download': 'download.html', |
Christian Heimes | a342c01 | 2008-04-20 21:01:16 +0000 | [diff] [blame] | 74 | 'index': 'indexcontent.html', |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 75 | } |
| 76 | |
Georg Brandl | e757005 | 2008-05-03 20:52:18 +0000 | [diff] [blame] | 77 | # Output an OpenSearch description file. |
Georg Brandl | e73778c | 2014-10-29 08:36:35 +0100 | [diff] [blame] | 78 | html_use_opensearch = 'https://docs.python.org/' + version |
Georg Brandl | e757005 | 2008-05-03 20:52:18 +0000 | [diff] [blame] | 79 | |
| 80 | # Additional static files. |
Georg Brandl | 97e9ec6 | 2014-09-30 22:51:30 +0200 | [diff] [blame] | 81 | html_static_path = ['tools/static'] |
Georg Brandl | e757005 | 2008-05-03 20:52:18 +0000 | [diff] [blame] | 82 | |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 83 | # Output file base name for HTML help builder. |
Christian Heimes | b558a2e | 2008-03-02 22:46:37 +0000 | [diff] [blame] | 84 | htmlhelp_basename = 'python' + release.replace('.', '') |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 85 | |
Amaury Forgeot d'Arc | 35c8658 | 2008-06-17 21:11:29 +0000 | [diff] [blame] | 86 | # Split the index |
| 87 | html_split_index = True |
| 88 | |
Christian Heimes | 2c18161 | 2007-12-17 20:04:13 +0000 | [diff] [blame] | 89 | |
| 90 | # Options for LaTeX output |
| 91 | # ------------------------ |
| 92 | |
Julien Palard | 7324b5c | 2017-12-02 23:24:39 +0100 | [diff] [blame] | 93 | latex_engine = 'xelatex' |
| 94 | |
Ryan Gonzalez | e7ffb99 | 2017-02-10 22:47:37 -0600 | [diff] [blame] | 95 | # Get LaTeX to handle Unicode correctly |
François Magimel | da9b4cf | 2017-09-22 19:16:57 +0200 | [diff] [blame] | 96 | latex_elements = { |
François Magimel | da9b4cf | 2017-09-22 19:16:57 +0200 | [diff] [blame] | 97 | } |
Ryan Gonzalez | e7ffb99 | 2017-02-10 22:47:37 -0600 | [diff] [blame] | 98 | |
| 99 | # Additional stuff for the LaTeX preamble. |
| 100 | latex_elements['preamble'] = r''' |
| 101 | \authoraddress{ |
François Magimel | da9b4cf | 2017-09-22 19:16:57 +0200 | [diff] [blame] | 102 | \sphinxstrong{Python Software Foundation}\\ |
| 103 | Email: \sphinxemail{docs@python.org} |
Ryan Gonzalez | e7ffb99 | 2017-02-10 22:47:37 -0600 | [diff] [blame] | 104 | } |
| 105 | \let\Verbatim=\OriginalVerbatim |
| 106 | \let\endVerbatim=\endOriginalVerbatim |
| 107 | ''' |
| 108 | |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 109 | # The paper size ('letter' or 'a4'). |
Ryan Gonzalez | e7ffb99 | 2017-02-10 22:47:37 -0600 | [diff] [blame] | 110 | latex_elements['papersize'] = 'a4' |
Christian Heimes | 2c18161 | 2007-12-17 20:04:13 +0000 | [diff] [blame] | 111 | |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 112 | # The font size ('10pt', '11pt' or '12pt'). |
François Magimel | da9b4cf | 2017-09-22 19:16:57 +0200 | [diff] [blame] | 113 | latex_elements['pointsize'] = '10pt' |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 114 | |
| 115 | # Grouping the document tree into LaTeX files. List of tuples |
| 116 | # (source start file, target name, title, author, document class [howto/manual]). |
Georg Brandl | 9ab33ea | 2014-10-29 08:14:04 +0100 | [diff] [blame] | 117 | _stdauthor = r'Guido van Rossum\\and the Python development team' |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 118 | latex_documents = [ |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 119 | ('c-api/index', 'c-api.tex', |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 120 | 'The Python/C API', _stdauthor, 'manual'), |
Larry Hastings | 3732ed2 | 2014-03-15 21:13:56 -0700 | [diff] [blame] | 121 | ('distributing/index', 'distributing.tex', |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 122 | 'Distributing Python Modules', _stdauthor, 'manual'), |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 123 | ('extending/index', 'extending.tex', |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 124 | 'Extending and Embedding Python', _stdauthor, 'manual'), |
Larry Hastings | 3732ed2 | 2014-03-15 21:13:56 -0700 | [diff] [blame] | 125 | ('installing/index', 'installing.tex', |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 126 | 'Installing Python Modules', _stdauthor, 'manual'), |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 127 | ('library/index', 'library.tex', |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 128 | 'The Python Library Reference', _stdauthor, 'manual'), |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 129 | ('reference/index', 'reference.tex', |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 130 | 'The Python Language Reference', _stdauthor, 'manual'), |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 131 | ('tutorial/index', 'tutorial.tex', |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 132 | 'Python Tutorial', _stdauthor, 'manual'), |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 133 | ('using/index', 'using.tex', |
Georg Brandl | 8d58216 | 2010-09-03 22:33:27 +0000 | [diff] [blame] | 134 | 'Python Setup and Usage', _stdauthor, 'manual'), |
Georg Brandl | e5b5ff4 | 2010-11-12 06:19:48 +0000 | [diff] [blame] | 135 | ('faq/index', 'faq.tex', |
| 136 | 'Python Frequently Asked Questions', _stdauthor, 'manual'), |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 137 | ('whatsnew/' + version, 'whatsnew.tex', |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 138 | 'What\'s New in Python', 'A. M. Kuchling', 'howto'), |
| 139 | ] |
| 140 | # Collect all HOWTOs individually |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 141 | latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', |
Benjamin Peterson | f608c61 | 2008-11-16 18:33:53 +0000 | [diff] [blame] | 142 | '', _stdauthor, 'howto') |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 143 | for fn in os.listdir('howto') |
| 144 | if fn.endswith('.rst') and fn != 'index.rst') |
| 145 | |
Christian Heimes | 679db4a | 2008-01-18 09:56:22 +0000 | [diff] [blame] | 146 | # Documents to append as an appendix to all manuals. |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 147 | latex_appendices = ['glossary', 'about', 'license', 'copyright'] |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 148 | |
Senthil Kumaran | cbe6356 | 2016-01-08 01:01:56 -0800 | [diff] [blame] | 149 | # Options for Epub output |
| 150 | # ----------------------- |
| 151 | |
| 152 | epub_author = 'Python Documentation Authors' |
| 153 | epub_publisher = 'Python Software Foundation' |
Georg Brandl | 9a333a6 | 2014-10-29 08:04:27 +0100 | [diff] [blame] | 154 | |
Christian Heimes | d3eb5a15 | 2008-02-24 00:38:49 +0000 | [diff] [blame] | 155 | # Options for the coverage checker |
| 156 | # -------------------------------- |
| 157 | |
| 158 | # The coverage checker will ignore all modules/functions/classes whose names |
| 159 | # match any of the following regexes (using re.match). |
| 160 | coverage_ignore_modules = [ |
| 161 | r'[T|t][k|K]', |
| 162 | r'Tix', |
| 163 | r'distutils.*', |
| 164 | ] |
| 165 | |
| 166 | coverage_ignore_functions = [ |
| 167 | 'test($|_)', |
| 168 | ] |
| 169 | |
| 170 | coverage_ignore_classes = [ |
| 171 | ] |
| 172 | |
| 173 | # Glob patterns for C source files for C API coverage, relative to this directory. |
| 174 | coverage_c_path = [ |
| 175 | '../Include/*.h', |
| 176 | ] |
| 177 | |
| 178 | # Regexes to find C items in the source files. |
| 179 | coverage_c_regexes = { |
| 180 | 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'), |
| 181 | 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'), |
| 182 | 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'), |
| 183 | } |
| 184 | |
| 185 | # The coverage checker will ignore all C items whose names match these regexes |
| 186 | # (using re.match) -- the keys must be the same as in coverage_c_regexes. |
| 187 | coverage_ignore_c_items = { |
| 188 | # 'cfunction': [...] |
| 189 | } |
Georg Brandl | 9a333a6 | 2014-10-29 08:04:27 +0100 | [diff] [blame] | 190 | |
Georg Brandl | 0ef4966 | 2014-10-29 10:57:01 +0100 | [diff] [blame] | 191 | |
| 192 | # Options for the link checker |
| 193 | # ---------------------------- |
| 194 | |
| 195 | # Ignore certain URLs. |
| 196 | linkcheck_ignore = [r'https://bugs.python.org/(issue)?\d+', |
| 197 | # Ignore PEPs for now, they all have permanent redirects. |
| 198 | r'http://www.python.org/dev/peps/pep-\d+'] |
| 199 | |
| 200 | |
Georg Brandl | 9a333a6 | 2014-10-29 08:04:27 +0100 | [diff] [blame] | 201 | # Options for extensions |
| 202 | # ---------------------- |
| 203 | |
| 204 | # Relative filename of the reference count data file. |
| 205 | refcount_file = 'data/refcounts.dat' |