Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | # |
| 3 | # Python documentation build configuration file |
| 4 | # |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 5 | # This file is execfile()d with the current directory set to its containing dir. |
| 6 | # |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 7 | # 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 Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 9 | |
Georg Brandl | dd76e05 | 2008-01-21 20:20:53 +0000 | [diff] [blame] | 10 | import sys, os, time |
Georg Brandl | 160cbce | 2014-10-29 08:41:02 +0100 | [diff] [blame] | 11 | sys.path.append(os.path.abspath('tools/extensions')) |
Georg Brandl | dd76e05 | 2008-01-21 20:20:53 +0000 | [diff] [blame] | 12 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 13 | # General configuration |
| 14 | # --------------------- |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 15 | |
Benjamin Peterson | 342fd18 | 2014-09-05 10:03:26 -0400 | [diff] [blame] | 16 | extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest', |
| 17 | 'pyspecific', 'c_annotations'] |
Georg Brandl | 56eadd9 | 2008-01-27 20:25:12 +0000 | [diff] [blame] | 18 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 19 | # General substitutions. |
| 20 | project = 'Python' |
Georg Brandl | dd76e05 | 2008-01-21 20:20:53 +0000 | [diff] [blame] | 21 | copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y') |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 22 | |
Georg Brandl | dd76e05 | 2008-01-21 20:20:53 +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 | 8ec7f65 | 2007-08-15 14:28:01 +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 | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 34 | # List of files that shouldn't be included in the build. |
Georg Brandl | 3e46d7c | 2014-09-21 00:42:40 +0200 | [diff] [blame] | 35 | exclude_patterns = [ |
| 36 | 'maclib/scrap.rst', |
| 37 | 'library/xmllib.rst', |
| 38 | 'library/xml.etree.rst', |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 39 | ] |
| 40 | |
Georg Brandl | 14b5a4d | 2014-10-02 08:26:26 +0200 | [diff] [blame] | 41 | # Require Sphinx 1.2 for build. |
| 42 | needs_sphinx = '1.2' |
| 43 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 44 | |
| 45 | # Options for HTML output |
| 46 | # ----------------------- |
| 47 | |
Georg Brandl | 27a4918 | 2012-01-21 08:58:22 +0100 | [diff] [blame] | 48 | html_theme = 'default' |
| 49 | html_theme_options = {'collapsiblesidebar': True} |
| 50 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 51 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, |
| 52 | # using the given strftime format. |
| 53 | html_last_updated_fmt = '%b %d, %Y' |
| 54 | |
Georg Brandl | 160cbce | 2014-10-29 08:41:02 +0100 | [diff] [blame] | 55 | # Path to find HTML templates. |
| 56 | templates_path = ['tools/templates'] |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 57 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 58 | # Custom sidebar templates, filenames relative to this file. |
| 59 | html_sidebars = { |
Georg Brandl | 5bb647d | 2008-03-09 18:18:30 +0000 | [diff] [blame] | 60 | 'index': 'indexsidebar.html', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | # Additional templates that should be rendered to pages. |
| 64 | html_additional_pages = { |
Georg Brandl | 5bb647d | 2008-03-09 18:18:30 +0000 | [diff] [blame] | 65 | 'download': 'download.html', |
Georg Brandl | 1df986b | 2008-04-19 21:28:38 +0000 | [diff] [blame] | 66 | 'index': 'indexcontent.html', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 67 | } |
| 68 | |
Georg Brandl | 4f1f36b | 2008-04-27 20:03:05 +0000 | [diff] [blame] | 69 | # Output an OpenSearch description file. |
Georg Brandl | 06f3b3b | 2014-10-29 08:36:35 +0100 | [diff] [blame] | 70 | html_use_opensearch = 'https://docs.python.org/' |
Georg Brandl | 4f1f36b | 2008-04-27 20:03:05 +0000 | [diff] [blame] | 71 | |
| 72 | # Additional static files. |
Georg Brandl | f16fbf9 | 2014-09-30 22:51:30 +0200 | [diff] [blame] | 73 | html_static_path = ['tools/static'] |
Georg Brandl | 4f1f36b | 2008-04-27 20:03:05 +0000 | [diff] [blame] | 74 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 75 | # Output file base name for HTML help builder. |
Georg Brandl | 47dff40 | 2008-03-02 06:45:40 +0000 | [diff] [blame] | 76 | htmlhelp_basename = 'python' + release.replace('.', '') |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 77 | |
Georg Brandl | 5c15aba | 2008-06-17 09:01:35 +0000 | [diff] [blame] | 78 | # Split the index |
| 79 | html_split_index = True |
| 80 | |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 81 | |
| 82 | # Options for LaTeX output |
| 83 | # ------------------------ |
| 84 | |
Zachary Ware | 4be66b6 | 2017-05-13 09:16:44 -0500 | [diff] [blame] | 85 | # Get LaTeX to handle Unicode correctly |
Zachary Ware | da86874 | 2017-09-22 13:41:10 -0500 | [diff] [blame] | 86 | latex_elements = { |
| 87 | 'inputenc': r'\usepackage[utf8x]{inputenc}', |
| 88 | 'utf8extra': '', |
| 89 | 'fontenc': r'\usepackage[T1,T2A]{fontenc}', |
| 90 | } |
Zachary Ware | 4be66b6 | 2017-05-13 09:16:44 -0500 | [diff] [blame] | 91 | |
| 92 | # Additional stuff for the LaTeX preamble. |
| 93 | latex_elements['preamble'] = r''' |
| 94 | \authoraddress{ |
Zachary Ware | da86874 | 2017-09-22 13:41:10 -0500 | [diff] [blame] | 95 | \sphinxstrong{Python Software Foundation}\\ |
| 96 | Email: \sphinxemail{docs@python.org} |
Zachary Ware | 4be66b6 | 2017-05-13 09:16:44 -0500 | [diff] [blame] | 97 | } |
| 98 | \let\Verbatim=\OriginalVerbatim |
| 99 | \let\endVerbatim=\endOriginalVerbatim |
| 100 | ''' |
| 101 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 102 | # The paper size ('letter' or 'a4'). |
Zachary Ware | 4be66b6 | 2017-05-13 09:16:44 -0500 | [diff] [blame] | 103 | latex_elements['papersize'] = 'a4' |
Georg Brandl | eee1fc5 | 2007-12-16 19:36:51 +0000 | [diff] [blame] | 104 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 105 | # The font size ('10pt', '11pt' or '12pt'). |
Zachary Ware | da86874 | 2017-09-22 13:41:10 -0500 | [diff] [blame] | 106 | latex_elements['pointsize'] = '10pt' |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 107 | |
| 108 | # Grouping the document tree into LaTeX files. List of tuples |
| 109 | # (source start file, target name, title, author, document class [howto/manual]). |
Georg Brandl | ecc0cc0 | 2014-10-29 08:14:04 +0100 | [diff] [blame] | 110 | _stdauthor = r'Guido van Rossum\\and the Python development team' |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 111 | latex_documents = [ |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 112 | ('c-api/index', 'c-api.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 113 | 'The Python/C API', _stdauthor, 'manual'), |
Donald Stufft | 527d4ac | 2014-11-20 09:38:31 -0500 | [diff] [blame] | 114 | ('distributing/index', 'distributing.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 115 | 'Distributing Python Modules', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 116 | ('extending/index', 'extending.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 117 | 'Extending and Embedding Python', _stdauthor, 'manual'), |
Donald Stufft | 527d4ac | 2014-11-20 09:38:31 -0500 | [diff] [blame] | 118 | ('installing/index', 'installing.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 119 | 'Installing Python Modules', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 120 | ('library/index', 'library.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 121 | 'The Python Library Reference', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 122 | ('reference/index', 'reference.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 123 | 'The Python Language Reference', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 124 | ('tutorial/index', 'tutorial.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 125 | 'Python Tutorial', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 126 | ('using/index', 'using.tex', |
Georg Brandl | 21946af | 2010-10-06 09:28:45 +0000 | [diff] [blame] | 127 | 'Python Setup and Usage', _stdauthor, 'manual'), |
Georg Brandl | 3b85b9b | 2010-11-26 08:20:18 +0000 | [diff] [blame] | 128 | ('faq/index', 'faq.tex', |
| 129 | 'Python Frequently Asked Questions', _stdauthor, 'manual'), |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 130 | ('whatsnew/' + version, 'whatsnew.tex', |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 131 | 'What\'s New in Python', 'A. M. Kuchling', 'howto'), |
| 132 | ] |
| 133 | # Collect all HOWTOs individually |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 134 | latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', |
Georg Brandl | 012a1ff | 2008-11-08 11:47:44 +0000 | [diff] [blame] | 135 | '', _stdauthor, 'howto') |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 136 | for fn in os.listdir('howto') |
| 137 | if fn.endswith('.rst') and fn != 'index.rst') |
| 138 | |
Georg Brandl | 7155a09 | 2008-01-16 20:27:56 +0000 | [diff] [blame] | 139 | # Documents to append as an appendix to all manuals. |
Georg Brandl | a51f61b | 2008-02-01 20:45:33 +0000 | [diff] [blame] | 140 | latex_appendices = ['glossary', 'about', 'license', 'copyright'] |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 141 | |
Senthil Kumaran | ee98860 | 2016-01-08 01:05:57 -0800 | [diff] [blame] | 142 | # Options for Epub output |
| 143 | # ----------------------- |
| 144 | |
| 145 | epub_author = 'Python Documentation Authors' |
| 146 | epub_publisher = 'Python Software Foundation' |
| 147 | |
Georg Brandl | 1704828 | 2008-02-23 18:47:04 +0000 | [diff] [blame] | 148 | # Options for the coverage checker |
| 149 | # -------------------------------- |
| 150 | |
| 151 | # The coverage checker will ignore all modules/functions/classes whose names |
| 152 | # match any of the following regexes (using re.match). |
| 153 | coverage_ignore_modules = [ |
| 154 | r'[T|t][k|K]', |
| 155 | r'Tix', |
| 156 | r'distutils.*', |
| 157 | ] |
| 158 | |
| 159 | coverage_ignore_functions = [ |
| 160 | 'test($|_)', |
| 161 | ] |
| 162 | |
| 163 | coverage_ignore_classes = [ |
| 164 | ] |
| 165 | |
| 166 | # Glob patterns for C source files for C API coverage, relative to this directory. |
| 167 | coverage_c_path = [ |
| 168 | '../Include/*.h', |
| 169 | ] |
| 170 | |
| 171 | # Regexes to find C items in the source files. |
| 172 | coverage_c_regexes = { |
| 173 | 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'), |
| 174 | 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'), |
| 175 | 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'), |
| 176 | } |
| 177 | |
| 178 | # The coverage checker will ignore all C items whose names match these regexes |
| 179 | # (using re.match) -- the keys must be the same as in coverage_c_regexes. |
| 180 | coverage_ignore_c_items = { |
| 181 | # 'cfunction': [...] |
| 182 | } |
Georg Brandl | 160cbce | 2014-10-29 08:41:02 +0100 | [diff] [blame] | 183 | |
Georg Brandl | cea2725 | 2014-10-29 10:57:01 +0100 | [diff] [blame] | 184 | |
| 185 | # Options for the link checker |
| 186 | # ---------------------------- |
| 187 | |
| 188 | # Ignore certain URLs. |
| 189 | linkcheck_ignore = [r'https://bugs.python.org/(issue)?\d+', |
| 190 | # Ignore PEPs for now, they all have permanent redirects. |
| 191 | r'http://www.python.org/dev/peps/pep-\d+'] |
| 192 | |
| 193 | |
Georg Brandl | 160cbce | 2014-10-29 08:41:02 +0100 | [diff] [blame] | 194 | # Options for extensions |
| 195 | # ---------------------- |
| 196 | |
| 197 | # Relative filename of the reference count data file. |
| 198 | refcount_file = 'data/refcounts.dat' |