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