##// END OF EJS Templates
Fix a typo
Andrew Kreimer -
Show More
@@ -1,273 +1,273
1 1 # -*- coding: utf-8 -*-
2 2 #
3 3 # IPython documentation build configuration file.
4 4
5 5 # NOTE: This file has been edited manually from the auto-generated one from
6 6 # sphinx. Do NOT delete and re-generate. If any changes from sphinx are
7 7 # needed, generate a scratch one and merge by hand any new fields needed.
8 8
9 9 #
10 10 # This file is execfile()d with the current directory set to its containing dir.
11 11 #
12 12 # The contents of this file are pickled, so don't put values in the namespace
13 13 # that aren't pickleable (module imports are okay, they're removed automatically).
14 14 #
15 15 # All configuration values have a default value; values that are commented out
16 16 # serve to show the default value.
17 17
18 18
19 19 import sys, os
20 20 from pathlib import Path
21 21
22 22 if sys.version_info > (3, 11):
23 23 import tomllib
24 24 else:
25 25 import tomli as tomllib
26 26
27 27 with open("./sphinx.toml", "rb") as f:
28 28 config = tomllib.load(f)
29 29
30 30 # https://read-the-docs.readthedocs.io/en/latest/faq.html
31 31 ON_RTD = os.environ.get("READTHEDOCS", None) == "True"
32 32
33 33 if ON_RTD:
34 34 tags.add("rtd")
35 35
36 36 # RTD doesn't use the Makefile, so re-run autogen_{things}.py here.
37 37 for name in ("config", "api", "magics", "shortcuts"):
38 38 fname = Path("autogen_{}.py".format(name))
39 39 fpath = (Path(__file__).parent).joinpath("..", fname)
40 40 with open(fpath, encoding="utf-8") as f:
41 41 exec(
42 42 compile(f.read(), fname, "exec"),
43 43 {
44 44 "__file__": fpath,
45 45 "__name__": "__main__",
46 46 },
47 47 )
48 48 import sphinx_rtd_theme
49 49
50 50 # Allow Python scripts to change behaviour during sphinx run
51 51 os.environ["IN_SPHINX_RUN"] = "True"
52 52
53 53 autodoc_type_aliases = {
54 54 "Matcher": " IPython.core.completer.Matcher",
55 55 "MatcherAPIv1": " IPython.core.completer.MatcherAPIv1",
56 56 }
57 57
58 58 # If your extensions are in another directory, add it here. If the directory
59 59 # is relative to the documentation root, use os.path.abspath to make it
60 60 # absolute, like shown here.
61 61 sys.path.insert(0, os.path.abspath("../sphinxext"))
62 62
63 63 # We load the ipython release info into a dict by explicit execution
64 64 iprelease = {}
65 65 exec(
66 66 compile(
67 67 open("../../IPython/core/release.py", encoding="utf-8").read(),
68 68 "../../IPython/core/release.py",
69 69 "exec",
70 70 ),
71 71 iprelease,
72 72 )
73 73
74 74 # General configuration
75 75 # ---------------------
76 76
77 77 # - template_path: Add any paths that contain templates here, relative to this directory.
78 78 # - master_doc: The master toctree document.
79 79 # - project
80 80 # - copyright
81 81 # - github_project_url
82 82 # - source_suffix = config["sphinx"]["source_suffix"]
83 83 # - exclude_patterns:
84 84 # Exclude these glob-style patterns when looking for source files.
85 85 # They are relative to the source/ directory.
86 86 # - pygments_style: The name of the Pygments (syntax highlighting) style to use.
87 87 # - extensions:
88 88 # Add any Sphinx extension module names here, as strings. They can be extensions
89 89 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
90 90 # - default_role
91 91 # - modindex_common_prefix
92 92
93 93 locals().update(config["sphinx"])
94 94
95 95 try:
96 96 from intersphinx_registry import get_intersphinx_mapping
97 97
98 98 intersphinx_mapping = get_intersphinx_mapping(
99 99 packages={
100 100 "python",
101 101 "rpy2",
102 102 "jupyterclient",
103 103 "jupyter",
104 104 "jedi",
105 105 "traitlets",
106 106 "ipykernel",
107 107 "prompt_toolkit",
108 108 "ipywidgets",
109 109 "ipyparallel",
110 110 "pip",
111 111 }
112 112 )
113 113
114 114 except ModuleNotFoundError:
115 # In case intersphinx_registry is not yet packages on current plaform
115 # In case intersphinx_registry is not yet packages on current platform
116 116 # as it is quite recent.
117 117 print("/!\\ intersphinx_registry not installed, relying on local mapping.")
118 118 intersphinx_mapping = config["intersphinx_mapping"]
119 119 for k, v in intersphinx_mapping.items():
120 120 intersphinx_mapping[k] = tuple(
121 121 [intersphinx_mapping[k]["url"], intersphinx_mapping[k]["fallback"]]
122 122 )
123 123
124 124
125 125 # numpydoc config
126 126 numpydoc_show_class_members = config["numpydoc"][
127 127 "numpydoc_show_class_members"
128 128 ] # Otherwise Sphinx emits thousands of warnings
129 129 numpydoc_class_members_toctree = config["numpydoc"]["numpydoc_class_members_toctree"]
130 130 warning_is_error = config["numpydoc"]["warning_is_error"]
131 131
132 132 # Options for HTML output
133 133 # -----------------------
134 134 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
135 135 # - html_theme
136 136 # - html_static_path
137 137 # Add any paths that contain custom static files (such as style sheets) here,
138 138 # relative to this directory. They are copied after the builtin static files,
139 139 # so a file named "default.css" will overwrite the builtin "default.css".
140 140 # Favicon needs the directory name
141 141 # - html_favicon
142 142 # - html_last_updated_fmt = config["html"]["html_last_updated_fmt"]
143 143 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
144 144 # using the given strftime format.
145 145 # Output file base name for HTML help builder.
146 146 # - htmlhelp_basename
147 147 locals().update(config["html"])
148 148
149 149 # Additional templates that should be rendered to pages, maps page names to
150 150 # template names.
151 151 html_additional_pages = {}
152 152 for item in config["html"]["html_additional_pages"]:
153 153 html_additional_pages[item[0]] = item[1]
154 154
155 155 # Options for LaTeX output
156 156 # ------------------------
157 157
158 158 # Grouping the document tree into LaTeX files. List of tuples
159 159 # (source start file, target name, title, author, document class [howto/manual]).
160 160 latex_documents = []
161 161 for item in config["latex"]["latex_documents"]:
162 162 latex_documents.append(tuple(item))
163 163 # If false, no module index is generated.
164 164 latex_use_modindex = config["latex"]["latex_use_modindex"]
165 165 # The font size ('10pt', '11pt' or '12pt').
166 166 latex_font_size = config["latex"]["latex_font_size"]
167 167
168 168 # Options for texinfo output
169 169 # --------------------------
170 170 texinfo_documents = [
171 171 (
172 172 master_doc,
173 173 "ipython",
174 174 "IPython Documentation",
175 175 "The IPython Development Team",
176 176 "IPython",
177 177 "IPython Documentation",
178 178 "Programming",
179 179 1,
180 180 ),
181 181 ]
182 182
183 183 #########################################################################
184 184 # Custom configuration
185 185 # The default replacements for |version| and |release|, also used in various
186 186 # other places throughout the built documents.
187 187 #
188 188 # The full version, including alpha/beta/rc tags.
189 189 release = "%s" % iprelease["version"]
190 190 # Just the X.Y.Z part, no '-dev'
191 191 version = iprelease["version"].split("-", 1)[0]
192 192
193 193 # There are two options for replacing |today|: either, you set today to some
194 194 # non-false value, then it is used:
195 195 # today = ''
196 196 # Else, today_fmt is used as the format for a strftime call.
197 197 today_fmt = "%B %d, %Y"
198 198
199 199 rst_prolog = ""
200 200
201 201
202 202 def is_stable(extra):
203 203 for ext in {"dev", "b", "rc"}:
204 204 if ext in extra:
205 205 return False
206 206 return True
207 207
208 208
209 209 if is_stable(iprelease["_version_extra"]):
210 210 tags.add("ipystable")
211 211 print("Adding Tag: ipystable")
212 212 else:
213 213 tags.add("ipydev")
214 214 print("Adding Tag: ipydev")
215 215 rst_prolog += """
216 216 .. warning::
217 217
218 218 This documentation covers a development version of IPython. The development
219 219 version may differ significantly from the latest stable release.
220 220 """
221 221
222 222 rst_prolog += """
223 223 .. important::
224 224
225 225 This documentation covers IPython versions 6.0 and higher. Beginning with
226 226 version 6.0, IPython stopped supporting compatibility with Python versions
227 227 lower than 3.3 including all versions of Python 2.7.
228 228
229 229 If you are looking for an IPython version compatible with Python 2.7,
230 230 please use the IPython 5.x LTS release and refer to its documentation (LTS
231 231 is the long term support release).
232 232
233 233 """
234 234
235 235 import logging
236 236
237 237
238 238 class ConfigtraitFilter(logging.Filter):
239 239 """
240 240 This is a filter to remove in sphinx 3+ the error about config traits being duplicated.
241 241
242 242 As we autogenerate configuration traits from, subclasses have lots of
243 243 duplication and we want to silence them. Indeed we build on travis with
244 244 warnings-as-error set to True, so those duplicate items make the build fail.
245 245 """
246 246
247 247 def filter(self, record):
248 248 if (
249 249 record.args
250 250 and record.args[0] == "configtrait"
251 251 and "duplicate" in record.msg
252 252 ):
253 253 return False
254 254 return True
255 255
256 256
257 257 ct_filter = ConfigtraitFilter()
258 258
259 259 import sphinx.util
260 260
261 261 logger = sphinx.util.logging.getLogger("sphinx.domains.std").logger
262 262 logger.addFilter(ct_filter)
263 263
264 264
265 265 def setup(app):
266 266 app.add_css_file("theme_overrides.css")
267 267
268 268
269 269 # Cleanup
270 270 # -------
271 271 # delete release info to avoid pickling errors from sphinx
272 272
273 273 del iprelease
General Comments 0
You need to be logged in to leave comments. Login now