-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
conf.py
178 lines (143 loc) · 6.67 KB
/
conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
# pylint: disable=invalid-name
"""Sphinx documentation builder."""
import datetime
import doctest
import os
project = "Qiskit"
project_copyright = f"2017-{datetime.date.today().year}, Qiskit Development Team"
author = "Qiskit Development Team"
# The short X.Y version
version = "0.25"
# The full version, including alpha/beta/rc tags
release = "0.25.0"
extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.doctest",
"reno.sphinxext",
"sphinx_design",
"matplotlib.sphinxext.plot_directive",
"qiskit_sphinx_theme",
"nbsphinx",
]
templates_path = ["_templates"]
# Number figures, tables and code-blocks if they have a caption.
numfig = True
# Available keys are 'figure', 'table', 'code-block' and 'section'. '%s' is the number.
numfig_format = {"table": "Table %s"}
# The language for content autogenerated by Sphinx or the default for gettext content translation.
language = "en"
# Relative to source directory, affects general discovery, and html_static_path and html_extra_path.
exclude_patterns = ["_build", "**.ipynb_checkpoints"]
pygments_style = "colorful"
# This adds the module name to e.g. function API docs. We use the default of True because our
# module pages sometimes have functions from submodules on the page, and we want to make clear
# that you must include the submodule to import it. We should strongly consider reorganizing our
# code to avoid this, i.e. re-exporting the submodule members from the top-level module. Once fixed
# and verified by only having a single `.. currentmodule::` in the file, we can turn this back to
# False.
add_module_names = True
# A list of prefixes that are ignored for sorting the Python module index
# (e.g., if this is set to ['foo.'], then foo.bar is shown under B, not F).
modindex_common_prefix = ["qiskit."]
intersphinx_mapping = {
"rustworkx": ("https://qiskit.org/ecosystem/rustworkx/", None),
"qiskit-ibm-runtime": ("https://qiskit.org/ecosystem/ibm-runtime/", None),
"qiskit-aer": ("https://qiskit.org/ecosystem/aer/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"matplotlib": ("https://matplotlib.org/stable/", None),
"python": ("https://docs.python.org/3/", None),
}
# ----------------------------------------------------------------------------------
# HTML theme
# ----------------------------------------------------------------------------------
html_theme = "qiskit_sphinx_theme"
html_last_updated_fmt = "%Y/%m/%d"
html_theme_options = {
"logo_only": True,
"display_version": True,
"prev_next_buttons_location": "bottom",
"style_external_links": True,
}
# ----------------------------------------------------------------------------------
# Autodoc
# ----------------------------------------------------------------------------------
# Note that setting autodoc defaults here may not have as much of an effect as you may expect; any
# documentation created by autosummary uses a template file (in autosummary in the templates path),
# which likely overrides the autodoc defaults.
# Move type hints from signatures to the parameter descriptions (except in overload cases, where
# that's not possible).
autodoc_typehints = "description"
# Only add type hints from signature to description body if the parameter has documentation. The
# return type is always added to the description (if in the signature).
autodoc_typehints_description_target = "documented_params"
autosummary_generate = True
autosummary_generate_overwrite = False
# The pulse library contains some names that differ only in capitalisation, during the changeover
# surrounding SymbolPulse. Since these resolve to autosummary filenames that also differ only in
# capitalisation, this causes problems when the documentation is built on an OS/filesystem that is
# enforcing case-insensitive semantics. This setting defines some custom names to prevent the clash
# from happening.
autosummary_filename_map = {
"qiskit.pulse.library.Constant": "qiskit.pulse.library.Constant_class.rst",
"qiskit.pulse.library.Sawtooth": "qiskit.pulse.library.Sawtooth_class.rst",
"qiskit.pulse.library.Triangle": "qiskit.pulse.library.Triangle_class.rst",
"qiskit.pulse.library.Cos": "qiskit.pulse.library.Cos_class.rst",
"qiskit.pulse.library.Sin": "qiskit.pulse.library.Sin_class.rst",
"qiskit.pulse.library.Gaussian": "qiskit.pulse.library.Gaussian_class.rst",
"qiskit.pulse.library.Drag": "qiskit.pulse.library.Drag_class.rst",
"qiskit.pulse.library.Square": "qiskit.pulse.library.Square_fun.rst",
"qiskit.pulse.library.Sech": "qiskit.pulse.library.Sech_fun.rst",
}
autoclass_content = "both"
# We only use Google-style docstrings, and allowing Napoleon to parse Numpy-style docstrings both
# slows down the build (a little) and can sometimes result in _regular_ section headings in
# module-level documentation being converted into surprising things.
napoleon_google_docstring = True
napoleon_numpy_docstring = False
# ----------------------------------------------------------------------------------
# Doctest
# ----------------------------------------------------------------------------------
doctest_default_flags = (
doctest.ELLIPSIS
| doctest.NORMALIZE_WHITESPACE
| doctest.IGNORE_EXCEPTION_DETAIL
| doctest.DONT_ACCEPT_TRUE_FOR_1
)
# Leaving this string empty disables testing of doctest blocks from docstrings.
# Doctest blocks are structures like this one:
# >> code
# output
doctest_test_doctest_blocks = ""
# ----------------------------------------------------------------------------------
# Nbsphinx
# ----------------------------------------------------------------------------------
nbsphinx_timeout = int(os.getenv("QISKIT_CELL_TIMEOUT", "300"))
nbsphinx_execute = os.getenv("QISKIT_DOCS_BUILD_TUTORIALS", "never")
nbsphinx_widgets_path = ""
nbsphinx_thumbnails = {"**": "_static/images/logo.png"}
nbsphinx_prolog = """
{% set docname = env.doc2path(env.docname, base=None) %}
.. only:: html
.. role:: raw-html(raw)
:format: html
.. note::
This page was generated from `{{ docname }}`__.
__ https://github.com/Qiskit/qiskit-terra/blob/main/{{ docname }}
"""