ยปCore Development>Code coverage>Doc/conf.py

Python code coverage for Doc/conf.py

#countcontent
1n/a#
2n/a# Python documentation build configuration file
3n/a#
4n/a# This file is execfile()d with the current directory set to its containing dir.
5n/a#
6n/a# The contents of this file are pickled, so don't put values in the namespace
7n/a# that aren't pickleable (module imports are okay, they're removed automatically).
8n/a
9n/aimport sys, os, time
10n/asys.path.append(os.path.abspath('tools/extensions'))
11n/a
12n/a# General configuration
13n/a# ---------------------
14n/a
15n/aextensions = ['sphinx.ext.coverage', 'sphinx.ext.doctest',
16n/a 'pyspecific', 'c_annotations']
17n/a
18n/a# General substitutions.
19n/aproject = 'Python'
20n/acopyright = '2001-%s, Python Software Foundation' % time.strftime('%Y')
21n/a
22n/a# We look for the Include/patchlevel.h file in the current Python source tree
23n/a# and replace the values accordingly.
24n/aimport patchlevel
25n/aversion, release = patchlevel.get_version_info()
26n/a
27n/a# There are two options for replacing |today|: either, you set today to some
28n/a# non-false value, then it is used:
29n/atoday = ''
30n/a# Else, today_fmt is used as the format for a strftime call.
31n/atoday_fmt = '%B %d, %Y'
32n/a
33n/a# By default, highlight as Python 3.
34n/ahighlight_language = 'python3'
35n/a
36n/a# Require Sphinx 1.2 for build.
37n/aneeds_sphinx = '1.2'
38n/a
39n/a# Ignore any .rst files in the venv/ directory.
40n/aexclude_patterns = ['venv/*']
41n/a
42n/a
43n/a# Options for HTML output
44n/a# -----------------------
45n/a
46n/a# Use our custom theme.
47n/ahtml_theme = 'pydoctheme'
48n/ahtml_theme_path = ['tools']
49n/ahtml_theme_options = {'collapsiblesidebar': True}
50n/a
51n/a# Short title used e.g. for <title> HTML tags.
52n/ahtml_short_title = '%s Documentation' % release
53n/a
54n/a# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
55n/a# using the given strftime format.
56n/ahtml_last_updated_fmt = '%b %d, %Y'
57n/a
58n/a# Path to find HTML templates.
59n/atemplates_path = ['tools/templates']
60n/a
61n/a# Custom sidebar templates, filenames relative to this file.
62n/ahtml_sidebars = {
63n/a # Defaults taken from http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars
64n/a # Removes the quick search block
65n/a '**': ['localtoc.html', 'relations.html', 'customsourcelink.html'],
66n/a 'index': ['indexsidebar.html'],
67n/a}
68n/a
69n/a# Additional templates that should be rendered to pages.
70n/ahtml_additional_pages = {
71n/a 'download': 'download.html',
72n/a 'index': 'indexcontent.html',
73n/a}
74n/a
75n/a# Output an OpenSearch description file.
76n/ahtml_use_opensearch = 'https://docs.python.org/' + version
77n/a
78n/a# Additional static files.
79n/ahtml_static_path = ['tools/static']
80n/a
81n/a# Output file base name for HTML help builder.
82n/ahtmlhelp_basename = 'python' + release.replace('.', '')
83n/a
84n/a# Split the index
85n/ahtml_split_index = True
86n/a
87n/a
88n/a# Options for LaTeX output
89n/a# ------------------------
90n/a
91n/a# The paper size ('letter' or 'a4').
92n/alatex_paper_size = 'a4'
93n/a
94n/a# The font size ('10pt', '11pt' or '12pt').
95n/alatex_font_size = '10pt'
96n/a
97n/a# Grouping the document tree into LaTeX files. List of tuples
98n/a# (source start file, target name, title, author, document class [howto/manual]).
99n/a_stdauthor = r'Guido van Rossum\\and the Python development team'
100n/alatex_documents = [
101n/a ('c-api/index', 'c-api.tex',
102n/a 'The Python/C API', _stdauthor, 'manual'),
103n/a ('distributing/index', 'distributing.tex',
104n/a 'Distributing Python Modules', _stdauthor, 'manual'),
105n/a ('extending/index', 'extending.tex',
106n/a 'Extending and Embedding Python', _stdauthor, 'manual'),
107n/a ('installing/index', 'installing.tex',
108n/a 'Installing Python Modules', _stdauthor, 'manual'),
109n/a ('library/index', 'library.tex',
110n/a 'The Python Library Reference', _stdauthor, 'manual'),
111n/a ('reference/index', 'reference.tex',
112n/a 'The Python Language Reference', _stdauthor, 'manual'),
113n/a ('tutorial/index', 'tutorial.tex',
114n/a 'Python Tutorial', _stdauthor, 'manual'),
115n/a ('using/index', 'using.tex',
116n/a 'Python Setup and Usage', _stdauthor, 'manual'),
117n/a ('faq/index', 'faq.tex',
118n/a 'Python Frequently Asked Questions', _stdauthor, 'manual'),
119n/a ('whatsnew/' + version, 'whatsnew.tex',
120n/a 'What\'s New in Python', 'A. M. Kuchling', 'howto'),
121n/a]
122n/a# Collect all HOWTOs individually
123n/alatex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex',
124n/a '', _stdauthor, 'howto')
125n/a for fn in os.listdir('howto')
126n/a if fn.endswith('.rst') and fn != 'index.rst')
127n/a
128n/a# Additional stuff for the LaTeX preamble.
129n/alatex_preamble = r'''
130n/a\authoraddress{
131n/a \strong{Python Software Foundation}\\
132n/a Email: \email{docs@python.org}
133n/a}
134n/a\let\Verbatim=\OriginalVerbatim
135n/a\let\endVerbatim=\endOriginalVerbatim
136n/a'''
137n/a
138n/a# Documents to append as an appendix to all manuals.
139n/alatex_appendices = ['glossary', 'about', 'license', 'copyright']
140n/a
141n/a# Get LaTeX to handle Unicode correctly
142n/alatex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''}
143n/a
144n/a# Options for Epub output
145n/a# -----------------------
146n/a
147n/aepub_author = 'Python Documentation Authors'
148n/aepub_publisher = 'Python Software Foundation'
149n/a
150n/a# Options for the coverage checker
151n/a# --------------------------------
152n/a
153n/a# The coverage checker will ignore all modules/functions/classes whose names
154n/a# match any of the following regexes (using re.match).
155n/acoverage_ignore_modules = [
156n/a r'[T|t][k|K]',
157n/a r'Tix',
158n/a r'distutils.*',
159n/a]
160n/a
161n/acoverage_ignore_functions = [
162n/a 'test($|_)',
163n/a]
164n/a
165n/acoverage_ignore_classes = [
166n/a]
167n/a
168n/a# Glob patterns for C source files for C API coverage, relative to this directory.
169n/acoverage_c_path = [
170n/a '../Include/*.h',
171n/a]
172n/a
173n/a# Regexes to find C items in the source files.
174n/acoverage_c_regexes = {
175n/a 'cfunction': (r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'),
176n/a 'data': (r'^PyAPI_DATA\(.*\)\s+([^_][\w_]+)'),
177n/a 'macro': (r'^#define ([^_][\w_]+)\(.*\)[\s|\\]'),
178n/a}
179n/a
180n/a# The coverage checker will ignore all C items whose names match these regexes
181n/a# (using re.match) -- the keys must be the same as in coverage_c_regexes.
182n/acoverage_ignore_c_items = {
183n/a# 'cfunction': [...]
184n/a}
185n/a
186n/a
187n/a# Options for the link checker
188n/a# ----------------------------
189n/a
190n/a# Ignore certain URLs.
191n/alinkcheck_ignore = [r'https://bugs.python.org/(issue)?\d+',
192n/a # Ignore PEPs for now, they all have permanent redirects.
193n/a r'http://www.python.org/dev/peps/pep-\d+']
194n/a
195n/a
196n/a# Options for extensions
197n/a# ----------------------
198n/a
199n/a# Relative filename of the reference count data file.
200n/arefcount_file = 'data/refcounts.dat'