1# 2# Python documentation build configuration file 3# 4# This file is execfile()d with the current directory set to its containing dir. 5# 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). 8 9import sys, os, time 10sys.path.append(os.path.abspath('tools/extensions')) 11 12# General configuration 13# --------------------- 14 15extensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest', 16 'pyspecific', 'c_annotations'] 17 18# General substitutions. 19project = 'Python' 20copyright = '2001-%s, Python Software Foundation' % time.strftime('%Y') 21 22# We look for the Include/patchlevel.h file in the current Python source tree 23# and replace the values accordingly. 24import patchlevel 25version, release = patchlevel.get_version_info() 26 27# There are two options for replacing |today|: either, you set today to some 28# non-false value, then it is used: 29today = '' 30# Else, today_fmt is used as the format for a strftime call. 31today_fmt = '%B %d, %Y' 32 33# By default, highlight as Python 3. 34highlight_language = 'python3' 35 36# Require Sphinx 1.2 for build. 37needs_sphinx = '1.2' 38 39# Ignore any .rst files in the venv/ directory. 40exclude_patterns = ['venv/*', 'README.rst'] 41 42 43# Options for HTML output 44# ----------------------- 45 46# Use our custom theme. 47html_theme = 'pydoctheme' 48html_theme_path = ['tools'] 49html_theme_options = {'collapsiblesidebar': True} 50 51# Short title used e.g. for <title> HTML tags. 52html_short_title = '%s Documentation' % release 53 54# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 55# using the given strftime format. 56html_last_updated_fmt = '%b %d, %Y' 57 58# Path to find HTML templates. 59templates_path = ['tools/templates'] 60 61# Custom sidebar templates, filenames relative to this file. 62html_sidebars = { 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'], 67} 68 69# Additional templates that should be rendered to pages. 70html_additional_pages = { 71 'download': 'download.html', 72 'index': 'indexcontent.html', 73} 74 75# Output an OpenSearch description file. 76html_use_opensearch = 'https://docs.python.org/' + version 77 78# Additional static files. 79html_static_path = ['tools/static'] 80 81# Output file base name for HTML help builder. 82htmlhelp_basename = 'python' + release.replace('.', '') 83 84# Split the index 85html_split_index = True 86 87 88# Options for LaTeX output 89# ------------------------ 90 91# Get LaTeX to handle Unicode correctly 92latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''} 93 94# Additional stuff for the LaTeX preamble. 95latex_elements['preamble'] = r''' 96\authoraddress{ 97 \strong{Python Software Foundation}\\ 98 Email: \email{docs@python.org} 99} 100\let\Verbatim=\OriginalVerbatim 101\let\endVerbatim=\endOriginalVerbatim 102''' 103 104# The paper size ('letter' or 'a4'). 105latex_elements['papersize'] = 'a4' 106 107# The font size ('10pt', '11pt' or '12pt'). 108latex_elements['font_size'] = '10pt' 109 110# Grouping the document tree into LaTeX files. List of tuples 111# (source start file, target name, title, author, document class [howto/manual]). 112_stdauthor = r'Guido van Rossum\\and the Python development team' 113latex_documents = [ 114 ('c-api/index', 'c-api.tex', 115 'The Python/C API', _stdauthor, 'manual'), 116 ('distributing/index', 'distributing.tex', 117 'Distributing Python Modules', _stdauthor, 'manual'), 118 ('extending/index', 'extending.tex', 119 'Extending and Embedding Python', _stdauthor, 'manual'), 120 ('installing/index', 'installing.tex', 121 'Installing Python Modules', _stdauthor, 'manual'), 122 ('library/index', 'library.tex', 123 'The Python Library Reference', _stdauthor, 'manual'), 124 ('reference/index', 'reference.tex', 125 'The Python Language Reference', _stdauthor, 'manual'), 126 ('tutorial/index', 'tutorial.tex', 127 'Python Tutorial', _stdauthor, 'manual'), 128 ('using/index', 'using.tex', 129 'Python Setup and Usage', _stdauthor, 'manual'), 130 ('faq/index', 'faq.tex', 131 'Python Frequently Asked Questions', _stdauthor, 'manual'), 132 ('whatsnew/' + version, 'whatsnew.tex', 133 'What\'s New in Python', 'A. M. Kuchling', 'howto'), 134] 135# Collect all HOWTOs individually 136latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', 137 '', _stdauthor, 'howto') 138 for fn in os.listdir('howto') 139 if fn.endswith('.rst') and fn != 'index.rst') 140 141# Documents to append as an appendix to all manuals. 142latex_appendices = ['glossary', 'about', 'license', 'copyright'] 143 144# Options for Epub output 145# ----------------------- 146 147epub_author = 'Python Documentation Authors' 148epub_publisher = 'Python Software Foundation' 149 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). 155coverage_ignore_modules = [ 156 r'[T|t][k|K]', 157 r'Tix', 158 r'distutils.*', 159] 160 161coverage_ignore_functions = [ 162 'test($|_)', 163] 164 165coverage_ignore_classes = [ 166] 167 168# Glob patterns for C source files for C API coverage, relative to this directory. 169coverage_c_path = [ 170 '../Include/*.h', 171] 172 173# Regexes to find C items in the source files. 174coverage_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. 182coverage_ignore_c_items = { 183# 'cfunction': [...] 184} 185 186 187# Options for the link checker 188# ---------------------------- 189 190# Ignore certain URLs. 191linkcheck_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 196# Options for extensions 197# ---------------------- 198 199# Relative filename of the reference count data file. 200refcount_file = 'data/refcounts.dat' 201