##// END OF EJS Templates
ENH: add webp support to IPython.display.Image and complete identification of JPEG,PNG,GIF,WEBP image types by initial bytes (#14526)...
M Bussonnier -
r28924:d7d58a36 merge
parent child Browse files
Show More
@@ -1,1294 +1,1370
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Top-level display functions for displaying object in different formats."""
2 """Top-level display functions for displaying object in different formats."""
3
3
4 # Copyright (c) IPython Development Team.
4 # Copyright (c) IPython Development Team.
5 # Distributed under the terms of the Modified BSD License.
5 # Distributed under the terms of the Modified BSD License.
6
6
7
7
8 from binascii import b2a_base64, hexlify
8 from binascii import b2a_base64, hexlify
9 import html
9 import html
10 import json
10 import json
11 import mimetypes
11 import mimetypes
12 import os
12 import os
13 import struct
13 import struct
14 import warnings
14 import warnings
15 from copy import deepcopy
15 from copy import deepcopy
16 from os.path import splitext
16 from os.path import splitext
17 from pathlib import Path, PurePath
17 from pathlib import Path, PurePath
18
18
19 from IPython.utils.py3compat import cast_unicode
19 from IPython.utils.py3compat import cast_unicode
20 from IPython.testing.skipdoctest import skip_doctest
20 from IPython.testing.skipdoctest import skip_doctest
21 from . import display_functions
21 from . import display_functions
22
22
23
23
24 __all__ = ['display_pretty', 'display_html', 'display_markdown',
24 __all__ = [
25 'display_svg', 'display_png', 'display_jpeg', 'display_latex', 'display_json',
25 "display_pretty",
26 'display_javascript', 'display_pdf', 'DisplayObject', 'TextDisplayObject',
26 "display_html",
27 'Pretty', 'HTML', 'Markdown', 'Math', 'Latex', 'SVG', 'ProgressBar', 'JSON',
27 "display_markdown",
28 'GeoJSON', 'Javascript', 'Image', 'set_matplotlib_formats',
28 "display_svg",
29 'set_matplotlib_close',
29 "display_png",
30 'Video']
30 "display_jpeg",
31 "display_webp",
32 "display_latex",
33 "display_json",
34 "display_javascript",
35 "display_pdf",
36 "DisplayObject",
37 "TextDisplayObject",
38 "Pretty",
39 "HTML",
40 "Markdown",
41 "Math",
42 "Latex",
43 "SVG",
44 "ProgressBar",
45 "JSON",
46 "GeoJSON",
47 "Javascript",
48 "Image",
49 "set_matplotlib_formats",
50 "set_matplotlib_close",
51 "Video",
52 ]
31
53
32 _deprecated_names = ["display", "clear_output", "publish_display_data", "update_display", "DisplayHandle"]
54 _deprecated_names = ["display", "clear_output", "publish_display_data", "update_display", "DisplayHandle"]
33
55
34 __all__ = __all__ + _deprecated_names
56 __all__ = __all__ + _deprecated_names
35
57
36
58
37 # ----- warn to import from IPython.display -----
59 # ----- warn to import from IPython.display -----
38
60
39 from warnings import warn
61 from warnings import warn
40
62
41
63
42 def __getattr__(name):
64 def __getattr__(name):
43 if name in _deprecated_names:
65 if name in _deprecated_names:
44 warn(
66 warn(
45 f"Importing {name} from IPython.core.display is deprecated since IPython 7.14, please import from IPython.display",
67 f"Importing {name} from IPython.core.display is deprecated since IPython 7.14, please import from IPython.display",
46 DeprecationWarning,
68 DeprecationWarning,
47 stacklevel=2,
69 stacklevel=2,
48 )
70 )
49 return getattr(display_functions, name)
71 return getattr(display_functions, name)
50
72
51 if name in globals().keys():
73 if name in globals().keys():
52 return globals()[name]
74 return globals()[name]
53 else:
75 else:
54 raise AttributeError(f"module {__name__} has no attribute {name}")
76 raise AttributeError(f"module {__name__} has no attribute {name}")
55
77
56
78
57 #-----------------------------------------------------------------------------
79 #-----------------------------------------------------------------------------
58 # utility functions
80 # utility functions
59 #-----------------------------------------------------------------------------
81 #-----------------------------------------------------------------------------
60
82
61 def _safe_exists(path):
83 def _safe_exists(path):
62 """Check path, but don't let exceptions raise"""
84 """Check path, but don't let exceptions raise"""
63 try:
85 try:
64 return os.path.exists(path)
86 return os.path.exists(path)
65 except Exception:
87 except Exception:
66 return False
88 return False
67
89
68
90
69 def _display_mimetype(mimetype, objs, raw=False, metadata=None):
91 def _display_mimetype(mimetype, objs, raw=False, metadata=None):
70 """internal implementation of all display_foo methods
92 """internal implementation of all display_foo methods
71
93
72 Parameters
94 Parameters
73 ----------
95 ----------
74 mimetype : str
96 mimetype : str
75 The mimetype to be published (e.g. 'image/png')
97 The mimetype to be published (e.g. 'image/png')
76 *objs : object
98 *objs : object
77 The Python objects to display, or if raw=True raw text data to
99 The Python objects to display, or if raw=True raw text data to
78 display.
100 display.
79 raw : bool
101 raw : bool
80 Are the data objects raw data or Python objects that need to be
102 Are the data objects raw data or Python objects that need to be
81 formatted before display? [default: False]
103 formatted before display? [default: False]
82 metadata : dict (optional)
104 metadata : dict (optional)
83 Metadata to be associated with the specific mimetype output.
105 Metadata to be associated with the specific mimetype output.
84 """
106 """
85 if metadata:
107 if metadata:
86 metadata = {mimetype: metadata}
108 metadata = {mimetype: metadata}
87 if raw:
109 if raw:
88 # turn list of pngdata into list of { 'image/png': pngdata }
110 # turn list of pngdata into list of { 'image/png': pngdata }
89 objs = [ {mimetype: obj} for obj in objs ]
111 objs = [ {mimetype: obj} for obj in objs ]
90 display_functions.display(*objs, raw=raw, metadata=metadata, include=[mimetype])
112 display_functions.display(*objs, raw=raw, metadata=metadata, include=[mimetype])
91
113
92 #-----------------------------------------------------------------------------
114 #-----------------------------------------------------------------------------
93 # Main functions
115 # Main functions
94 #-----------------------------------------------------------------------------
116 #-----------------------------------------------------------------------------
95
117
96
118
97 def display_pretty(*objs, **kwargs):
119 def display_pretty(*objs, **kwargs):
98 """Display the pretty (default) representation of an object.
120 """Display the pretty (default) representation of an object.
99
121
100 Parameters
122 Parameters
101 ----------
123 ----------
102 *objs : object
124 *objs : object
103 The Python objects to display, or if raw=True raw text data to
125 The Python objects to display, or if raw=True raw text data to
104 display.
126 display.
105 raw : bool
127 raw : bool
106 Are the data objects raw data or Python objects that need to be
128 Are the data objects raw data or Python objects that need to be
107 formatted before display? [default: False]
129 formatted before display? [default: False]
108 metadata : dict (optional)
130 metadata : dict (optional)
109 Metadata to be associated with the specific mimetype output.
131 Metadata to be associated with the specific mimetype output.
110 """
132 """
111 _display_mimetype('text/plain', objs, **kwargs)
133 _display_mimetype('text/plain', objs, **kwargs)
112
134
113
135
114 def display_html(*objs, **kwargs):
136 def display_html(*objs, **kwargs):
115 """Display the HTML representation of an object.
137 """Display the HTML representation of an object.
116
138
117 Note: If raw=False and the object does not have a HTML
139 Note: If raw=False and the object does not have a HTML
118 representation, no HTML will be shown.
140 representation, no HTML will be shown.
119
141
120 Parameters
142 Parameters
121 ----------
143 ----------
122 *objs : object
144 *objs : object
123 The Python objects to display, or if raw=True raw HTML data to
145 The Python objects to display, or if raw=True raw HTML data to
124 display.
146 display.
125 raw : bool
147 raw : bool
126 Are the data objects raw data or Python objects that need to be
148 Are the data objects raw data or Python objects that need to be
127 formatted before display? [default: False]
149 formatted before display? [default: False]
128 metadata : dict (optional)
150 metadata : dict (optional)
129 Metadata to be associated with the specific mimetype output.
151 Metadata to be associated with the specific mimetype output.
130 """
152 """
131 _display_mimetype('text/html', objs, **kwargs)
153 _display_mimetype('text/html', objs, **kwargs)
132
154
133
155
134 def display_markdown(*objs, **kwargs):
156 def display_markdown(*objs, **kwargs):
135 """Displays the Markdown representation of an object.
157 """Displays the Markdown representation of an object.
136
158
137 Parameters
159 Parameters
138 ----------
160 ----------
139 *objs : object
161 *objs : object
140 The Python objects to display, or if raw=True raw markdown data to
162 The Python objects to display, or if raw=True raw markdown data to
141 display.
163 display.
142 raw : bool
164 raw : bool
143 Are the data objects raw data or Python objects that need to be
165 Are the data objects raw data or Python objects that need to be
144 formatted before display? [default: False]
166 formatted before display? [default: False]
145 metadata : dict (optional)
167 metadata : dict (optional)
146 Metadata to be associated with the specific mimetype output.
168 Metadata to be associated with the specific mimetype output.
147 """
169 """
148
170
149 _display_mimetype('text/markdown', objs, **kwargs)
171 _display_mimetype('text/markdown', objs, **kwargs)
150
172
151
173
152 def display_svg(*objs, **kwargs):
174 def display_svg(*objs, **kwargs):
153 """Display the SVG representation of an object.
175 """Display the SVG representation of an object.
154
176
155 Parameters
177 Parameters
156 ----------
178 ----------
157 *objs : object
179 *objs : object
158 The Python objects to display, or if raw=True raw svg data to
180 The Python objects to display, or if raw=True raw svg data to
159 display.
181 display.
160 raw : bool
182 raw : bool
161 Are the data objects raw data or Python objects that need to be
183 Are the data objects raw data or Python objects that need to be
162 formatted before display? [default: False]
184 formatted before display? [default: False]
163 metadata : dict (optional)
185 metadata : dict (optional)
164 Metadata to be associated with the specific mimetype output.
186 Metadata to be associated with the specific mimetype output.
165 """
187 """
166 _display_mimetype('image/svg+xml', objs, **kwargs)
188 _display_mimetype('image/svg+xml', objs, **kwargs)
167
189
168
190
169 def display_png(*objs, **kwargs):
191 def display_png(*objs, **kwargs):
170 """Display the PNG representation of an object.
192 """Display the PNG representation of an object.
171
193
172 Parameters
194 Parameters
173 ----------
195 ----------
174 *objs : object
196 *objs : object
175 The Python objects to display, or if raw=True raw png data to
197 The Python objects to display, or if raw=True raw png data to
176 display.
198 display.
177 raw : bool
199 raw : bool
178 Are the data objects raw data or Python objects that need to be
200 Are the data objects raw data or Python objects that need to be
179 formatted before display? [default: False]
201 formatted before display? [default: False]
180 metadata : dict (optional)
202 metadata : dict (optional)
181 Metadata to be associated with the specific mimetype output.
203 Metadata to be associated with the specific mimetype output.
182 """
204 """
183 _display_mimetype('image/png', objs, **kwargs)
205 _display_mimetype('image/png', objs, **kwargs)
184
206
185
207
186 def display_jpeg(*objs, **kwargs):
208 def display_jpeg(*objs, **kwargs):
187 """Display the JPEG representation of an object.
209 """Display the JPEG representation of an object.
188
210
189 Parameters
211 Parameters
190 ----------
212 ----------
191 *objs : object
213 *objs : object
192 The Python objects to display, or if raw=True raw JPEG data to
214 The Python objects to display, or if raw=True raw JPEG data to
193 display.
215 display.
194 raw : bool
216 raw : bool
195 Are the data objects raw data or Python objects that need to be
217 Are the data objects raw data or Python objects that need to be
196 formatted before display? [default: False]
218 formatted before display? [default: False]
197 metadata : dict (optional)
219 metadata : dict (optional)
198 Metadata to be associated with the specific mimetype output.
220 Metadata to be associated with the specific mimetype output.
199 """
221 """
200 _display_mimetype('image/jpeg', objs, **kwargs)
222 _display_mimetype('image/jpeg', objs, **kwargs)
201
223
202
224
225 def display_webp(*objs, **kwargs):
226 """Display the WEBP representation of an object.
227
228 Parameters
229 ----------
230 *objs : object
231 The Python objects to display, or if raw=True raw JPEG data to
232 display.
233 raw : bool
234 Are the data objects raw data or Python objects that need to be
235 formatted before display? [default: False]
236 metadata : dict (optional)
237 Metadata to be associated with the specific mimetype output.
238 """
239 _display_mimetype("image/webp", objs, **kwargs)
240
241
203 def display_latex(*objs, **kwargs):
242 def display_latex(*objs, **kwargs):
204 """Display the LaTeX representation of an object.
243 """Display the LaTeX representation of an object.
205
244
206 Parameters
245 Parameters
207 ----------
246 ----------
208 *objs : object
247 *objs : object
209 The Python objects to display, or if raw=True raw latex data to
248 The Python objects to display, or if raw=True raw latex data to
210 display.
249 display.
211 raw : bool
250 raw : bool
212 Are the data objects raw data or Python objects that need to be
251 Are the data objects raw data or Python objects that need to be
213 formatted before display? [default: False]
252 formatted before display? [default: False]
214 metadata : dict (optional)
253 metadata : dict (optional)
215 Metadata to be associated with the specific mimetype output.
254 Metadata to be associated with the specific mimetype output.
216 """
255 """
217 _display_mimetype('text/latex', objs, **kwargs)
256 _display_mimetype('text/latex', objs, **kwargs)
218
257
219
258
220 def display_json(*objs, **kwargs):
259 def display_json(*objs, **kwargs):
221 """Display the JSON representation of an object.
260 """Display the JSON representation of an object.
222
261
223 Note that not many frontends support displaying JSON.
262 Note that not many frontends support displaying JSON.
224
263
225 Parameters
264 Parameters
226 ----------
265 ----------
227 *objs : object
266 *objs : object
228 The Python objects to display, or if raw=True raw json data to
267 The Python objects to display, or if raw=True raw json data to
229 display.
268 display.
230 raw : bool
269 raw : bool
231 Are the data objects raw data or Python objects that need to be
270 Are the data objects raw data or Python objects that need to be
232 formatted before display? [default: False]
271 formatted before display? [default: False]
233 metadata : dict (optional)
272 metadata : dict (optional)
234 Metadata to be associated with the specific mimetype output.
273 Metadata to be associated with the specific mimetype output.
235 """
274 """
236 _display_mimetype('application/json', objs, **kwargs)
275 _display_mimetype('application/json', objs, **kwargs)
237
276
238
277
239 def display_javascript(*objs, **kwargs):
278 def display_javascript(*objs, **kwargs):
240 """Display the Javascript representation of an object.
279 """Display the Javascript representation of an object.
241
280
242 Parameters
281 Parameters
243 ----------
282 ----------
244 *objs : object
283 *objs : object
245 The Python objects to display, or if raw=True raw javascript data to
284 The Python objects to display, or if raw=True raw javascript data to
246 display.
285 display.
247 raw : bool
286 raw : bool
248 Are the data objects raw data or Python objects that need to be
287 Are the data objects raw data or Python objects that need to be
249 formatted before display? [default: False]
288 formatted before display? [default: False]
250 metadata : dict (optional)
289 metadata : dict (optional)
251 Metadata to be associated with the specific mimetype output.
290 Metadata to be associated with the specific mimetype output.
252 """
291 """
253 _display_mimetype('application/javascript', objs, **kwargs)
292 _display_mimetype('application/javascript', objs, **kwargs)
254
293
255
294
256 def display_pdf(*objs, **kwargs):
295 def display_pdf(*objs, **kwargs):
257 """Display the PDF representation of an object.
296 """Display the PDF representation of an object.
258
297
259 Parameters
298 Parameters
260 ----------
299 ----------
261 *objs : object
300 *objs : object
262 The Python objects to display, or if raw=True raw javascript data to
301 The Python objects to display, or if raw=True raw javascript data to
263 display.
302 display.
264 raw : bool
303 raw : bool
265 Are the data objects raw data or Python objects that need to be
304 Are the data objects raw data or Python objects that need to be
266 formatted before display? [default: False]
305 formatted before display? [default: False]
267 metadata : dict (optional)
306 metadata : dict (optional)
268 Metadata to be associated with the specific mimetype output.
307 Metadata to be associated with the specific mimetype output.
269 """
308 """
270 _display_mimetype('application/pdf', objs, **kwargs)
309 _display_mimetype('application/pdf', objs, **kwargs)
271
310
272
311
273 #-----------------------------------------------------------------------------
312 #-----------------------------------------------------------------------------
274 # Smart classes
313 # Smart classes
275 #-----------------------------------------------------------------------------
314 #-----------------------------------------------------------------------------
276
315
277
316
278 class DisplayObject(object):
317 class DisplayObject(object):
279 """An object that wraps data to be displayed."""
318 """An object that wraps data to be displayed."""
280
319
281 _read_flags = 'r'
320 _read_flags = 'r'
282 _show_mem_addr = False
321 _show_mem_addr = False
283 metadata = None
322 metadata = None
284
323
285 def __init__(self, data=None, url=None, filename=None, metadata=None):
324 def __init__(self, data=None, url=None, filename=None, metadata=None):
286 """Create a display object given raw data.
325 """Create a display object given raw data.
287
326
288 When this object is returned by an expression or passed to the
327 When this object is returned by an expression or passed to the
289 display function, it will result in the data being displayed
328 display function, it will result in the data being displayed
290 in the frontend. The MIME type of the data should match the
329 in the frontend. The MIME type of the data should match the
291 subclasses used, so the Png subclass should be used for 'image/png'
330 subclasses used, so the Png subclass should be used for 'image/png'
292 data. If the data is a URL, the data will first be downloaded
331 data. If the data is a URL, the data will first be downloaded
293 and then displayed.
332 and then displayed.
294
333
295 Parameters
334 Parameters
296 ----------
335 ----------
297 data : unicode, str or bytes
336 data : unicode, str or bytes
298 The raw data or a URL or file to load the data from
337 The raw data or a URL or file to load the data from
299 url : unicode
338 url : unicode
300 A URL to download the data from.
339 A URL to download the data from.
301 filename : unicode
340 filename : unicode
302 Path to a local file to load the data from.
341 Path to a local file to load the data from.
303 metadata : dict
342 metadata : dict
304 Dict of metadata associated to be the object when displayed
343 Dict of metadata associated to be the object when displayed
305 """
344 """
306 if isinstance(data, (Path, PurePath)):
345 if isinstance(data, (Path, PurePath)):
307 data = str(data)
346 data = str(data)
308
347
309 if data is not None and isinstance(data, str):
348 if data is not None and isinstance(data, str):
310 if data.startswith('http') and url is None:
349 if data.startswith('http') and url is None:
311 url = data
350 url = data
312 filename = None
351 filename = None
313 data = None
352 data = None
314 elif _safe_exists(data) and filename is None:
353 elif _safe_exists(data) and filename is None:
315 url = None
354 url = None
316 filename = data
355 filename = data
317 data = None
356 data = None
318
357
319 self.url = url
358 self.url = url
320 self.filename = filename
359 self.filename = filename
321 # because of @data.setter methods in
360 # because of @data.setter methods in
322 # subclasses ensure url and filename are set
361 # subclasses ensure url and filename are set
323 # before assigning to self.data
362 # before assigning to self.data
324 self.data = data
363 self.data = data
325
364
326 if metadata is not None:
365 if metadata is not None:
327 self.metadata = metadata
366 self.metadata = metadata
328 elif self.metadata is None:
367 elif self.metadata is None:
329 self.metadata = {}
368 self.metadata = {}
330
369
331 self.reload()
370 self.reload()
332 self._check_data()
371 self._check_data()
333
372
334 def __repr__(self):
373 def __repr__(self):
335 if not self._show_mem_addr:
374 if not self._show_mem_addr:
336 cls = self.__class__
375 cls = self.__class__
337 r = "<%s.%s object>" % (cls.__module__, cls.__name__)
376 r = "<%s.%s object>" % (cls.__module__, cls.__name__)
338 else:
377 else:
339 r = super(DisplayObject, self).__repr__()
378 r = super(DisplayObject, self).__repr__()
340 return r
379 return r
341
380
342 def _check_data(self):
381 def _check_data(self):
343 """Override in subclasses if there's something to check."""
382 """Override in subclasses if there's something to check."""
344 pass
383 pass
345
384
346 def _data_and_metadata(self):
385 def _data_and_metadata(self):
347 """shortcut for returning metadata with shape information, if defined"""
386 """shortcut for returning metadata with shape information, if defined"""
348 if self.metadata:
387 if self.metadata:
349 return self.data, deepcopy(self.metadata)
388 return self.data, deepcopy(self.metadata)
350 else:
389 else:
351 return self.data
390 return self.data
352
391
353 def reload(self):
392 def reload(self):
354 """Reload the raw data from file or URL."""
393 """Reload the raw data from file or URL."""
355 if self.filename is not None:
394 if self.filename is not None:
356 encoding = None if "b" in self._read_flags else "utf-8"
395 encoding = None if "b" in self._read_flags else "utf-8"
357 with open(self.filename, self._read_flags, encoding=encoding) as f:
396 with open(self.filename, self._read_flags, encoding=encoding) as f:
358 self.data = f.read()
397 self.data = f.read()
359 elif self.url is not None:
398 elif self.url is not None:
360 # Deferred import
399 # Deferred import
361 from urllib.request import urlopen
400 from urllib.request import urlopen
362 response = urlopen(self.url)
401 response = urlopen(self.url)
363 data = response.read()
402 data = response.read()
364 # extract encoding from header, if there is one:
403 # extract encoding from header, if there is one:
365 encoding = None
404 encoding = None
366 if 'content-type' in response.headers:
405 if 'content-type' in response.headers:
367 for sub in response.headers['content-type'].split(';'):
406 for sub in response.headers['content-type'].split(';'):
368 sub = sub.strip()
407 sub = sub.strip()
369 if sub.startswith('charset'):
408 if sub.startswith('charset'):
370 encoding = sub.split('=')[-1].strip()
409 encoding = sub.split('=')[-1].strip()
371 break
410 break
372 if 'content-encoding' in response.headers:
411 if 'content-encoding' in response.headers:
373 # TODO: do deflate?
412 # TODO: do deflate?
374 if 'gzip' in response.headers['content-encoding']:
413 if 'gzip' in response.headers['content-encoding']:
375 import gzip
414 import gzip
376 from io import BytesIO
415 from io import BytesIO
377
416
378 # assume utf-8 if encoding is not specified
417 # assume utf-8 if encoding is not specified
379 with gzip.open(
418 with gzip.open(
380 BytesIO(data), "rt", encoding=encoding or "utf-8"
419 BytesIO(data), "rt", encoding=encoding or "utf-8"
381 ) as fp:
420 ) as fp:
382 encoding = None
421 encoding = None
383 data = fp.read()
422 data = fp.read()
384
423
385 # decode data, if an encoding was specified
424 # decode data, if an encoding was specified
386 # We only touch self.data once since
425 # We only touch self.data once since
387 # subclasses such as SVG have @data.setter methods
426 # subclasses such as SVG have @data.setter methods
388 # that transform self.data into ... well svg.
427 # that transform self.data into ... well svg.
389 if encoding:
428 if encoding:
390 self.data = data.decode(encoding, 'replace')
429 self.data = data.decode(encoding, 'replace')
391 else:
430 else:
392 self.data = data
431 self.data = data
393
432
394
433
395 class TextDisplayObject(DisplayObject):
434 class TextDisplayObject(DisplayObject):
396 """Create a text display object given raw data.
435 """Create a text display object given raw data.
397
436
398 Parameters
437 Parameters
399 ----------
438 ----------
400 data : str or unicode
439 data : str or unicode
401 The raw data or a URL or file to load the data from.
440 The raw data or a URL or file to load the data from.
402 url : unicode
441 url : unicode
403 A URL to download the data from.
442 A URL to download the data from.
404 filename : unicode
443 filename : unicode
405 Path to a local file to load the data from.
444 Path to a local file to load the data from.
406 metadata : dict
445 metadata : dict
407 Dict of metadata associated to be the object when displayed
446 Dict of metadata associated to be the object when displayed
408 """
447 """
409 def _check_data(self):
448 def _check_data(self):
410 if self.data is not None and not isinstance(self.data, str):
449 if self.data is not None and not isinstance(self.data, str):
411 raise TypeError("%s expects text, not %r" % (self.__class__.__name__, self.data))
450 raise TypeError("%s expects text, not %r" % (self.__class__.__name__, self.data))
412
451
413 class Pretty(TextDisplayObject):
452 class Pretty(TextDisplayObject):
414
453
415 def _repr_pretty_(self, pp, cycle):
454 def _repr_pretty_(self, pp, cycle):
416 return pp.text(self.data)
455 return pp.text(self.data)
417
456
418
457
419 class HTML(TextDisplayObject):
458 class HTML(TextDisplayObject):
420
459
421 def __init__(self, data=None, url=None, filename=None, metadata=None):
460 def __init__(self, data=None, url=None, filename=None, metadata=None):
422 def warn():
461 def warn():
423 if not data:
462 if not data:
424 return False
463 return False
425
464
426 #
465 #
427 # Avoid calling lower() on the entire data, because it could be a
466 # Avoid calling lower() on the entire data, because it could be a
428 # long string and we're only interested in its beginning and end.
467 # long string and we're only interested in its beginning and end.
429 #
468 #
430 prefix = data[:10].lower()
469 prefix = data[:10].lower()
431 suffix = data[-10:].lower()
470 suffix = data[-10:].lower()
432 return prefix.startswith("<iframe ") and suffix.endswith("</iframe>")
471 return prefix.startswith("<iframe ") and suffix.endswith("</iframe>")
433
472
434 if warn():
473 if warn():
435 warnings.warn("Consider using IPython.display.IFrame instead")
474 warnings.warn("Consider using IPython.display.IFrame instead")
436 super(HTML, self).__init__(data=data, url=url, filename=filename, metadata=metadata)
475 super(HTML, self).__init__(data=data, url=url, filename=filename, metadata=metadata)
437
476
438 def _repr_html_(self):
477 def _repr_html_(self):
439 return self._data_and_metadata()
478 return self._data_and_metadata()
440
479
441 def __html__(self):
480 def __html__(self):
442 """
481 """
443 This method exists to inform other HTML-using modules (e.g. Markupsafe,
482 This method exists to inform other HTML-using modules (e.g. Markupsafe,
444 htmltag, etc) that this object is HTML and does not need things like
483 htmltag, etc) that this object is HTML and does not need things like
445 special characters (<>&) escaped.
484 special characters (<>&) escaped.
446 """
485 """
447 return self._repr_html_()
486 return self._repr_html_()
448
487
449
488
450 class Markdown(TextDisplayObject):
489 class Markdown(TextDisplayObject):
451
490
452 def _repr_markdown_(self):
491 def _repr_markdown_(self):
453 return self._data_and_metadata()
492 return self._data_and_metadata()
454
493
455
494
456 class Math(TextDisplayObject):
495 class Math(TextDisplayObject):
457
496
458 def _repr_latex_(self):
497 def _repr_latex_(self):
459 s = r"$\displaystyle %s$" % self.data.strip('$')
498 s = r"$\displaystyle %s$" % self.data.strip('$')
460 if self.metadata:
499 if self.metadata:
461 return s, deepcopy(self.metadata)
500 return s, deepcopy(self.metadata)
462 else:
501 else:
463 return s
502 return s
464
503
465
504
466 class Latex(TextDisplayObject):
505 class Latex(TextDisplayObject):
467
506
468 def _repr_latex_(self):
507 def _repr_latex_(self):
469 return self._data_and_metadata()
508 return self._data_and_metadata()
470
509
471
510
472 class SVG(DisplayObject):
511 class SVG(DisplayObject):
473 """Embed an SVG into the display.
512 """Embed an SVG into the display.
474
513
475 Note if you just want to view a svg image via a URL use `:class:Image` with
514 Note if you just want to view a svg image via a URL use `:class:Image` with
476 a url=URL keyword argument.
515 a url=URL keyword argument.
477 """
516 """
478
517
479 _read_flags = 'rb'
518 _read_flags = 'rb'
480 # wrap data in a property, which extracts the <svg> tag, discarding
519 # wrap data in a property, which extracts the <svg> tag, discarding
481 # document headers
520 # document headers
482 _data = None
521 _data = None
483
522
484 @property
523 @property
485 def data(self):
524 def data(self):
486 return self._data
525 return self._data
487
526
488 @data.setter
527 @data.setter
489 def data(self, svg):
528 def data(self, svg):
490 if svg is None:
529 if svg is None:
491 self._data = None
530 self._data = None
492 return
531 return
493 # parse into dom object
532 # parse into dom object
494 from xml.dom import minidom
533 from xml.dom import minidom
495 x = minidom.parseString(svg)
534 x = minidom.parseString(svg)
496 # get svg tag (should be 1)
535 # get svg tag (should be 1)
497 found_svg = x.getElementsByTagName('svg')
536 found_svg = x.getElementsByTagName('svg')
498 if found_svg:
537 if found_svg:
499 svg = found_svg[0].toxml()
538 svg = found_svg[0].toxml()
500 else:
539 else:
501 # fallback on the input, trust the user
540 # fallback on the input, trust the user
502 # but this is probably an error.
541 # but this is probably an error.
503 pass
542 pass
504 svg = cast_unicode(svg)
543 svg = cast_unicode(svg)
505 self._data = svg
544 self._data = svg
506
545
507 def _repr_svg_(self):
546 def _repr_svg_(self):
508 return self._data_and_metadata()
547 return self._data_and_metadata()
509
548
510 class ProgressBar(DisplayObject):
549 class ProgressBar(DisplayObject):
511 """Progressbar supports displaying a progressbar like element
550 """Progressbar supports displaying a progressbar like element
512 """
551 """
513 def __init__(self, total):
552 def __init__(self, total):
514 """Creates a new progressbar
553 """Creates a new progressbar
515
554
516 Parameters
555 Parameters
517 ----------
556 ----------
518 total : int
557 total : int
519 maximum size of the progressbar
558 maximum size of the progressbar
520 """
559 """
521 self.total = total
560 self.total = total
522 self._progress = 0
561 self._progress = 0
523 self.html_width = '60ex'
562 self.html_width = '60ex'
524 self.text_width = 60
563 self.text_width = 60
525 self._display_id = hexlify(os.urandom(8)).decode('ascii')
564 self._display_id = hexlify(os.urandom(8)).decode('ascii')
526
565
527 def __repr__(self):
566 def __repr__(self):
528 fraction = self.progress / self.total
567 fraction = self.progress / self.total
529 filled = '=' * int(fraction * self.text_width)
568 filled = '=' * int(fraction * self.text_width)
530 rest = ' ' * (self.text_width - len(filled))
569 rest = ' ' * (self.text_width - len(filled))
531 return '[{}{}] {}/{}'.format(
570 return '[{}{}] {}/{}'.format(
532 filled, rest,
571 filled, rest,
533 self.progress, self.total,
572 self.progress, self.total,
534 )
573 )
535
574
536 def _repr_html_(self):
575 def _repr_html_(self):
537 return "<progress style='width:{}' max='{}' value='{}'></progress>".format(
576 return "<progress style='width:{}' max='{}' value='{}'></progress>".format(
538 self.html_width, self.total, self.progress)
577 self.html_width, self.total, self.progress)
539
578
540 def display(self):
579 def display(self):
541 display_functions.display(self, display_id=self._display_id)
580 display_functions.display(self, display_id=self._display_id)
542
581
543 def update(self):
582 def update(self):
544 display_functions.display(self, display_id=self._display_id, update=True)
583 display_functions.display(self, display_id=self._display_id, update=True)
545
584
546 @property
585 @property
547 def progress(self):
586 def progress(self):
548 return self._progress
587 return self._progress
549
588
550 @progress.setter
589 @progress.setter
551 def progress(self, value):
590 def progress(self, value):
552 self._progress = value
591 self._progress = value
553 self.update()
592 self.update()
554
593
555 def __iter__(self):
594 def __iter__(self):
556 self.display()
595 self.display()
557 self._progress = -1 # First iteration is 0
596 self._progress = -1 # First iteration is 0
558 return self
597 return self
559
598
560 def __next__(self):
599 def __next__(self):
561 """Returns current value and increments display by one."""
600 """Returns current value and increments display by one."""
562 self.progress += 1
601 self.progress += 1
563 if self.progress < self.total:
602 if self.progress < self.total:
564 return self.progress
603 return self.progress
565 else:
604 else:
566 raise StopIteration()
605 raise StopIteration()
567
606
568 class JSON(DisplayObject):
607 class JSON(DisplayObject):
569 """JSON expects a JSON-able dict or list
608 """JSON expects a JSON-able dict or list
570
609
571 not an already-serialized JSON string.
610 not an already-serialized JSON string.
572
611
573 Scalar types (None, number, string) are not allowed, only dict or list containers.
612 Scalar types (None, number, string) are not allowed, only dict or list containers.
574 """
613 """
575 # wrap data in a property, which warns about passing already-serialized JSON
614 # wrap data in a property, which warns about passing already-serialized JSON
576 _data = None
615 _data = None
577 def __init__(self, data=None, url=None, filename=None, expanded=False, metadata=None, root='root', **kwargs):
616 def __init__(self, data=None, url=None, filename=None, expanded=False, metadata=None, root='root', **kwargs):
578 """Create a JSON display object given raw data.
617 """Create a JSON display object given raw data.
579
618
580 Parameters
619 Parameters
581 ----------
620 ----------
582 data : dict or list
621 data : dict or list
583 JSON data to display. Not an already-serialized JSON string.
622 JSON data to display. Not an already-serialized JSON string.
584 Scalar types (None, number, string) are not allowed, only dict
623 Scalar types (None, number, string) are not allowed, only dict
585 or list containers.
624 or list containers.
586 url : unicode
625 url : unicode
587 A URL to download the data from.
626 A URL to download the data from.
588 filename : unicode
627 filename : unicode
589 Path to a local file to load the data from.
628 Path to a local file to load the data from.
590 expanded : boolean
629 expanded : boolean
591 Metadata to control whether a JSON display component is expanded.
630 Metadata to control whether a JSON display component is expanded.
592 metadata : dict
631 metadata : dict
593 Specify extra metadata to attach to the json display object.
632 Specify extra metadata to attach to the json display object.
594 root : str
633 root : str
595 The name of the root element of the JSON tree
634 The name of the root element of the JSON tree
596 """
635 """
597 self.metadata = {
636 self.metadata = {
598 'expanded': expanded,
637 'expanded': expanded,
599 'root': root,
638 'root': root,
600 }
639 }
601 if metadata:
640 if metadata:
602 self.metadata.update(metadata)
641 self.metadata.update(metadata)
603 if kwargs:
642 if kwargs:
604 self.metadata.update(kwargs)
643 self.metadata.update(kwargs)
605 super(JSON, self).__init__(data=data, url=url, filename=filename)
644 super(JSON, self).__init__(data=data, url=url, filename=filename)
606
645
607 def _check_data(self):
646 def _check_data(self):
608 if self.data is not None and not isinstance(self.data, (dict, list)):
647 if self.data is not None and not isinstance(self.data, (dict, list)):
609 raise TypeError("%s expects JSONable dict or list, not %r" % (self.__class__.__name__, self.data))
648 raise TypeError("%s expects JSONable dict or list, not %r" % (self.__class__.__name__, self.data))
610
649
611 @property
650 @property
612 def data(self):
651 def data(self):
613 return self._data
652 return self._data
614
653
615 @data.setter
654 @data.setter
616 def data(self, data):
655 def data(self, data):
617 if isinstance(data, (Path, PurePath)):
656 if isinstance(data, (Path, PurePath)):
618 data = str(data)
657 data = str(data)
619
658
620 if isinstance(data, str):
659 if isinstance(data, str):
621 if self.filename is None and self.url is None:
660 if self.filename is None and self.url is None:
622 warnings.warn("JSON expects JSONable dict or list, not JSON strings")
661 warnings.warn("JSON expects JSONable dict or list, not JSON strings")
623 data = json.loads(data)
662 data = json.loads(data)
624 self._data = data
663 self._data = data
625
664
626 def _data_and_metadata(self):
665 def _data_and_metadata(self):
627 return self.data, self.metadata
666 return self.data, self.metadata
628
667
629 def _repr_json_(self):
668 def _repr_json_(self):
630 return self._data_and_metadata()
669 return self._data_and_metadata()
631
670
632
671
633 _css_t = """var link = document.createElement("link");
672 _css_t = """var link = document.createElement("link");
634 link.rel = "stylesheet";
673 link.rel = "stylesheet";
635 link.type = "text/css";
674 link.type = "text/css";
636 link.href = "%s";
675 link.href = "%s";
637 document.head.appendChild(link);
676 document.head.appendChild(link);
638 """
677 """
639
678
640 _lib_t1 = """new Promise(function(resolve, reject) {
679 _lib_t1 = """new Promise(function(resolve, reject) {
641 var script = document.createElement("script");
680 var script = document.createElement("script");
642 script.onload = resolve;
681 script.onload = resolve;
643 script.onerror = reject;
682 script.onerror = reject;
644 script.src = "%s";
683 script.src = "%s";
645 document.head.appendChild(script);
684 document.head.appendChild(script);
646 }).then(() => {
685 }).then(() => {
647 """
686 """
648
687
649 _lib_t2 = """
688 _lib_t2 = """
650 });"""
689 });"""
651
690
652 class GeoJSON(JSON):
691 class GeoJSON(JSON):
653 """GeoJSON expects JSON-able dict
692 """GeoJSON expects JSON-able dict
654
693
655 not an already-serialized JSON string.
694 not an already-serialized JSON string.
656
695
657 Scalar types (None, number, string) are not allowed, only dict containers.
696 Scalar types (None, number, string) are not allowed, only dict containers.
658 """
697 """
659
698
660 def __init__(self, *args, **kwargs):
699 def __init__(self, *args, **kwargs):
661 """Create a GeoJSON display object given raw data.
700 """Create a GeoJSON display object given raw data.
662
701
663 Parameters
702 Parameters
664 ----------
703 ----------
665 data : dict or list
704 data : dict or list
666 VegaLite data. Not an already-serialized JSON string.
705 VegaLite data. Not an already-serialized JSON string.
667 Scalar types (None, number, string) are not allowed, only dict
706 Scalar types (None, number, string) are not allowed, only dict
668 or list containers.
707 or list containers.
669 url_template : string
708 url_template : string
670 Leaflet TileLayer URL template: http://leafletjs.com/reference.html#url-template
709 Leaflet TileLayer URL template: http://leafletjs.com/reference.html#url-template
671 layer_options : dict
710 layer_options : dict
672 Leaflet TileLayer options: http://leafletjs.com/reference.html#tilelayer-options
711 Leaflet TileLayer options: http://leafletjs.com/reference.html#tilelayer-options
673 url : unicode
712 url : unicode
674 A URL to download the data from.
713 A URL to download the data from.
675 filename : unicode
714 filename : unicode
676 Path to a local file to load the data from.
715 Path to a local file to load the data from.
677 metadata : dict
716 metadata : dict
678 Specify extra metadata to attach to the json display object.
717 Specify extra metadata to attach to the json display object.
679
718
680 Examples
719 Examples
681 --------
720 --------
682 The following will display an interactive map of Mars with a point of
721 The following will display an interactive map of Mars with a point of
683 interest on frontend that do support GeoJSON display.
722 interest on frontend that do support GeoJSON display.
684
723
685 >>> from IPython.display import GeoJSON
724 >>> from IPython.display import GeoJSON
686
725
687 >>> GeoJSON(data={
726 >>> GeoJSON(data={
688 ... "type": "Feature",
727 ... "type": "Feature",
689 ... "geometry": {
728 ... "geometry": {
690 ... "type": "Point",
729 ... "type": "Point",
691 ... "coordinates": [-81.327, 296.038]
730 ... "coordinates": [-81.327, 296.038]
692 ... }
731 ... }
693 ... },
732 ... },
694 ... url_template="http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png",
733 ... url_template="http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png",
695 ... layer_options={
734 ... layer_options={
696 ... "basemap_id": "celestia_mars-shaded-16k_global",
735 ... "basemap_id": "celestia_mars-shaded-16k_global",
697 ... "attribution" : "Celestia/praesepe",
736 ... "attribution" : "Celestia/praesepe",
698 ... "minZoom" : 0,
737 ... "minZoom" : 0,
699 ... "maxZoom" : 18,
738 ... "maxZoom" : 18,
700 ... })
739 ... })
701 <IPython.core.display.GeoJSON object>
740 <IPython.core.display.GeoJSON object>
702
741
703 In the terminal IPython, you will only see the text representation of
742 In the terminal IPython, you will only see the text representation of
704 the GeoJSON object.
743 the GeoJSON object.
705
744
706 """
745 """
707
746
708 super(GeoJSON, self).__init__(*args, **kwargs)
747 super(GeoJSON, self).__init__(*args, **kwargs)
709
748
710
749
711 def _ipython_display_(self):
750 def _ipython_display_(self):
712 bundle = {
751 bundle = {
713 'application/geo+json': self.data,
752 'application/geo+json': self.data,
714 'text/plain': '<IPython.display.GeoJSON object>'
753 'text/plain': '<IPython.display.GeoJSON object>'
715 }
754 }
716 metadata = {
755 metadata = {
717 'application/geo+json': self.metadata
756 'application/geo+json': self.metadata
718 }
757 }
719 display_functions.display(bundle, metadata=metadata, raw=True)
758 display_functions.display(bundle, metadata=metadata, raw=True)
720
759
721 class Javascript(TextDisplayObject):
760 class Javascript(TextDisplayObject):
722
761
723 def __init__(self, data=None, url=None, filename=None, lib=None, css=None):
762 def __init__(self, data=None, url=None, filename=None, lib=None, css=None):
724 """Create a Javascript display object given raw data.
763 """Create a Javascript display object given raw data.
725
764
726 When this object is returned by an expression or passed to the
765 When this object is returned by an expression or passed to the
727 display function, it will result in the data being displayed
766 display function, it will result in the data being displayed
728 in the frontend. If the data is a URL, the data will first be
767 in the frontend. If the data is a URL, the data will first be
729 downloaded and then displayed.
768 downloaded and then displayed.
730
769
731 In the Notebook, the containing element will be available as `element`,
770 In the Notebook, the containing element will be available as `element`,
732 and jQuery will be available. Content appended to `element` will be
771 and jQuery will be available. Content appended to `element` will be
733 visible in the output area.
772 visible in the output area.
734
773
735 Parameters
774 Parameters
736 ----------
775 ----------
737 data : unicode, str or bytes
776 data : unicode, str or bytes
738 The Javascript source code or a URL to download it from.
777 The Javascript source code or a URL to download it from.
739 url : unicode
778 url : unicode
740 A URL to download the data from.
779 A URL to download the data from.
741 filename : unicode
780 filename : unicode
742 Path to a local file to load the data from.
781 Path to a local file to load the data from.
743 lib : list or str
782 lib : list or str
744 A sequence of Javascript library URLs to load asynchronously before
783 A sequence of Javascript library URLs to load asynchronously before
745 running the source code. The full URLs of the libraries should
784 running the source code. The full URLs of the libraries should
746 be given. A single Javascript library URL can also be given as a
785 be given. A single Javascript library URL can also be given as a
747 string.
786 string.
748 css : list or str
787 css : list or str
749 A sequence of css files to load before running the source code.
788 A sequence of css files to load before running the source code.
750 The full URLs of the css files should be given. A single css URL
789 The full URLs of the css files should be given. A single css URL
751 can also be given as a string.
790 can also be given as a string.
752 """
791 """
753 if isinstance(lib, str):
792 if isinstance(lib, str):
754 lib = [lib]
793 lib = [lib]
755 elif lib is None:
794 elif lib is None:
756 lib = []
795 lib = []
757 if isinstance(css, str):
796 if isinstance(css, str):
758 css = [css]
797 css = [css]
759 elif css is None:
798 elif css is None:
760 css = []
799 css = []
761 if not isinstance(lib, (list,tuple)):
800 if not isinstance(lib, (list,tuple)):
762 raise TypeError('expected sequence, got: %r' % lib)
801 raise TypeError('expected sequence, got: %r' % lib)
763 if not isinstance(css, (list,tuple)):
802 if not isinstance(css, (list,tuple)):
764 raise TypeError('expected sequence, got: %r' % css)
803 raise TypeError('expected sequence, got: %r' % css)
765 self.lib = lib
804 self.lib = lib
766 self.css = css
805 self.css = css
767 super(Javascript, self).__init__(data=data, url=url, filename=filename)
806 super(Javascript, self).__init__(data=data, url=url, filename=filename)
768
807
769 def _repr_javascript_(self):
808 def _repr_javascript_(self):
770 r = ''
809 r = ''
771 for c in self.css:
810 for c in self.css:
772 r += _css_t % c
811 r += _css_t % c
773 for l in self.lib:
812 for l in self.lib:
774 r += _lib_t1 % l
813 r += _lib_t1 % l
775 r += self.data
814 r += self.data
776 r += _lib_t2*len(self.lib)
815 r += _lib_t2*len(self.lib)
777 return r
816 return r
778
817
779 # constants for identifying png/jpeg data
818
780 _PNG = b'\x89PNG\r\n\x1a\n'
819 # constants for identifying png/jpeg/gif/webp data
781 _JPEG = b'\xff\xd8'
820 _PNG = b"\x89PNG\r\n\x1a\n"
821 _JPEG = b"\xff\xd8"
822 _GIF1 = b"GIF87a"
823 _GIF2 = b"GIF89a"
824 _WEBP = b"WEBP"
825
782
826
783 def _pngxy(data):
827 def _pngxy(data):
784 """read the (width, height) from a PNG header"""
828 """read the (width, height) from a PNG header"""
785 ihdr = data.index(b'IHDR')
829 ihdr = data.index(b'IHDR')
786 # next 8 bytes are width/height
830 # next 8 bytes are width/height
787 return struct.unpack('>ii', data[ihdr+4:ihdr+12])
831 return struct.unpack('>ii', data[ihdr+4:ihdr+12])
788
832
833
789 def _jpegxy(data):
834 def _jpegxy(data):
790 """read the (width, height) from a JPEG header"""
835 """read the (width, height) from a JPEG header"""
791 # adapted from http://www.64lines.com/jpeg-width-height
836 # adapted from http://www.64lines.com/jpeg-width-height
792
837
793 idx = 4
838 idx = 4
794 while True:
839 while True:
795 block_size = struct.unpack('>H', data[idx:idx+2])[0]
840 block_size = struct.unpack('>H', data[idx:idx+2])[0]
796 idx = idx + block_size
841 idx = idx + block_size
797 if data[idx:idx+2] == b'\xFF\xC0':
842 if data[idx:idx+2] == b'\xFF\xC0':
798 # found Start of Frame
843 # found Start of Frame
799 iSOF = idx
844 iSOF = idx
800 break
845 break
801 else:
846 else:
802 # read another block
847 # read another block
803 idx += 2
848 idx += 2
804
849
805 h, w = struct.unpack('>HH', data[iSOF+5:iSOF+9])
850 h, w = struct.unpack('>HH', data[iSOF+5:iSOF+9])
806 return w, h
851 return w, h
807
852
853
808 def _gifxy(data):
854 def _gifxy(data):
809 """read the (width, height) from a GIF header"""
855 """read the (width, height) from a GIF header"""
810 return struct.unpack('<HH', data[6:10])
856 return struct.unpack('<HH', data[6:10])
811
857
812
858
859 def _webpxy(data):
860 """read the (width, height) from a WEBP header"""
861 if data[12:16] == b"VP8 ":
862 width, height = struct.unpack("<HH", data[24:30])
863 width = width & 0x3FFF
864 height = height & 0x3FFF
865 return (width, height)
866 elif data[12:16] == b"VP8L":
867 size_info = struct.unpack("<I", data[21:25])[0]
868 width = 1 + ((size_info & 0x3F) << 8) | (size_info >> 24)
869 height = 1 + (
870 (((size_info >> 8) & 0xF) << 10)
871 | (((size_info >> 14) & 0x3FC) << 2)
872 | ((size_info >> 22) & 0x3)
873 )
874 return (width, height)
875 else:
876 raise ValueError("Not a valid WEBP header")
877
878
813 class Image(DisplayObject):
879 class Image(DisplayObject):
814
880
815 _read_flags = 'rb'
881 _read_flags = "rb"
816 _FMT_JPEG = u'jpeg'
882 _FMT_JPEG = "jpeg"
817 _FMT_PNG = u'png'
883 _FMT_PNG = "png"
818 _FMT_GIF = u'gif'
884 _FMT_GIF = "gif"
819 _ACCEPTABLE_EMBEDDINGS = [_FMT_JPEG, _FMT_PNG, _FMT_GIF]
885 _FMT_WEBP = "webp"
886 _ACCEPTABLE_EMBEDDINGS = [_FMT_JPEG, _FMT_PNG, _FMT_GIF, _FMT_WEBP]
820 _MIMETYPES = {
887 _MIMETYPES = {
821 _FMT_PNG: 'image/png',
888 _FMT_PNG: "image/png",
822 _FMT_JPEG: 'image/jpeg',
889 _FMT_JPEG: "image/jpeg",
823 _FMT_GIF: 'image/gif',
890 _FMT_GIF: "image/gif",
891 _FMT_WEBP: "image/webp",
824 }
892 }
825
893
826 def __init__(
894 def __init__(
827 self,
895 self,
828 data=None,
896 data=None,
829 url=None,
897 url=None,
830 filename=None,
898 filename=None,
831 format=None,
899 format=None,
832 embed=None,
900 embed=None,
833 width=None,
901 width=None,
834 height=None,
902 height=None,
835 retina=False,
903 retina=False,
836 unconfined=False,
904 unconfined=False,
837 metadata=None,
905 metadata=None,
838 alt=None,
906 alt=None,
839 ):
907 ):
840 """Create a PNG/JPEG/GIF image object given raw data.
908 """Create a PNG/JPEG/GIF/WEBP image object given raw data.
841
909
842 When this object is returned by an input cell or passed to the
910 When this object is returned by an input cell or passed to the
843 display function, it will result in the image being displayed
911 display function, it will result in the image being displayed
844 in the frontend.
912 in the frontend.
845
913
846 Parameters
914 Parameters
847 ----------
915 ----------
848 data : unicode, str or bytes
916 data : unicode, str or bytes
849 The raw image data or a URL or filename to load the data from.
917 The raw image data or a URL or filename to load the data from.
850 This always results in embedded image data.
918 This always results in embedded image data.
851
919
852 url : unicode
920 url : unicode
853 A URL to download the data from. If you specify `url=`,
921 A URL to download the data from. If you specify `url=`,
854 the image data will not be embedded unless you also specify `embed=True`.
922 the image data will not be embedded unless you also specify `embed=True`.
855
923
856 filename : unicode
924 filename : unicode
857 Path to a local file to load the data from.
925 Path to a local file to load the data from.
858 Images from a file are always embedded.
926 Images from a file are always embedded.
859
927
860 format : unicode
928 format : unicode
861 The format of the image data (png/jpeg/jpg/gif). If a filename or URL is given
929 The format of the image data (png/jpeg/jpg/gif/webp). If a filename or URL is given
862 for format will be inferred from the filename extension.
930 for format will be inferred from the filename extension.
863
931
864 embed : bool
932 embed : bool
865 Should the image data be embedded using a data URI (True) or be
933 Should the image data be embedded using a data URI (True) or be
866 loaded using an <img> tag. Set this to True if you want the image
934 loaded using an <img> tag. Set this to True if you want the image
867 to be viewable later with no internet connection in the notebook.
935 to be viewable later with no internet connection in the notebook.
868
936
869 Default is `True`, unless the keyword argument `url` is set, then
937 Default is `True`, unless the keyword argument `url` is set, then
870 default value is `False`.
938 default value is `False`.
871
939
872 Note that QtConsole is not able to display images if `embed` is set to `False`
940 Note that QtConsole is not able to display images if `embed` is set to `False`
873
941
874 width : int
942 width : int
875 Width in pixels to which to constrain the image in html
943 Width in pixels to which to constrain the image in html
876
944
877 height : int
945 height : int
878 Height in pixels to which to constrain the image in html
946 Height in pixels to which to constrain the image in html
879
947
880 retina : bool
948 retina : bool
881 Automatically set the width and height to half of the measured
949 Automatically set the width and height to half of the measured
882 width and height.
950 width and height.
883 This only works for embedded images because it reads the width/height
951 This only works for embedded images because it reads the width/height
884 from image data.
952 from image data.
885 For non-embedded images, you can just set the desired display width
953 For non-embedded images, you can just set the desired display width
886 and height directly.
954 and height directly.
887
955
888 unconfined : bool
956 unconfined : bool
889 Set unconfined=True to disable max-width confinement of the image.
957 Set unconfined=True to disable max-width confinement of the image.
890
958
891 metadata : dict
959 metadata : dict
892 Specify extra metadata to attach to the image.
960 Specify extra metadata to attach to the image.
893
961
894 alt : unicode
962 alt : unicode
895 Alternative text for the image, for use by screen readers.
963 Alternative text for the image, for use by screen readers.
896
964
897 Examples
965 Examples
898 --------
966 --------
899 embedded image data, works in qtconsole and notebook
967 embedded image data, works in qtconsole and notebook
900 when passed positionally, the first arg can be any of raw image data,
968 when passed positionally, the first arg can be any of raw image data,
901 a URL, or a filename from which to load image data.
969 a URL, or a filename from which to load image data.
902 The result is always embedding image data for inline images.
970 The result is always embedding image data for inline images.
903
971
904 >>> Image('https://www.google.fr/images/srpr/logo3w.png') # doctest: +SKIP
972 >>> Image('https://www.google.fr/images/srpr/logo3w.png') # doctest: +SKIP
905 <IPython.core.display.Image object>
973 <IPython.core.display.Image object>
906
974
907 >>> Image('/path/to/image.jpg')
975 >>> Image('/path/to/image.jpg')
908 <IPython.core.display.Image object>
976 <IPython.core.display.Image object>
909
977
910 >>> Image(b'RAW_PNG_DATA...')
978 >>> Image(b'RAW_PNG_DATA...')
911 <IPython.core.display.Image object>
979 <IPython.core.display.Image object>
912
980
913 Specifying Image(url=...) does not embed the image data,
981 Specifying Image(url=...) does not embed the image data,
914 it only generates ``<img>`` tag with a link to the source.
982 it only generates ``<img>`` tag with a link to the source.
915 This will not work in the qtconsole or offline.
983 This will not work in the qtconsole or offline.
916
984
917 >>> Image(url='https://www.google.fr/images/srpr/logo3w.png')
985 >>> Image(url='https://www.google.fr/images/srpr/logo3w.png')
918 <IPython.core.display.Image object>
986 <IPython.core.display.Image object>
919
987
920 """
988 """
921 if isinstance(data, (Path, PurePath)):
989 if isinstance(data, (Path, PurePath)):
922 data = str(data)
990 data = str(data)
923
991
924 if filename is not None:
992 if filename is not None:
925 ext = self._find_ext(filename)
993 ext = self._find_ext(filename)
926 elif url is not None:
994 elif url is not None:
927 ext = self._find_ext(url)
995 ext = self._find_ext(url)
928 elif data is None:
996 elif data is None:
929 raise ValueError("No image data found. Expecting filename, url, or data.")
997 raise ValueError("No image data found. Expecting filename, url, or data.")
930 elif isinstance(data, str) and (
998 elif isinstance(data, str) and (
931 data.startswith('http') or _safe_exists(data)
999 data.startswith('http') or _safe_exists(data)
932 ):
1000 ):
933 ext = self._find_ext(data)
1001 ext = self._find_ext(data)
934 else:
1002 else:
935 ext = None
1003 ext = None
936
1004
937 if format is None:
1005 if format is None:
938 if ext is not None:
1006 if ext is not None:
939 if ext == u'jpg' or ext == u'jpeg':
1007 if ext == u'jpg' or ext == u'jpeg':
940 format = self._FMT_JPEG
1008 format = self._FMT_JPEG
941 elif ext == u'png':
1009 elif ext == u'png':
942 format = self._FMT_PNG
1010 format = self._FMT_PNG
943 elif ext == u'gif':
1011 elif ext == u'gif':
944 format = self._FMT_GIF
1012 format = self._FMT_GIF
1013 elif ext == "webp":
1014 format = self._FMT_WEBP
945 else:
1015 else:
946 format = ext.lower()
1016 format = ext.lower()
947 elif isinstance(data, bytes):
1017 elif isinstance(data, bytes):
948 # infer image type from image data header,
1018 # infer image type from image data header,
949 # only if format has not been specified.
1019 # only if format has not been specified.
950 if data[:2] == _JPEG:
1020 if data[:2] == _JPEG:
951 format = self._FMT_JPEG
1021 format = self._FMT_JPEG
1022 elif data[:8] == _PNG:
1023 format = self._FMT_PNG
1024 elif data[8:12] == _WEBP:
1025 format = self._FMT_WEBP
1026 elif data[:6] == _GIF1 or data[:6] == _GIF2:
1027 format = self._FMT_GIF
952
1028
953 # failed to detect format, default png
1029 # failed to detect format, default png
954 if format is None:
1030 if format is None:
955 format = self._FMT_PNG
1031 format = self._FMT_PNG
956
1032
957 if format.lower() == 'jpg':
1033 if format.lower() == 'jpg':
958 # jpg->jpeg
1034 # jpg->jpeg
959 format = self._FMT_JPEG
1035 format = self._FMT_JPEG
960
1036
961 self.format = format.lower()
1037 self.format = format.lower()
962 self.embed = embed if embed is not None else (url is None)
1038 self.embed = embed if embed is not None else (url is None)
963
1039
964 if self.embed and self.format not in self._ACCEPTABLE_EMBEDDINGS:
1040 if self.embed and self.format not in self._ACCEPTABLE_EMBEDDINGS:
965 raise ValueError("Cannot embed the '%s' image format" % (self.format))
1041 raise ValueError("Cannot embed the '%s' image format" % (self.format))
966 if self.embed:
1042 if self.embed:
967 self._mimetype = self._MIMETYPES.get(self.format)
1043 self._mimetype = self._MIMETYPES.get(self.format)
968
1044
969 self.width = width
1045 self.width = width
970 self.height = height
1046 self.height = height
971 self.retina = retina
1047 self.retina = retina
972 self.unconfined = unconfined
1048 self.unconfined = unconfined
973 self.alt = alt
1049 self.alt = alt
974 super(Image, self).__init__(data=data, url=url, filename=filename,
1050 super(Image, self).__init__(data=data, url=url, filename=filename,
975 metadata=metadata)
1051 metadata=metadata)
976
1052
977 if self.width is None and self.metadata.get('width', {}):
1053 if self.width is None and self.metadata.get('width', {}):
978 self.width = metadata['width']
1054 self.width = metadata['width']
979
1055
980 if self.height is None and self.metadata.get('height', {}):
1056 if self.height is None and self.metadata.get('height', {}):
981 self.height = metadata['height']
1057 self.height = metadata['height']
982
1058
983 if self.alt is None and self.metadata.get("alt", {}):
1059 if self.alt is None and self.metadata.get("alt", {}):
984 self.alt = metadata["alt"]
1060 self.alt = metadata["alt"]
985
1061
986 if retina:
1062 if retina:
987 self._retina_shape()
1063 self._retina_shape()
988
1064
989
1065
990 def _retina_shape(self):
1066 def _retina_shape(self):
991 """load pixel-doubled width and height from image data"""
1067 """load pixel-doubled width and height from image data"""
992 if not self.embed:
1068 if not self.embed:
993 return
1069 return
994 if self.format == self._FMT_PNG:
1070 if self.format == self._FMT_PNG:
995 w, h = _pngxy(self.data)
1071 w, h = _pngxy(self.data)
996 elif self.format == self._FMT_JPEG:
1072 elif self.format == self._FMT_JPEG:
997 w, h = _jpegxy(self.data)
1073 w, h = _jpegxy(self.data)
998 elif self.format == self._FMT_GIF:
1074 elif self.format == self._FMT_GIF:
999 w, h = _gifxy(self.data)
1075 w, h = _gifxy(self.data)
1000 else:
1076 else:
1001 # retina only supports png
1077 # retina only supports png
1002 return
1078 return
1003 self.width = w // 2
1079 self.width = w // 2
1004 self.height = h // 2
1080 self.height = h // 2
1005
1081
1006 def reload(self):
1082 def reload(self):
1007 """Reload the raw data from file or URL."""
1083 """Reload the raw data from file or URL."""
1008 if self.embed:
1084 if self.embed:
1009 super(Image,self).reload()
1085 super(Image,self).reload()
1010 if self.retina:
1086 if self.retina:
1011 self._retina_shape()
1087 self._retina_shape()
1012
1088
1013 def _repr_html_(self):
1089 def _repr_html_(self):
1014 if not self.embed:
1090 if not self.embed:
1015 width = height = klass = alt = ""
1091 width = height = klass = alt = ""
1016 if self.width:
1092 if self.width:
1017 width = ' width="%d"' % self.width
1093 width = ' width="%d"' % self.width
1018 if self.height:
1094 if self.height:
1019 height = ' height="%d"' % self.height
1095 height = ' height="%d"' % self.height
1020 if self.unconfined:
1096 if self.unconfined:
1021 klass = ' class="unconfined"'
1097 klass = ' class="unconfined"'
1022 if self.alt:
1098 if self.alt:
1023 alt = ' alt="%s"' % html.escape(self.alt)
1099 alt = ' alt="%s"' % html.escape(self.alt)
1024 return '<img src="{url}"{width}{height}{klass}{alt}/>'.format(
1100 return '<img src="{url}"{width}{height}{klass}{alt}/>'.format(
1025 url=self.url,
1101 url=self.url,
1026 width=width,
1102 width=width,
1027 height=height,
1103 height=height,
1028 klass=klass,
1104 klass=klass,
1029 alt=alt,
1105 alt=alt,
1030 )
1106 )
1031
1107
1032 def _repr_mimebundle_(self, include=None, exclude=None):
1108 def _repr_mimebundle_(self, include=None, exclude=None):
1033 """Return the image as a mimebundle
1109 """Return the image as a mimebundle
1034
1110
1035 Any new mimetype support should be implemented here.
1111 Any new mimetype support should be implemented here.
1036 """
1112 """
1037 if self.embed:
1113 if self.embed:
1038 mimetype = self._mimetype
1114 mimetype = self._mimetype
1039 data, metadata = self._data_and_metadata(always_both=True)
1115 data, metadata = self._data_and_metadata(always_both=True)
1040 if metadata:
1116 if metadata:
1041 metadata = {mimetype: metadata}
1117 metadata = {mimetype: metadata}
1042 return {mimetype: data}, metadata
1118 return {mimetype: data}, metadata
1043 else:
1119 else:
1044 return {'text/html': self._repr_html_()}
1120 return {'text/html': self._repr_html_()}
1045
1121
1046 def _data_and_metadata(self, always_both=False):
1122 def _data_and_metadata(self, always_both=False):
1047 """shortcut for returning metadata with shape information, if defined"""
1123 """shortcut for returning metadata with shape information, if defined"""
1048 try:
1124 try:
1049 b64_data = b2a_base64(self.data, newline=False).decode("ascii")
1125 b64_data = b2a_base64(self.data, newline=False).decode("ascii")
1050 except TypeError as e:
1126 except TypeError as e:
1051 raise FileNotFoundError(
1127 raise FileNotFoundError(
1052 "No such file or directory: '%s'" % (self.data)) from e
1128 "No such file or directory: '%s'" % (self.data)) from e
1053 md = {}
1129 md = {}
1054 if self.metadata:
1130 if self.metadata:
1055 md.update(self.metadata)
1131 md.update(self.metadata)
1056 if self.width:
1132 if self.width:
1057 md['width'] = self.width
1133 md['width'] = self.width
1058 if self.height:
1134 if self.height:
1059 md['height'] = self.height
1135 md['height'] = self.height
1060 if self.unconfined:
1136 if self.unconfined:
1061 md['unconfined'] = self.unconfined
1137 md['unconfined'] = self.unconfined
1062 if self.alt:
1138 if self.alt:
1063 md["alt"] = self.alt
1139 md["alt"] = self.alt
1064 if md or always_both:
1140 if md or always_both:
1065 return b64_data, md
1141 return b64_data, md
1066 else:
1142 else:
1067 return b64_data
1143 return b64_data
1068
1144
1069 def _repr_png_(self):
1145 def _repr_png_(self):
1070 if self.embed and self.format == self._FMT_PNG:
1146 if self.embed and self.format == self._FMT_PNG:
1071 return self._data_and_metadata()
1147 return self._data_and_metadata()
1072
1148
1073 def _repr_jpeg_(self):
1149 def _repr_jpeg_(self):
1074 if self.embed and self.format == self._FMT_JPEG:
1150 if self.embed and self.format == self._FMT_JPEG:
1075 return self._data_and_metadata()
1151 return self._data_and_metadata()
1076
1152
1077 def _find_ext(self, s):
1153 def _find_ext(self, s):
1078 base, ext = splitext(s)
1154 base, ext = splitext(s)
1079
1155
1080 if not ext:
1156 if not ext:
1081 return base
1157 return base
1082
1158
1083 # `splitext` includes leading period, so we skip it
1159 # `splitext` includes leading period, so we skip it
1084 return ext[1:].lower()
1160 return ext[1:].lower()
1085
1161
1086
1162
1087 class Video(DisplayObject):
1163 class Video(DisplayObject):
1088
1164
1089 def __init__(self, data=None, url=None, filename=None, embed=False,
1165 def __init__(self, data=None, url=None, filename=None, embed=False,
1090 mimetype=None, width=None, height=None, html_attributes="controls"):
1166 mimetype=None, width=None, height=None, html_attributes="controls"):
1091 """Create a video object given raw data or an URL.
1167 """Create a video object given raw data or an URL.
1092
1168
1093 When this object is returned by an input cell or passed to the
1169 When this object is returned by an input cell or passed to the
1094 display function, it will result in the video being displayed
1170 display function, it will result in the video being displayed
1095 in the frontend.
1171 in the frontend.
1096
1172
1097 Parameters
1173 Parameters
1098 ----------
1174 ----------
1099 data : unicode, str or bytes
1175 data : unicode, str or bytes
1100 The raw video data or a URL or filename to load the data from.
1176 The raw video data or a URL or filename to load the data from.
1101 Raw data will require passing ``embed=True``.
1177 Raw data will require passing ``embed=True``.
1102
1178
1103 url : unicode
1179 url : unicode
1104 A URL for the video. If you specify ``url=``,
1180 A URL for the video. If you specify ``url=``,
1105 the image data will not be embedded.
1181 the image data will not be embedded.
1106
1182
1107 filename : unicode
1183 filename : unicode
1108 Path to a local file containing the video.
1184 Path to a local file containing the video.
1109 Will be interpreted as a local URL unless ``embed=True``.
1185 Will be interpreted as a local URL unless ``embed=True``.
1110
1186
1111 embed : bool
1187 embed : bool
1112 Should the video be embedded using a data URI (True) or be
1188 Should the video be embedded using a data URI (True) or be
1113 loaded using a <video> tag (False).
1189 loaded using a <video> tag (False).
1114
1190
1115 Since videos are large, embedding them should be avoided, if possible.
1191 Since videos are large, embedding them should be avoided, if possible.
1116 You must confirm embedding as your intention by passing ``embed=True``.
1192 You must confirm embedding as your intention by passing ``embed=True``.
1117
1193
1118 Local files can be displayed with URLs without embedding the content, via::
1194 Local files can be displayed with URLs without embedding the content, via::
1119
1195
1120 Video('./video.mp4')
1196 Video('./video.mp4')
1121
1197
1122 mimetype : unicode
1198 mimetype : unicode
1123 Specify the mimetype for embedded videos.
1199 Specify the mimetype for embedded videos.
1124 Default will be guessed from file extension, if available.
1200 Default will be guessed from file extension, if available.
1125
1201
1126 width : int
1202 width : int
1127 Width in pixels to which to constrain the video in HTML.
1203 Width in pixels to which to constrain the video in HTML.
1128 If not supplied, defaults to the width of the video.
1204 If not supplied, defaults to the width of the video.
1129
1205
1130 height : int
1206 height : int
1131 Height in pixels to which to constrain the video in html.
1207 Height in pixels to which to constrain the video in html.
1132 If not supplied, defaults to the height of the video.
1208 If not supplied, defaults to the height of the video.
1133
1209
1134 html_attributes : str
1210 html_attributes : str
1135 Attributes for the HTML ``<video>`` block.
1211 Attributes for the HTML ``<video>`` block.
1136 Default: ``"controls"`` to get video controls.
1212 Default: ``"controls"`` to get video controls.
1137 Other examples: ``"controls muted"`` for muted video with controls,
1213 Other examples: ``"controls muted"`` for muted video with controls,
1138 ``"loop autoplay"`` for looping autoplaying video without controls.
1214 ``"loop autoplay"`` for looping autoplaying video without controls.
1139
1215
1140 Examples
1216 Examples
1141 --------
1217 --------
1142 ::
1218 ::
1143
1219
1144 Video('https://archive.org/download/Sita_Sings_the_Blues/Sita_Sings_the_Blues_small.mp4')
1220 Video('https://archive.org/download/Sita_Sings_the_Blues/Sita_Sings_the_Blues_small.mp4')
1145 Video('path/to/video.mp4')
1221 Video('path/to/video.mp4')
1146 Video('path/to/video.mp4', embed=True)
1222 Video('path/to/video.mp4', embed=True)
1147 Video('path/to/video.mp4', embed=True, html_attributes="controls muted autoplay")
1223 Video('path/to/video.mp4', embed=True, html_attributes="controls muted autoplay")
1148 Video(b'raw-videodata', embed=True)
1224 Video(b'raw-videodata', embed=True)
1149 """
1225 """
1150 if isinstance(data, (Path, PurePath)):
1226 if isinstance(data, (Path, PurePath)):
1151 data = str(data)
1227 data = str(data)
1152
1228
1153 if url is None and isinstance(data, str) and data.startswith(('http:', 'https:')):
1229 if url is None and isinstance(data, str) and data.startswith(('http:', 'https:')):
1154 url = data
1230 url = data
1155 data = None
1231 data = None
1156 elif data is not None and os.path.exists(data):
1232 elif data is not None and os.path.exists(data):
1157 filename = data
1233 filename = data
1158 data = None
1234 data = None
1159
1235
1160 if data and not embed:
1236 if data and not embed:
1161 msg = ''.join([
1237 msg = ''.join([
1162 "To embed videos, you must pass embed=True ",
1238 "To embed videos, you must pass embed=True ",
1163 "(this may make your notebook files huge)\n",
1239 "(this may make your notebook files huge)\n",
1164 "Consider passing Video(url='...')",
1240 "Consider passing Video(url='...')",
1165 ])
1241 ])
1166 raise ValueError(msg)
1242 raise ValueError(msg)
1167
1243
1168 self.mimetype = mimetype
1244 self.mimetype = mimetype
1169 self.embed = embed
1245 self.embed = embed
1170 self.width = width
1246 self.width = width
1171 self.height = height
1247 self.height = height
1172 self.html_attributes = html_attributes
1248 self.html_attributes = html_attributes
1173 super(Video, self).__init__(data=data, url=url, filename=filename)
1249 super(Video, self).__init__(data=data, url=url, filename=filename)
1174
1250
1175 def _repr_html_(self):
1251 def _repr_html_(self):
1176 width = height = ''
1252 width = height = ''
1177 if self.width:
1253 if self.width:
1178 width = ' width="%d"' % self.width
1254 width = ' width="%d"' % self.width
1179 if self.height:
1255 if self.height:
1180 height = ' height="%d"' % self.height
1256 height = ' height="%d"' % self.height
1181
1257
1182 # External URLs and potentially local files are not embedded into the
1258 # External URLs and potentially local files are not embedded into the
1183 # notebook output.
1259 # notebook output.
1184 if not self.embed:
1260 if not self.embed:
1185 url = self.url if self.url is not None else self.filename
1261 url = self.url if self.url is not None else self.filename
1186 output = """<video src="{0}" {1} {2} {3}>
1262 output = """<video src="{0}" {1} {2} {3}>
1187 Your browser does not support the <code>video</code> element.
1263 Your browser does not support the <code>video</code> element.
1188 </video>""".format(url, self.html_attributes, width, height)
1264 </video>""".format(url, self.html_attributes, width, height)
1189 return output
1265 return output
1190
1266
1191 # Embedded videos are base64-encoded.
1267 # Embedded videos are base64-encoded.
1192 mimetype = self.mimetype
1268 mimetype = self.mimetype
1193 if self.filename is not None:
1269 if self.filename is not None:
1194 if not mimetype:
1270 if not mimetype:
1195 mimetype, _ = mimetypes.guess_type(self.filename)
1271 mimetype, _ = mimetypes.guess_type(self.filename)
1196
1272
1197 with open(self.filename, 'rb') as f:
1273 with open(self.filename, 'rb') as f:
1198 video = f.read()
1274 video = f.read()
1199 else:
1275 else:
1200 video = self.data
1276 video = self.data
1201 if isinstance(video, str):
1277 if isinstance(video, str):
1202 # unicode input is already b64-encoded
1278 # unicode input is already b64-encoded
1203 b64_video = video
1279 b64_video = video
1204 else:
1280 else:
1205 b64_video = b2a_base64(video, newline=False).decode("ascii").rstrip()
1281 b64_video = b2a_base64(video, newline=False).decode("ascii").rstrip()
1206
1282
1207 output = """<video {0} {1} {2}>
1283 output = """<video {0} {1} {2}>
1208 <source src="data:{3};base64,{4}" type="{3}">
1284 <source src="data:{3};base64,{4}" type="{3}">
1209 Your browser does not support the video tag.
1285 Your browser does not support the video tag.
1210 </video>""".format(self.html_attributes, width, height, mimetype, b64_video)
1286 </video>""".format(self.html_attributes, width, height, mimetype, b64_video)
1211 return output
1287 return output
1212
1288
1213 def reload(self):
1289 def reload(self):
1214 # TODO
1290 # TODO
1215 pass
1291 pass
1216
1292
1217
1293
1218 @skip_doctest
1294 @skip_doctest
1219 def set_matplotlib_formats(*formats, **kwargs):
1295 def set_matplotlib_formats(*formats, **kwargs):
1220 """
1296 """
1221 .. deprecated:: 7.23
1297 .. deprecated:: 7.23
1222
1298
1223 use `matplotlib_inline.backend_inline.set_matplotlib_formats()`
1299 use `matplotlib_inline.backend_inline.set_matplotlib_formats()`
1224
1300
1225 Select figure formats for the inline backend. Optionally pass quality for JPEG.
1301 Select figure formats for the inline backend. Optionally pass quality for JPEG.
1226
1302
1227 For example, this enables PNG and JPEG output with a JPEG quality of 90%::
1303 For example, this enables PNG and JPEG output with a JPEG quality of 90%::
1228
1304
1229 In [1]: set_matplotlib_formats('png', 'jpeg', quality=90)
1305 In [1]: set_matplotlib_formats('png', 'jpeg', quality=90)
1230
1306
1231 To set this in your config files use the following::
1307 To set this in your config files use the following::
1232
1308
1233 c.InlineBackend.figure_formats = {'png', 'jpeg'}
1309 c.InlineBackend.figure_formats = {'png', 'jpeg'}
1234 c.InlineBackend.print_figure_kwargs.update({'quality' : 90})
1310 c.InlineBackend.print_figure_kwargs.update({'quality' : 90})
1235
1311
1236 Parameters
1312 Parameters
1237 ----------
1313 ----------
1238 *formats : strs
1314 *formats : strs
1239 One or more figure formats to enable: 'png', 'retina', 'jpeg', 'svg', 'pdf'.
1315 One or more figure formats to enable: 'png', 'retina', 'jpeg', 'svg', 'pdf'.
1240 **kwargs
1316 **kwargs
1241 Keyword args will be relayed to ``figure.canvas.print_figure``.
1317 Keyword args will be relayed to ``figure.canvas.print_figure``.
1242 """
1318 """
1243 warnings.warn(
1319 warnings.warn(
1244 "`set_matplotlib_formats` is deprecated since IPython 7.23, directly "
1320 "`set_matplotlib_formats` is deprecated since IPython 7.23, directly "
1245 "use `matplotlib_inline.backend_inline.set_matplotlib_formats()`",
1321 "use `matplotlib_inline.backend_inline.set_matplotlib_formats()`",
1246 DeprecationWarning,
1322 DeprecationWarning,
1247 stacklevel=2,
1323 stacklevel=2,
1248 )
1324 )
1249
1325
1250 from matplotlib_inline.backend_inline import (
1326 from matplotlib_inline.backend_inline import (
1251 set_matplotlib_formats as set_matplotlib_formats_orig,
1327 set_matplotlib_formats as set_matplotlib_formats_orig,
1252 )
1328 )
1253
1329
1254 set_matplotlib_formats_orig(*formats, **kwargs)
1330 set_matplotlib_formats_orig(*formats, **kwargs)
1255
1331
1256 @skip_doctest
1332 @skip_doctest
1257 def set_matplotlib_close(close=True):
1333 def set_matplotlib_close(close=True):
1258 """
1334 """
1259 .. deprecated:: 7.23
1335 .. deprecated:: 7.23
1260
1336
1261 use `matplotlib_inline.backend_inline.set_matplotlib_close()`
1337 use `matplotlib_inline.backend_inline.set_matplotlib_close()`
1262
1338
1263 Set whether the inline backend closes all figures automatically or not.
1339 Set whether the inline backend closes all figures automatically or not.
1264
1340
1265 By default, the inline backend used in the IPython Notebook will close all
1341 By default, the inline backend used in the IPython Notebook will close all
1266 matplotlib figures automatically after each cell is run. This means that
1342 matplotlib figures automatically after each cell is run. This means that
1267 plots in different cells won't interfere. Sometimes, you may want to make
1343 plots in different cells won't interfere. Sometimes, you may want to make
1268 a plot in one cell and then refine it in later cells. This can be accomplished
1344 a plot in one cell and then refine it in later cells. This can be accomplished
1269 by::
1345 by::
1270
1346
1271 In [1]: set_matplotlib_close(False)
1347 In [1]: set_matplotlib_close(False)
1272
1348
1273 To set this in your config files use the following::
1349 To set this in your config files use the following::
1274
1350
1275 c.InlineBackend.close_figures = False
1351 c.InlineBackend.close_figures = False
1276
1352
1277 Parameters
1353 Parameters
1278 ----------
1354 ----------
1279 close : bool
1355 close : bool
1280 Should all matplotlib figures be automatically closed after each cell is
1356 Should all matplotlib figures be automatically closed after each cell is
1281 run?
1357 run?
1282 """
1358 """
1283 warnings.warn(
1359 warnings.warn(
1284 "`set_matplotlib_close` is deprecated since IPython 7.23, directly "
1360 "`set_matplotlib_close` is deprecated since IPython 7.23, directly "
1285 "use `matplotlib_inline.backend_inline.set_matplotlib_close()`",
1361 "use `matplotlib_inline.backend_inline.set_matplotlib_close()`",
1286 DeprecationWarning,
1362 DeprecationWarning,
1287 stacklevel=2,
1363 stacklevel=2,
1288 )
1364 )
1289
1365
1290 from matplotlib_inline.backend_inline import (
1366 from matplotlib_inline.backend_inline import (
1291 set_matplotlib_close as set_matplotlib_close_orig,
1367 set_matplotlib_close as set_matplotlib_close_orig,
1292 )
1368 )
1293
1369
1294 set_matplotlib_close_orig(close)
1370 set_matplotlib_close_orig(close)
@@ -1,2397 +1,2406
1 ============
1 ============
2 8.x Series
2 8.x Series
3 ============
3 ============
4
5 .. _version 8.29:
6
7 IPython 8.29
8 ============
9
10
11 - Add support for WEBP to ``IPython.display.Image``. :ghpull:`14526`
12
4 .. _version 8.28:
13 .. _version 8.28:
5
14
6 IPython 8.28
15 IPython 8.28
7 ============
16 ============
8
17
9 Slight delay of this September release as I was busy at Pydata Paris last week.
18 Slight delay of this September release as I was busy at Pydata Paris last week.
10 Not many user visible changes for this release, a couple of bug fixes and
19 Not many user visible changes for this release, a couple of bug fixes and
11 workaround:
20 workaround:
12
21
13 - :ghpull:`14480` AssertionError: assert _xterm_term_title_saved in WSL – It is
22 - :ghpull:`14480` AssertionError: assert _xterm_term_title_saved in WSL – It is
14 unclear why the terminal title is not saved in WSL, if you've WSL experience
23 unclear why the terminal title is not saved in WSL, if you've WSL experience
15 we'd love your feedback and help to not just ignore an error
24 we'd love your feedback and help to not just ignore an error
16 - :ghpull:`14510` Fix use of pyside6 >= 6.7.0
25 - :ghpull:`14510` Fix use of pyside6 >= 6.7.0
17 - :ghpull:`14518` Make values public (_tb_highlight & _tb_highlight_style)
26 - :ghpull:`14518` Make values public (_tb_highlight & _tb_highlight_style)
18 - :ghpull:`14515` Use environment variable to identify conda / mamba
27 - :ghpull:`14515` Use environment variable to identify conda / mamba
19
28
20
29
21 As usual you can find the full list of PRs on GitHub under `the 8.28
30 As usual you can find the full list of PRs on GitHub under `the 8.28
22 <https://github.com/ipython/ipython/milestone/135?closed=1>`__ milestone.
31 <https://github.com/ipython/ipython/milestone/135?closed=1>`__ milestone.
23
32
24 For something completely different
33 For something completely different
25 ----------------------------------
34 ----------------------------------
26
35
27 One of the first works of Science Fiction (`Frankenstein
36 One of the first works of Science Fiction (`Frankenstein
28 <https://en.wikipedia.org/wiki/Frankenstein>`__), was written by `Mary Shelley
37 <https://en.wikipedia.org/wiki/Frankenstein>`__), was written by `Mary Shelley
29 <https://en.wikipedia.org/wiki/Mary_Shelley>`__ when she was 18, before being
38 <https://en.wikipedia.org/wiki/Mary_Shelley>`__ when she was 18, before being
30 published in London on 1 January 1818 when she was 20. This is often overlooked,
39 published in London on 1 January 1818 when she was 20. This is often overlooked,
31 and the role of founders of science fiction attribute to Edgar Allan Poe and
40 and the role of founders of science fiction attribute to Edgar Allan Poe and
32 Jules Verne despite being published later.
41 Jules Verne despite being published later.
33
42
34 Thanks
43 Thanks
35 ------
44 ------
36
45
37 Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
46 Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
38 work on IPython and related libraries.
47 work on IPython and related libraries.
39
48
40
49
41 .. _version 8.27:
50 .. _version 8.27:
42
51
43 IPython 8.27
52 IPython 8.27
44 ============
53 ============
45
54
46 New release of IPython after a month off (not enough changes). We can see a few
55 New release of IPython after a month off (not enough changes). We can see a few
47 important changes for this release.
56 important changes for this release.
48
57
49 - autocall was being call getitem, :ghpull:`14486`
58 - autocall was being call getitem, :ghpull:`14486`
50 - Only copy files in startup dir if we just created it. :ghpull:`14497`
59 - Only copy files in startup dir if we just created it. :ghpull:`14497`
51 - Fix some tests on Python 3.13 RC1 :ghpull:`14504`; this one I guess make this
60 - Fix some tests on Python 3.13 RC1 :ghpull:`14504`; this one I guess make this
52 the first IPython release officially compatible with Python 3.13; you will
61 the first IPython release officially compatible with Python 3.13; you will
53 need the most recent ``executing`` and ``stack_data``, we won't pin to avoid
62 need the most recent ``executing`` and ``stack_data``, we won't pin to avoid
54 forcing user of older Python version to upgrade.
63 forcing user of older Python version to upgrade.
55
64
56
65
57 As usual you can find the full list of PRs on GitHub under `the 8.27
66 As usual you can find the full list of PRs on GitHub under `the 8.27
58 <https://github.com/ipython/ipython/milestone/134?closed=1>`__ milestone.
67 <https://github.com/ipython/ipython/milestone/134?closed=1>`__ milestone.
59
68
60 Thanks
69 Thanks
61 ------
70 ------
62
71
63 Many thanks to `@Kleirre <https://github.com/Kleirre>`__ our June intern for
72 Many thanks to `@Kleirre <https://github.com/Kleirre>`__ our June intern for
64 doing her first contribution to open source, doing the releases notes and
73 doing her first contribution to open source, doing the releases notes and
65 release. I guess you didn't even notice it was not me who released :-). I wish
74 release. I guess you didn't even notice it was not me who released :-). I wish
66 her all the best in her future endeavor and look forward for her work in
75 her all the best in her future endeavor and look forward for her work in
67 astrophysics.
76 astrophysics.
68
77
69 Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
78 Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
70 work on IPython and related libraries.
79 work on IPython and related libraries.
71
80
72 .. _version 8.26:
81 .. _version 8.26:
73
82
74 IPython 8.26
83 IPython 8.26
75 ============
84 ============
76
85
77 Hey, the release of IPython for this month is here! (I know you were waiting for it)
86 Hey, the release of IPython for this month is here! (I know you were waiting for it)
78
87
79 - :ghpull:`14453` bugfix for call to structured_traceback
88 - :ghpull:`14453` bugfix for call to structured_traceback
80
89
81 - :ghpull:`14466` fixed honoring custom repr for NamedTuple if assigned by partialmethod
90 - :ghpull:`14466` fixed honoring custom repr for NamedTuple if assigned by partialmethod
82
91
83 - :ghpull:`14451` Convert matplotlib gui name in enable_gui
92 - :ghpull:`14451` Convert matplotlib gui name in enable_gui
84
93
85 As usual you can find the full list of PRs on GitHub under `the 8.26
94 As usual you can find the full list of PRs on GitHub under `the 8.26
86 <https://github.com/ipython/ipython/milestone/133?closed=1>`__ milestone.
95 <https://github.com/ipython/ipython/milestone/133?closed=1>`__ milestone.
87
96
88 Thanks
97 Thanks
89 ------
98 ------
90
99
91 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
100 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
92 work on IPython and related libraries.
101 work on IPython and related libraries.
93
102
94
103
95 .. _version 8.25:
104 .. _version 8.25:
96
105
97 IPython 8.25
106 IPython 8.25
98 ============
107 ============
99
108
100 Mostly internal changes for this end of may release of IPython.
109 Mostly internal changes for this end of may release of IPython.
101
110
102 We'll count about a dozen PRs for this moth, with small bugfixes related to
111 We'll count about a dozen PRs for this moth, with small bugfixes related to
103 matplotlib fixes.
112 matplotlib fixes.
104
113
105 Of notable interest,
114 Of notable interest,
106
115
107 - :ghpull:`14426` replaces the unicode micro symbol with greek letter mu,
116 - :ghpull:`14426` replaces the unicode micro symbol with greek letter mu,
108 visually identical but should fix nfkc normalisations issues.
117 visually identical but should fix nfkc normalisations issues.
109
118
110 - :ghpull:`14444` introduces ``intersphinx_registry`` as a new dependency
119 - :ghpull:`14444` introduces ``intersphinx_registry`` as a new dependency
111 which is recommended only to build documentation.
120 which is recommended only to build documentation.
112
121
113 As usual you can find the full list of PRs on GitHub under `the 8.25
122 As usual you can find the full list of PRs on GitHub under `the 8.25
114 <https://github.com/ipython/ipython/milestone/132?closed=1>`__ milestone.
123 <https://github.com/ipython/ipython/milestone/132?closed=1>`__ milestone.
115
124
116 Thanks
125 Thanks
117 ------
126 ------
118
127
119 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
128 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
120 work on IPython and related libraries.
129 work on IPython and related libraries.
121
130
122
131
123 .. _version 8.24:
132 .. _version 8.24:
124
133
125 IPython 8.24
134 IPython 8.24
126 ============
135 ============
127
136
128 Back on regular release schedule, as usual month releases are relatively tiny.
137 Back on regular release schedule, as usual month releases are relatively tiny.
129
138
130 The biggest change is the move of the matplotlib backend handling from IPython
139 The biggest change is the move of the matplotlib backend handling from IPython
131 to matplotlib. :ghpull:`14371` :ghpull:`14403`.
140 to matplotlib. :ghpull:`14371` :ghpull:`14403`.
132
141
133 We will note:
142 We will note:
134
143
135 - pytest 8 compatibility :ghpull:`14413`
144 - pytest 8 compatibility :ghpull:`14413`
136 - ``typing-extension`` now needs 4.6 or newer. It was already the case, but not
145 - ``typing-extension`` now needs 4.6 or newer. It was already the case, but not
137 explicated. :ghpull:`14380`
146 explicated. :ghpull:`14380`
138 - Attempt to speed running code under debugger in some cases. :ghpull:`14386`
147 - Attempt to speed running code under debugger in some cases. :ghpull:`14386`
139 :ghpull:`14418`.
148 :ghpull:`14418`.
140 - Multiple fixes to documentation for ipyparallel, simple_prompt and emacs
149 - Multiple fixes to documentation for ipyparallel, simple_prompt and emacs
141 :ghpull:`14384` :ghpull:`14404` :ghpull:`14407`
150 :ghpull:`14384` :ghpull:`14404` :ghpull:`14407`
142 - Maintenance and cleanup of debugger :ghpull:`14387` :ghpull:`14393`
151 - Maintenance and cleanup of debugger :ghpull:`14387` :ghpull:`14393`
143
152
144 As usual you can find the full list of PRs on GitHub under `the 8.24
153 As usual you can find the full list of PRs on GitHub under `the 8.24
145 <https://github.com/ipython/ipython/milestone/131?closed=1>`__ milestone.
154 <https://github.com/ipython/ipython/milestone/131?closed=1>`__ milestone.
146
155
147 Thanks
156 Thanks
148 ------
157 ------
149
158
150 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
159 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
151 work on IPython and related libraries.
160 work on IPython and related libraries.
152
161
153
162
154 .. _version 8.23:
163 .. _version 8.23:
155
164
156 IPython 8.23
165 IPython 8.23
157 ============
166 ============
158
167
159 Super tiny release of IPython on Sunday – a bit later than usual, which is also
168 Super tiny release of IPython on Sunday – a bit later than usual, which is also
160 `πŸ³οΈβ€βš§οΈ International Transgender Day of VisibilityπŸ³οΈβ€βš§οΈ
169 `πŸ³οΈβ€βš§οΈ International Transgender Day of VisibilityπŸ³οΈβ€βš§οΈ
161 <https://en.wikipedia.org/wiki/International_Transgender_Day_of_Visibility>`_ –
170 <https://en.wikipedia.org/wiki/International_Transgender_Day_of_Visibility>`_ –
162 so a though for you on this day, you matter and you are valid [1]_.
171 so a though for you on this day, you matter and you are valid [1]_.
163
172
164 This is a minuscule release with only 5 Pull requests.
173 This is a minuscule release with only 5 Pull requests.
165
174
166 Main change is :ghpull:`14357` which improve inference from return type
175 Main change is :ghpull:`14357` which improve inference from return type
167 annotations in completer and the introduction of the optional target
176 annotations in completer and the introduction of the optional target
168 ``ipython[matplotlib]`` to explicitly request the matplotlib optional
177 ``ipython[matplotlib]`` to explicitly request the matplotlib optional
169 dependencies.
178 dependencies.
170
179
171 As usual you can find the full list of PRs on GitHub under `the 8.23
180 As usual you can find the full list of PRs on GitHub under `the 8.23
172 <https://github.com/ipython/ipython/milestone/130?closed=1>`__ milestone.
181 <https://github.com/ipython/ipython/milestone/130?closed=1>`__ milestone.
173
182
174 Thanks
183 Thanks
175 ------
184 ------
176
185
177 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
186 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
178 work on IPython and related libraries.
187 work on IPython and related libraries.
179
188
180
189
181 .. _version 8.22:
190 .. _version 8.22:
182
191
183 IPython 8.22, 8.22.1 and 8.22.2
192 IPython 8.22, 8.22.1 and 8.22.2
184 ===============================
193 ===============================
185
194
186 Quick release of IPython for this short month of February, with quite a bit of
195 Quick release of IPython for this short month of February, with quite a bit of
187 activity with more than 15 PRs.
196 activity with more than 15 PRs.
188
197
189 I am not going to details all the changes, but among other we have :
198 I am not going to details all the changes, but among other we have :
190
199
191 - More compatibility with emscripten :ghpull:`14316`, :ghpull:`14318`,
200 - More compatibility with emscripten :ghpull:`14316`, :ghpull:`14318`,
192 - Test more downstream project to avoid breakage :ghpull:`14317`
201 - Test more downstream project to avoid breakage :ghpull:`14317`
193 - Fix recently introduced bug with the ``store`` magic.
202 - Fix recently introduced bug with the ``store`` magic.
194 - Fix issues with multiple call to ``matplotlib.pyplot.switch_backend``
203 - Fix issues with multiple call to ``matplotlib.pyplot.switch_backend``
195 - Fix crashing IPython when some tracebacks encounter dynamically evaluated
204 - Fix crashing IPython when some tracebacks encounter dynamically evaluated
196 code.
205 code.
197
206
198 IPython 8.22.1 increase the minimal traitlets version, and 8.22.2 fix a critical
207 IPython 8.22.1 increase the minimal traitlets version, and 8.22.2 fix a critical
199 bug on emscripten preventing to use some magics like ``%matplotlib`` on
208 bug on emscripten preventing to use some magics like ``%matplotlib`` on
200 jupyter-light.
209 jupyter-light.
201
210
202 API changes
211 API changes
203 -----------
212 -----------
204
213
205 One of the largest change is the update the mimehooks and inspector API, see
214 One of the largest change is the update the mimehooks and inspector API, see
206 :ghpull:`14342`. It should be backward compatible, but many hooks now receive a
215 :ghpull:`14342`. It should be backward compatible, but many hooks now receive a
207 single object with many fields allowing us flexibility to update the API later.
216 single object with many fields allowing us flexibility to update the API later.
208
217
209
218
210 Packaging changes
219 Packaging changes
211 -----------------
220 -----------------
212
221
213 Thanks to `@mkoppe <https://github.com/mkoeppe>`__, we are slowly getting rid of
222 Thanks to `@mkoppe <https://github.com/mkoeppe>`__, we are slowly getting rid of
214 setup.py finally migrating to ``pyproject.toml``. There is still quite a bit of
223 setup.py finally migrating to ``pyproject.toml``. There is still quite a bit of
215 work, and please open an issue if you encounter any problem.
224 work, and please open an issue if you encounter any problem.
216
225
217
226
218 Deprecation
227 Deprecation
219 -----------
228 -----------
220
229
221 A number of unused functions have been marked deprecated or pending deprecation.
230 A number of unused functions have been marked deprecated or pending deprecation.
222 Please let us know if you encounter any of those deprecation messages for us to
231 Please let us know if you encounter any of those deprecation messages for us to
223 adjust the removal timeline.
232 adjust the removal timeline.
224
233
225
234
226 Thanks
235 Thanks
227 ------
236 ------
228
237
229 Many thanks to `@mkoppe <https://github.com/mkoeppe>`__ and `@krassowski
238 Many thanks to `@mkoppe <https://github.com/mkoeppe>`__ and `@krassowski
230 <https://github.com/krassowski>`__ for their multiple contributions and codebase
239 <https://github.com/krassowski>`__ for their multiple contributions and codebase
231 cleanup.
240 cleanup.
232
241
233 As usual you can find the full list of PRs on GitHub under `the 8.22
242 As usual you can find the full list of PRs on GitHub under `the 8.22
234 <https://github.com/ipython/ipython/milestone/129?closed=1>`__ milestone.
243 <https://github.com/ipython/ipython/milestone/129?closed=1>`__ milestone.
235
244
236 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
245 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
237 work on IPython and related libraries.
246 work on IPython and related libraries.
238
247
239
248
240 .. _version 8.21:
249 .. _version 8.21:
241
250
242 IPython 8.21
251 IPython 8.21
243 ------------
252 ------------
244
253
245 More substantial release of IPython slightly out of schedule as it was not
254 More substantial release of IPython slightly out of schedule as it was not
246 possible for me to make a release last Friday.
255 possible for me to make a release last Friday.
247
256
248 Few new features are present, but the codebase has been cleaned, and a couple
257 Few new features are present, but the codebase has been cleaned, and a couple
249 of API are _considered_ for deprecation. They are not deprecated yet, but as
258 of API are _considered_ for deprecation. They are not deprecated yet, but as
250 they do not seem to be quite used, they may emit a warning, in which case please
259 they do not seem to be quite used, they may emit a warning, in which case please
251 comment on the relevant issue to inform me of _which_ project use those feature
260 comment on the relevant issue to inform me of _which_ project use those feature
252 and how you use them. Depending on the feedback I might change the timeline for
261 and how you use them. Depending on the feedback I might change the timeline for
253 deprecation.
262 deprecation.
254
263
255 This release saw 14 PRs, with more outside contribution than usual,
264 This release saw 14 PRs, with more outside contribution than usual,
256 I'll note in particular PRs related to making IPython work on emscripten.
265 I'll note in particular PRs related to making IPython work on emscripten.
257
266
258 I also want to point that we are _trying_ to keep compatibility with Python 3.13,
267 I also want to point that we are _trying_ to keep compatibility with Python 3.13,
259 but it's a cat and mouse game. Plus I am low on time, so I would appreciate any
268 but it's a cat and mouse game. Plus I am low on time, so I would appreciate any
260 help with that.
269 help with that.
261
270
262 Deprecations
271 Deprecations
263 ~~~~~~~~~~~~
272 ~~~~~~~~~~~~
264
273
265 - :ghpull:`14307` Pending Deprecation of
274 - :ghpull:`14307` Pending Deprecation of
266 ``ColorSchemeTable.set_active_scheme(...)``'s ``case_sensitive`` Parameter.
275 ``ColorSchemeTable.set_active_scheme(...)``'s ``case_sensitive`` Parameter.
267 - :ghpull:`14305` Pending Deprecation of constructing ``ColorScheme`` via
276 - :ghpull:`14305` Pending Deprecation of constructing ``ColorScheme`` via
268 ``kwargs``, in favor passing a single dict.
277 ``kwargs``, in favor passing a single dict.
269
278
270
279
271 Fixes
280 Fixes
272 ~~~~~
281 ~~~~~
273
282
274 - :ghpull:`14284` TerminalIPythonApp's would warn that ``auto_create`` option is not
283 - :ghpull:`14284` TerminalIPythonApp's would warn that ``auto_create`` option is not
275 recognized.
284 recognized.
276 - :ghpull:`14286` Fix a crash with ``NotOneValueFound`` when rendering complex
285 - :ghpull:`14286` Fix a crash with ``NotOneValueFound`` when rendering complex
277 tracebacks.
286 tracebacks.
278
287
279 - :ghpull:`14287` Partial Python 3.13 compatibility
288 - :ghpull:`14287` Partial Python 3.13 compatibility
280 - :ghpull:`14290` Docs/Typos.
289 - :ghpull:`14290` Docs/Typos.
281
290
282 Changes
291 Changes
283 ~~~~~~~
292 ~~~~~~~
284
293
285 - :ghpull:`14289` ``ipdb.set_trace()`` now accepts ``header=`` for better
294 - :ghpull:`14289` ``ipdb.set_trace()`` now accepts ``header=`` for better
286 compatibility with ``pdb.set_trace()``
295 compatibility with ``pdb.set_trace()``
287
296
288 - :ghpull:`14300` and :ghpull:`14301` Add hooking ability to produce
297 - :ghpull:`14300` and :ghpull:`14301` Add hooking ability to produce
289 mimebundle.
298 mimebundle.
290
299
291 We'll outline :ghpull:`14300`, it is now possible to extend the ``?/??``
300 We'll outline :ghpull:`14300`, it is now possible to extend the ``?/??``
292 operator to return more mimetypes to render richer help in frontends that
301 operator to return more mimetypes to render richer help in frontends that
293 support it. In particular you could send a json representation of the help that
302 support it. In particular you could send a json representation of the help that
294 could be displayed in a customizable way.
303 could be displayed in a customizable way.
295
304
296 Miscellaneous
305 Miscellaneous
297 ~~~~~~~~~~~~~
306 ~~~~~~~~~~~~~
298
307
299 - :ghpull:`14291` Misc Refactor of Color handling
308 - :ghpull:`14291` Misc Refactor of Color handling
300 - :ghpull:`14295` Misc test skip on problematic Pypy versions.
309 - :ghpull:`14295` Misc test skip on problematic Pypy versions.
301
310
302
311
303 Thanks
312 Thanks
304 ~~~~~~
313 ~~~~~~
305
314
306 Special thanks to all our contributors, and to the Pypy team that was extremely
315 Special thanks to all our contributors, and to the Pypy team that was extremely
307 reactive in helping to investigate a fixing a rare unicode+windows bug.
316 reactive in helping to investigate a fixing a rare unicode+windows bug.
308
317
309 As usual you can find the full list of PRs on GitHub under `the 8.21
318 As usual you can find the full list of PRs on GitHub under `the 8.21
310 <https://github.com/ipython/ipython/milestone/128?closed=1>`__ milestone.
319 <https://github.com/ipython/ipython/milestone/128?closed=1>`__ milestone.
311
320
312 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
321 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
313 work on IPython and related libraries.
322 work on IPython and related libraries.
314
323
315
324
316 .. _version 8.20:
325 .. _version 8.20:
317
326
318 IPython 8.20
327 IPython 8.20
319 ------------
328 ------------
320
329
321 Quick IPython release in this beginning of 2024, barely 2 weeks after the previous
330 Quick IPython release in this beginning of 2024, barely 2 weeks after the previous
322 release.
331 release.
323
332
324 This is mostly to fix a backward compatibility issue, I would have done a patch
333 This is mostly to fix a backward compatibility issue, I would have done a patch
325 release earlier if I could. As a few other cleanup are also part of this
334 release earlier if I could. As a few other cleanup are also part of this
326 release, this will get a minor version bump.
335 release, this will get a minor version bump.
327
336
328
337
329 The crux of this release is :ghpull:`14274` (Inspect continuation prompt
338 The crux of this release is :ghpull:`14274` (Inspect continuation prompt
330 signature and pass only viable arguments), the rest of the changes are mostly
339 signature and pass only viable arguments), the rest of the changes are mostly
331 type annotation, and a few compatibility issues with Python 3.13 that are
340 type annotation, and a few compatibility issues with Python 3.13 that are
332 getting addressed.
341 getting addressed.
333
342
334 Python 3.13 compatibility is still not complete (help welcomed).
343 Python 3.13 compatibility is still not complete (help welcomed).
335
344
336 As usual you can find the full list of PRs on GitHub under `the 8.20
345 As usual you can find the full list of PRs on GitHub under `the 8.20
337 <https://github.com/ipython/ipython/milestone/127?closed=1>`__ milestone.
346 <https://github.com/ipython/ipython/milestone/127?closed=1>`__ milestone.
338
347
339 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
348 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
340 work on IPython and related libraries.
349 work on IPython and related libraries.
341
350
342
351
343 .. _version 8.19:
352 .. _version 8.19:
344
353
345 IPython 8.19
354 IPython 8.19
346 ------------
355 ------------
347
356
348 New release of IPython a bit before the end of the month, and end of the year.
357 New release of IPython a bit before the end of the month, and end of the year.
349
358
350 Mostly cleanup and deprecation, due to upstream deprecation and removal.
359 Mostly cleanup and deprecation, due to upstream deprecation and removal.
351
360
352 Remove of Python 3.9 support
361 Remove of Python 3.9 support
353 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
362 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
354
363
355 A bit later than originally plan, IPython 8.19 does not support Python 3.9
364 A bit later than originally plan, IPython 8.19 does not support Python 3.9
356 anymore, as well as the few conditional code that were executing only on Python
365 anymore, as well as the few conditional code that were executing only on Python
357 3.9. :ghpull:`14254`
366 3.9. :ghpull:`14254`
358
367
359 We used the opportunity to deprecate ``IPython.utils.tz`` :ghpull:`14256`, due
368 We used the opportunity to deprecate ``IPython.utils.tz`` :ghpull:`14256`, due
360 to upstream deprecation of some timezone utilities. It will be removed at a later
369 to upstream deprecation of some timezone utilities. It will be removed at a later
361 date.
370 date.
362
371
363 We now also run CI on Python 3.12 (what I likely should have done before), but
372 We now also run CI on Python 3.12 (what I likely should have done before), but
364 running on too many Python version uses a lot of CI time.
373 running on too many Python version uses a lot of CI time.
365
374
366 Absolute and relative Line Numbers in Prompts
375 Absolute and relative Line Numbers in Prompts
367 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
376 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
368
377
369 Thanks to the contribution of ``cohml``, IPython CLI now support absolute and
378 Thanks to the contribution of ``cohml``, IPython CLI now support absolute and
370 relative line numbers in both vi and emacs prompt, use for example
379 relative line numbers in both vi and emacs prompt, use for example
371 ``c.TerminalInteractiveShell.prompt_line_number_format='{line: 4d}/{rel_line:+03d} | '``
380 ``c.TerminalInteractiveShell.prompt_line_number_format='{line: 4d}/{rel_line:+03d} | '``
372 configuration option to display both in a custom format.
381 configuration option to display both in a custom format.
373
382
374 Miscellaneous
383 Miscellaneous
375 ~~~~~~~~~~~~~
384 ~~~~~~~~~~~~~
376
385
377 In addition to various bugfixes, I unpinned pytest, let me know if there are any
386 In addition to various bugfixes, I unpinned pytest, let me know if there are any
378 issues and we'll re-pin.
387 issues and we'll re-pin.
379
388
380 See you in 2024
389 See you in 2024
381 ~~~~~~~~~~~~~~~
390 ~~~~~~~~~~~~~~~
382
391
383 As usual you can find the full list of PRs on GitHub under `the 8.19
392 As usual you can find the full list of PRs on GitHub under `the 8.19
384 <https://github.com/ipython/ipython/milestone/126?closed=1>`__ milestone.
393 <https://github.com/ipython/ipython/milestone/126?closed=1>`__ milestone.
385
394
386 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
395 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
387 work on IPython and related libraries.
396 work on IPython and related libraries.
388
397
389 .. _version 8.18:
398 .. _version 8.18:
390
399
391 IPython 8.18 and 8.18.1
400 IPython 8.18 and 8.18.1
392 -----------------------
401 -----------------------
393
402
394 8.18.1 is identical to 8.18 but pin ``prompt_toolkit`` to greater than ``3.0.41``
403 8.18.1 is identical to 8.18 but pin ``prompt_toolkit`` to greater than ``3.0.41``
395
404
396 Small release of IPython that fixes a small number of inconveniences.
405 Small release of IPython that fixes a small number of inconveniences.
397
406
398 - :ghpull:`14251` Fix a memory leak in qt event loop integration by setting
407 - :ghpull:`14251` Fix a memory leak in qt event loop integration by setting
399 the Loop parent to None.
408 the Loop parent to None.
400 - :ghpull:`14252` Pickleshare was made an optional dependency in 8.17, this
409 - :ghpull:`14252` Pickleshare was made an optional dependency in 8.17, this
401 leads to warnings in some installations when using modules completions. The
410 leads to warnings in some installations when using modules completions. The
402 warning has been silenced.
411 warning has been silenced.
403 - :ghpull:`14241` Update event loop code for compatibility with more recent
412 - :ghpull:`14241` Update event loop code for compatibility with more recent
404 ``prompt_toolkit`` due to deprecations in Python 3.12.
413 ``prompt_toolkit`` due to deprecations in Python 3.12.
405 - :ghpull:`14245` Fix doc example on Pygments styles
414 - :ghpull:`14245` Fix doc example on Pygments styles
406 - :ghpull:`14238` Remove dependency on app_nope, this is actually only a
415 - :ghpull:`14238` Remove dependency on app_nope, this is actually only a
407 dependency of IPykernel.
416 dependency of IPykernel.
408
417
409 As usual you can find the full list of PRs on GitHub under `the 8.18
418 As usual you can find the full list of PRs on GitHub under `the 8.18
410 <https://github.com/ipython/ipython/milestone/125?closed=1>`__ milestone.
419 <https://github.com/ipython/ipython/milestone/125?closed=1>`__ milestone.
411
420
412 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
421 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
413 work on IPython and related libraries.
422 work on IPython and related libraries.
414
423
415 .. _version 8.17.1:
424 .. _version 8.17.1:
416 .. _version 8.17:
425 .. _version 8.17:
417
426
418 IPython 8.17, 8.17.1
427 IPython 8.17, 8.17.1
419 --------------------
428 --------------------
420
429
421 Medium-sized release of IPython that includes some cleanup (backcall, python2 leftovers)
430 Medium-sized release of IPython that includes some cleanup (backcall, python2 leftovers)
422 and some refactoring improvements (typing, pathlib) and a fix on completion.
431 and some refactoring improvements (typing, pathlib) and a fix on completion.
423
432
424 - :ghpull:`14216` remove backcall dependency
433 - :ghpull:`14216` remove backcall dependency
425 - :ghpull:`14217` make pickleshare dependency optional
434 - :ghpull:`14217` make pickleshare dependency optional
426 - :ghpull:`14185` support completion based on type annotations of calls
435 - :ghpull:`14185` support completion based on type annotations of calls
427
436
428 Reverted in 8.17.1:
437 Reverted in 8.17.1:
429
438
430 - :ghpull:`14190` remove support for python 2 in lexers (reverted in 8.17.1 as it is imported by qtconsole/spyder)
439 - :ghpull:`14190` remove support for python 2 in lexers (reverted in 8.17.1 as it is imported by qtconsole/spyder)
431
440
432
441
433 Mamba and Micromamba magic commands
442 Mamba and Micromamba magic commands
434 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
443 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
435
444
436 In addition to the ``%conda`` magic command for calling ``conda`` in IPython,
445 In addition to the ``%conda`` magic command for calling ``conda`` in IPython,
437 the ``%mamba`` and ``%micromamba`` magic commands now
446 the ``%mamba`` and ``%micromamba`` magic commands now
438 call ``mamba`` and ``micromamba`` if they are on ``sys.path``.
447 call ``mamba`` and ``micromamba`` if they are on ``sys.path``.
439
448
440 .. code::
449 .. code::
441
450
442 %mamba install pkgname
451 %mamba install pkgname
443 %micromamba install pkgname
452 %micromamba install pkgname
444 %conda install pkgname
453 %conda install pkgname
445 %pip install pkgname
454 %pip install pkgname
446
455
447 %mamba --help
456 %mamba --help
448 %micromamba --help
457 %micromamba --help
449 %conda --help
458 %conda --help
450 %pip --help # works w/ JupyterLite
459 %pip --help # works w/ JupyterLite
451 !pip --help
460 !pip --help
452
461
453
462
454 :ghpull:`14191`
463 :ghpull:`14191`
455
464
456 ----
465 ----
457
466
458 As usual you can find the full list of PRs on GitHub under `the 8.17
467 As usual you can find the full list of PRs on GitHub under `the 8.17
459 <https://github.com/ipython/ipython/milestone/123?closed=1>`__ milestone.
468 <https://github.com/ipython/ipython/milestone/123?closed=1>`__ milestone.
460
469
461 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
470 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
462 work on IPython and related libraries.
471 work on IPython and related libraries.
463
472
464 .. _version 8.16:
473 .. _version 8.16:
465 .. _version 8.16.1:
474 .. _version 8.16.1:
466
475
467 IPython 8.16, 8.16.1
476 IPython 8.16, 8.16.1
468 --------------------
477 --------------------
469
478
470 Small double release of IPython (with the 8.12.3 release notes just below).
479 Small double release of IPython (with the 8.12.3 release notes just below).
471 Mostly bug fixes and cleanups, and type annotations. Of interest for users:
480 Mostly bug fixes and cleanups, and type annotations. Of interest for users:
472
481
473 - :ghpull:`14153` Fix a bug of the new iPdb chained traceback where some
482 - :ghpull:`14153` Fix a bug of the new iPdb chained traceback where some
474 Exception would not have any traceback. (see upstream fix in CPython for more
483 Exception would not have any traceback. (see upstream fix in CPython for more
475 details).
484 details).
476 - :ghpull:`14168` Fix case with spurious message about event loops when using
485 - :ghpull:`14168` Fix case with spurious message about event loops when using
477 matplotlib.
486 matplotlib.
478
487
479 This PR is in 8.16.0 but reverted in 8.16.1, we'll rework the fix for 8.17
488 This PR is in 8.16.0 but reverted in 8.16.1, we'll rework the fix for 8.17
480
489
481 - :ghpull:`14163` Fix an error where semicolon would not suppress output.
490 - :ghpull:`14163` Fix an error where semicolon would not suppress output.
482
491
483 As usual you can find the full list of PRs on GitHub under `the 8.16
492 As usual you can find the full list of PRs on GitHub under `the 8.16
484 <https://github.com/ipython/ipython/milestone/121?closed=1>`__ and `8.16.1 milestone
493 <https://github.com/ipython/ipython/milestone/121?closed=1>`__ and `8.16.1 milestone
485 <https://github.com/ipython/ipython/milestone/124?closed=1>`__.
494 <https://github.com/ipython/ipython/milestone/124?closed=1>`__.
486
495
487 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
496 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
488 work on IPython and related libraries.
497 work on IPython and related libraries.
489
498
490 .. _version 8.12.3:
499 .. _version 8.12.3:
491
500
492 IPython 8.12.3
501 IPython 8.12.3
493 --------------
502 --------------
494
503
495 Tiny release of 8.12.3 that backport a small number of fixes for users still
504 Tiny release of 8.12.3 that backport a small number of fixes for users still
496 using Python 3.8.
505 using Python 3.8.
497
506
498 - :ghpull:`14080` add passthrough filter shortcuts
507 - :ghpull:`14080` add passthrough filter shortcuts
499 - :ghpull:`14169` Fix `InteractiveShellEmbed`
508 - :ghpull:`14169` Fix `InteractiveShellEmbed`
500
509
501 .. _version 8.15:
510 .. _version 8.15:
502
511
503 IPython 8.15
512 IPython 8.15
504 ------------
513 ------------
505
514
506 Medium release of IPython after a couple of month hiatus, and a bit
515 Medium release of IPython after a couple of month hiatus, and a bit
507 off-schedule.
516 off-schedule.
508
517
509 Among other, IPython 8.15:
518 Among other, IPython 8.15:
510
519
511 - Improve compatibility with future version of Python 3.12/3.13
520 - Improve compatibility with future version of Python 3.12/3.13
512 :ghpull:`14107`, :ghpull:`14139`,
521 :ghpull:`14107`, :ghpull:`14139`,
513 - Improve support for ``ExceptionGroups``, :ghpull:`14108`
522 - Improve support for ``ExceptionGroups``, :ghpull:`14108`
514 - Fix hangs in ``%gui osx``, :ghpull:`14125`
523 - Fix hangs in ``%gui osx``, :ghpull:`14125`
515 - Fix memory lead with ``%reset``, :ghpull:`14133`
524 - Fix memory lead with ``%reset``, :ghpull:`14133`
516 - Unstable config option to modify traceback highlighting that is sometime hard
525 - Unstable config option to modify traceback highlighting that is sometime hard
517 to read :ghpull:`14138`
526 to read :ghpull:`14138`
518 - Support ``.`` in ``ipdb`` as an argument to the ``list`` command
527 - Support ``.`` in ``ipdb`` as an argument to the ``list`` command
519 :ghpull:`14121`
528 :ghpull:`14121`
520 - Workroud ``parso`` showing warning message when the default logger level is
529 - Workroud ``parso`` showing warning message when the default logger level is
521 changed :ghpull:`14119`
530 changed :ghpull:`14119`
522 - Fix multiple issues with matplotlib interactive mode, qt5/qt6 :ghpull:`14128`
531 - Fix multiple issues with matplotlib interactive mode, qt5/qt6 :ghpull:`14128`
523
532
524 Support for PEP-678 Exception Notes
533 Support for PEP-678 Exception Notes
525 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
534 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
526
535
527 Ultratb now shows :pep:`678` notes, improving your debugging experience on
536 Ultratb now shows :pep:`678` notes, improving your debugging experience on
528 Python 3.11+ or with libraries such as Pytest and Hypothesis.
537 Python 3.11+ or with libraries such as Pytest and Hypothesis.
529
538
530 Native fallback for displaying ExceptionGroup
539 Native fallback for displaying ExceptionGroup
531 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
540 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
532 ExceptionGroups are now displayed with ``traceback.print_exc``, as a temporary fix until UltraTB properly supports displaying child exceptions.
541 ExceptionGroups are now displayed with ``traceback.print_exc``, as a temporary fix until UltraTB properly supports displaying child exceptions.
533
542
534
543
535 We have two larger features:
544 We have two larger features:
536
545
537 AST-based macros
546 AST-based macros
538 ~~~~~~~~~~~~~~~~
547 ~~~~~~~~~~~~~~~~
539
548
540 :ghpull:`14100` introduce a new and efficient way to modify each execution block
549 :ghpull:`14100` introduce a new and efficient way to modify each execution block
541 (cell) using an template-ast-based transform. Unlike IPython pre and post code
550 (cell) using an template-ast-based transform. Unlike IPython pre and post code
542 execution hooks, this actually transform the code that is execute with as
551 execution hooks, this actually transform the code that is execute with as
543 minimal as possible overhead. While it was already technically possible to
552 minimal as possible overhead. While it was already technically possible to
544 register ast transformers for IPython this was far from evident.
553 register ast transformers for IPython this was far from evident.
545
554
546 This should make it trivial to hook into IPython to implement custom hooks, that
555 This should make it trivial to hook into IPython to implement custom hooks, that
547 for example time or profile your code, catch exceptions to provide error
556 for example time or profile your code, catch exceptions to provide error
548 messages for students or do any other kind of transformations.
557 messages for students or do any other kind of transformations.
549
558
550 In addition to programmatic API there is also a magic to quickly register
559 In addition to programmatic API there is also a magic to quickly register
551 hooks::
560 hooks::
552
561
553 In [1]: %%code_wrap before_after
562 In [1]: %%code_wrap before_after
554 ...: print('before')
563 ...: print('before')
555 ...: __code__
564 ...: __code__
556 ...: print('after')
565 ...: print('after')
557 ...: __ret__
566 ...: __ret__
558
567
559 This mean that for any subsequent execution code will be executed.
568 This mean that for any subsequent execution code will be executed.
560 You can modify the above to print the date, compute the execution time,
569 You can modify the above to print the date, compute the execution time,
561 retry the code in a for loop....
570 retry the code in a for loop....
562
571
563
572
564 Allow IPdb/Pdb to move between chained exceptions
573 Allow IPdb/Pdb to move between chained exceptions
565 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
574 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
566
575
567 The main change is the addition of the ability to move between chained
576 The main change is the addition of the ability to move between chained
568 exceptions when using IPdb, this feature was also contributed to upstream Pdb
577 exceptions when using IPdb, this feature was also contributed to upstream Pdb
569 and is thus native to CPython in Python 3.13+ Though ipdb should support this
578 and is thus native to CPython in Python 3.13+ Though ipdb should support this
570 feature in older version of Python. I invite you to look at the `CPython changes
579 feature in older version of Python. I invite you to look at the `CPython changes
571 and docs <https://github.com/python/cpython/pull/106676>`__ for more details.
580 and docs <https://github.com/python/cpython/pull/106676>`__ for more details.
572
581
573 In short, once in post-mortem debugger (``%debug``), you can use the ipdb
582 In short, once in post-mortem debugger (``%debug``), you can use the ipdb
574 ``exceptions`` command to switch exceptions, for example:
583 ``exceptions`` command to switch exceptions, for example:
575
584
576 .. code-block:: ipython
585 .. code-block:: ipython
577
586
578 In [1]: def foo(x):
587 In [1]: def foo(x):
579 ...: try:
588 ...: try:
580 ...: bar(x)
589 ...: bar(x)
581 ...: except Exception as e:
590 ...: except Exception as e:
582 ...: raise ValueError("foo (): bar failed") from e
591 ...: raise ValueError("foo (): bar failed") from e
583 ...:
592 ...:
584 ...: def bar(x):
593 ...: def bar(x):
585 ...: 1 / X
594 ...: 1 / X
586 ...:
595 ...:
587
596
588 In [2]: foo(0)
597 In [2]: foo(0)
589 ---------------------------------------------------------------------------
598 ---------------------------------------------------------------------------
590 NameError Traceback (most recent call last)
599 NameError Traceback (most recent call last)
591 Cell In[1], line 3, in foo(x)
600 Cell In[1], line 3, in foo(x)
592 2 try:
601 2 try:
593 ----> 3 bar(x)
602 ----> 3 bar(x)
594 4 except Exception as e:
603 4 except Exception as e:
595
604
596 Cell In[1], line 9, in bar(x)
605 Cell In[1], line 9, in bar(x)
597 8 def bar(x):
606 8 def bar(x):
598 ----> 9 1 / X
607 ----> 9 1 / X
599
608
600 NameError: name 'X' is not defined
609 NameError: name 'X' is not defined
601
610
602 The above exception was the direct cause of the following exception:
611 The above exception was the direct cause of the following exception:
603
612
604 ValueError Traceback (most recent call last)
613 ValueError Traceback (most recent call last)
605 Cell In[2], line 1
614 Cell In[2], line 1
606 ----> 1 foo(0)
615 ----> 1 foo(0)
607
616
608 Cell In[1], line 5, in foo(x)
617 Cell In[1], line 5, in foo(x)
609 3 bar(x)
618 3 bar(x)
610 4 except Exception as e:
619 4 except Exception as e:
611 ----> 5 raise ValueError("foo (): bar failed") from e
620 ----> 5 raise ValueError("foo (): bar failed") from e
612
621
613 ValueError: foo (): bar failed
622 ValueError: foo (): bar failed
614
623
615 In [3]: %debug
624 In [3]: %debug
616 > <ipython-input-1-b0bbdc271ffb>(5)foo()
625 > <ipython-input-1-b0bbdc271ffb>(5)foo()
617 3 bar(x)
626 3 bar(x)
618 4 except Exception as e:
627 4 except Exception as e:
619 ----> 5 raise ValueError("foo (): bar failed") from e
628 ----> 5 raise ValueError("foo (): bar failed") from e
620
629
621 In previous ipdb you could not go into the bar error, now from within pdb you
630 In previous ipdb you could not go into the bar error, now from within pdb you
622 can use ``exceptions``:
631 can use ``exceptions``:
623
632
624 .. code-block:: ipython
633 .. code-block:: ipython
625
634
626 ipdb> exceptions
635 ipdb> exceptions
627 0 NameError("name 'X' is not defined")
636 0 NameError("name 'X' is not defined")
628 > 1 ValueError('foo (): bar failed')
637 > 1 ValueError('foo (): bar failed')
629
638
630 ipdb> exceptions 0
639 ipdb> exceptions 0
631 > <ipython-input-1-b0bbdc271ffb>(9)bar()
640 > <ipython-input-1-b0bbdc271ffb>(9)bar()
632 6
641 6
633 7
642 7
634 8 def bar(x):
643 8 def bar(x):
635 ----> 9 1 / X
644 ----> 9 1 / X
636 10
645 10
637
646
638 ipdb>
647 ipdb>
639
648
640 In particular I want to thank the `D.E. Shaw group <https://www.deshaw.com/>`__
649 In particular I want to thank the `D.E. Shaw group <https://www.deshaw.com/>`__
641 for suggesting and funding the two largest feature as well as many bug fixes of
650 for suggesting and funding the two largest feature as well as many bug fixes of
642 this release.
651 this release.
643
652
644 As usual you can find the full list of PRs on GitHub under `the 8.15 milestone
653 As usual you can find the full list of PRs on GitHub under `the 8.15 milestone
645 <https://github.com/ipython/ipython/milestone/120?closed=1>`__.
654 <https://github.com/ipython/ipython/milestone/120?closed=1>`__.
646
655
647
656
648
657
649 .. _version 8.14:
658 .. _version 8.14:
650
659
651 IPython 8.14
660 IPython 8.14
652 ------------
661 ------------
653
662
654 Small release of IPython.
663 Small release of IPython.
655
664
656 - :ghpull:`14080` fixes some shortcuts issues.
665 - :ghpull:`14080` fixes some shortcuts issues.
657 - :ghpull:`14056` Add option to ``%autoreload`` to hide errors when reloading code. This will be the default for spyder
666 - :ghpull:`14056` Add option to ``%autoreload`` to hide errors when reloading code. This will be the default for spyder
658 user is my understanding.
667 user is my understanding.
659 - :ghpull:`14039` (and :ghpull:`14040`) to show exception notes in tracebacks.
668 - :ghpull:`14039` (and :ghpull:`14040`) to show exception notes in tracebacks.
660
669
661 - :ghpull:`14076` Add option to EventManager to prevent printing
670 - :ghpull:`14076` Add option to EventManager to prevent printing
662
671
663
672
664 SPEC 0 and SPEC 4
673 SPEC 0 and SPEC 4
665 ~~~~~~~~~~~~~~~~~
674 ~~~~~~~~~~~~~~~~~
666
675
667 You've heard about the NEPs, (NumPy enhancement Proposal), having a NEP for something non-numpy specific was sometime confusing.
676 You've heard about the NEPs, (NumPy enhancement Proposal), having a NEP for something non-numpy specific was sometime confusing.
668 Long live the `SPECs <https://scientific-python.org/specs/>`_.
677 Long live the `SPECs <https://scientific-python.org/specs/>`_.
669
678
670 We are now trying to follow SPEC 0 (aka old NEP 29) for support of upstream libraries.
679 We are now trying to follow SPEC 0 (aka old NEP 29) for support of upstream libraries.
671
680
672 We also now try to follow SPEC 4 (test and publish nightly on a centralized nightly repository).
681 We also now try to follow SPEC 4 (test and publish nightly on a centralized nightly repository).
673 We encourage you to do so as well in order to report breakage, and contribute to the SPEC process !
682 We encourage you to do so as well in order to report breakage, and contribute to the SPEC process !
674
683
675
684
676 Python 3.12 compatibility ?
685 Python 3.12 compatibility ?
677 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
686 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
678
687
679 Python 3.12 changed its tokenizer to have better support for f-strings and allow arbitrary expression.
688 Python 3.12 changed its tokenizer to have better support for f-strings and allow arbitrary expression.
680 This is a great new feature and performance improvement in Python 3.12.
689 This is a great new feature and performance improvement in Python 3.12.
681
690
682 Unfortunately this means the new tokenizer does not support incomplete or invalid Python which will
691 Unfortunately this means the new tokenizer does not support incomplete or invalid Python which will
683 break many features of IPython. Thus compatibility of IPython with Python 3.12 is not guaranteed.
692 break many features of IPython. Thus compatibility of IPython with Python 3.12 is not guaranteed.
684 It is unclear to which extent IPython is affected, and whether we can/should try to still support magics, shell
693 It is unclear to which extent IPython is affected, and whether we can/should try to still support magics, shell
685 escape (``! ....``), ..., as well as how to do it if we can.
694 escape (``! ....``), ..., as well as how to do it if we can.
686
695
687 In addition even if we there is technical feasibility to do so, it is no clear we have the resources to do it.
696 In addition even if we there is technical feasibility to do so, it is no clear we have the resources to do it.
688 We are thus looking for your help if you can _test_ on Python 3.12 to see to which extent this affects users and which
697 We are thus looking for your help if you can _test_ on Python 3.12 to see to which extent this affects users and which
689 features are critical.
698 features are critical.
690
699
691 We are not going to pin IPython to Python ``<3.12`` as otherwise on install pip would downgrade/resolve to IPython 8.13,
700 We are not going to pin IPython to Python ``<3.12`` as otherwise on install pip would downgrade/resolve to IPython 8.13,
692 so if you plan to update to Python 3.12 after its release, we encourage for extra care.
701 so if you plan to update to Python 3.12 after its release, we encourage for extra care.
693
702
694
703
695 .. _version 8.13.1:
704 .. _version 8.13.1:
696 .. _version 8.13.2:
705 .. _version 8.13.2:
697 .. _version 8.12.2:
706 .. _version 8.12.2:
698
707
699 IPython 8.13.1, 8.13.2 and 8.12.2
708 IPython 8.13.1, 8.13.2 and 8.12.2
700 ---------------------------------
709 ---------------------------------
701
710
702 3 quick in succession patch release of IPython in addition to IPython 8.13.0
711 3 quick in succession patch release of IPython in addition to IPython 8.13.0
703 having been yanked.
712 having been yanked.
704
713
705 IPython 8.13.0 was improperly tagged as still compatible with Python 3.8, and
714 IPython 8.13.0 was improperly tagged as still compatible with Python 3.8, and
706 still had some mention of compatibility with 3.8. IPython 8.13.1 is identical to
715 still had some mention of compatibility with 3.8. IPython 8.13.1 is identical to
707 8.13 but with the exception of being correctly tagged. This release and yank was
716 8.13 but with the exception of being correctly tagged. This release and yank was
708 mostly done to fix CI.
717 mostly done to fix CI.
709
718
710 IPython 8.12.2 and 8.13.2 contain UI fixes, with respect to right arrow not
719 IPython 8.12.2 and 8.13.2 contain UI fixes, with respect to right arrow not
711 working in some case in the terminal, and 8.12.2 contain also a requested
720 working in some case in the terminal, and 8.12.2 contain also a requested
712 backport of :ghpull:`14029` (Allow safe access to the ``__getattribute__``
721 backport of :ghpull:`14029` (Allow safe access to the ``__getattribute__``
713 method of modules) for tab completion.
722 method of modules) for tab completion.
714
723
715 .. _version 8.13:
724 .. _version 8.13:
716
725
717 IPython 8.13
726 IPython 8.13
718 ------------
727 ------------
719
728
720 As usual for the end of the month, minor release of IPython. This release is
729 As usual for the end of the month, minor release of IPython. This release is
721 significant in that it not only has a number of bugfixes, but also drop support
730 significant in that it not only has a number of bugfixes, but also drop support
722 for Python 3.8 as per NEP 29 (:ghpull:`14023`).
731 for Python 3.8 as per NEP 29 (:ghpull:`14023`).
723
732
724 All the critical bugfixes have been backported onto the 8.12.1 release (see
733 All the critical bugfixes have been backported onto the 8.12.1 release (see
725 below). In addition to that went into 8.12.1 you'll find:
734 below). In addition to that went into 8.12.1 you'll find:
726
735
727 - Pretty representation for ``Counter`` has been fixed to match the Python one
736 - Pretty representation for ``Counter`` has been fixed to match the Python one
728 and be in decreasing order. :ghpull:`14032`
737 and be in decreasing order. :ghpull:`14032`
729 - Module completion is better when jedi is disabled :ghpull:`14029`.
738 - Module completion is better when jedi is disabled :ghpull:`14029`.
730 - Improvement of ``%%bash`` magic that would get stuck :ghpull:`14019`
739 - Improvement of ``%%bash`` magic that would get stuck :ghpull:`14019`
731
740
732
741
733 We hope you enjoy this release an will maybe see you at JupyterCon in less than
742 We hope you enjoy this release an will maybe see you at JupyterCon in less than
734 two weeks.
743 two weeks.
735
744
736 As usual you can find the full list of PRs on GitHub under `the 8.13 milestone
745 As usual you can find the full list of PRs on GitHub under `the 8.13 milestone
737 <https://github.com/ipython/ipython/milestone/115?closed=1>`__.
746 <https://github.com/ipython/ipython/milestone/115?closed=1>`__.
738
747
739 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
748 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
740 work on IPython and related libraries.
749 work on IPython and related libraries.
741
750
742
751
743 .. _version 8.12.1:
752 .. _version 8.12.1:
744
753
745 IPython 8.12.1
754 IPython 8.12.1
746 --------------
755 --------------
747
756
748 This is the twin release of IPython 8.13 that contain only critical UI and bug
757 This is the twin release of IPython 8.13 that contain only critical UI and bug
749 fixes. The next minor version of IPython has dropped support for Python 3.8 – as
758 fixes. The next minor version of IPython has dropped support for Python 3.8 – as
750 per Nep 29 and this IPython 8.12.x will now only receive bugfixes.
759 per Nep 29 and this IPython 8.12.x will now only receive bugfixes.
751
760
752
761
753 - :ghpull:`14004` Fix a bug introduced in IPython 8.12 that crash when
762 - :ghpull:`14004` Fix a bug introduced in IPython 8.12 that crash when
754 inspecting some docstrings.
763 inspecting some docstrings.
755 - :ghpull:`14010` Fix fast traceback code that was not working in some case.
764 - :ghpull:`14010` Fix fast traceback code that was not working in some case.
756 - :ghpull:`14014` Fix ``%page`` magic broken in some case.
765 - :ghpull:`14014` Fix ``%page`` magic broken in some case.
757 - :ghpull:`14026`, :ghpull:`14027` Tweak default shortcut with respect to
766 - :ghpull:`14026`, :ghpull:`14027` Tweak default shortcut with respect to
758 autosuggestions.
767 autosuggestions.
759 - :ghpull:`14033` add back the ability to use ``.get()`` on OInfo object for
768 - :ghpull:`14033` add back the ability to use ``.get()`` on OInfo object for
760 backward compatibility with h5py (this will be re-deprecated later, and h5py
769 backward compatibility with h5py (this will be re-deprecated later, and h5py
761 will also get a fix).
770 will also get a fix).
762
771
763 As usual you can find the full list of PRs on GitHub under `the 8.12.1 milestone
772 As usual you can find the full list of PRs on GitHub under `the 8.12.1 milestone
764 <https://github.com/ipython/ipython/milestone/116?closed=1>`__.
773 <https://github.com/ipython/ipython/milestone/116?closed=1>`__.
765
774
766 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
775 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
767 work on IPython and related libraries.
776 work on IPython and related libraries.
768
777
769 .. _version 8.12.0:
778 .. _version 8.12.0:
770
779
771 IPython 8.12
780 IPython 8.12
772 ------------
781 ------------
773
782
774 Hopefully slightly early release for IPython 8.12. Last Thursday of the month,
783 Hopefully slightly early release for IPython 8.12. Last Thursday of the month,
775 even if I guess it's likely already Friday somewhere in the pacific ocean.
784 even if I guess it's likely already Friday somewhere in the pacific ocean.
776
785
777 A number of PRs and bug fixes this month with close to 20 PRs merged !
786 A number of PRs and bug fixes this month with close to 20 PRs merged !
778
787
779
788
780 The IPython repo reached :ghpull:`14000` !! Actually the PR that create those exact release
789 The IPython repo reached :ghpull:`14000` !! Actually the PR that create those exact release
781 note is :ghpull:`14000`. Ok, more issues and PR is not always better, and I'd
790 note is :ghpull:`14000`. Ok, more issues and PR is not always better, and I'd
782 love to have more time to close issues and Pull Requests.
791 love to have more time to close issues and Pull Requests.
783
792
784 Let's note that in less than 2 month JupyterCon is back, in Paris please visit
793 Let's note that in less than 2 month JupyterCon is back, in Paris please visit
785 `jupytercon.com <https://jupytercon.com>`__, and looking forward to see you
794 `jupytercon.com <https://jupytercon.com>`__, and looking forward to see you
786 there.
795 there.
787
796
788 Packagers should take note that ``typing_extension`` is now a mandatory dependency
797 Packagers should take note that ``typing_extension`` is now a mandatory dependency
789 for Python versions ``<3.10``.
798 for Python versions ``<3.10``.
790
799
791
800
792
801
793 Let's note also that according to `NEP29
802 Let's note also that according to `NEP29
794 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__, It is soon time to
803 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__, It is soon time to
795 stop support for Python 3.8 that will be release more than 3 and 1/2 years ago::
804 stop support for Python 3.8 that will be release more than 3 and 1/2 years ago::
796
805
797 On Apr 14, 2023 drop support for Python 3.8 (initially released on Oct 14, 2019)
806 On Apr 14, 2023 drop support for Python 3.8 (initially released on Oct 14, 2019)
798
807
799 Thus I am likely to stop advertising support for Python 3.8 in the next
808 Thus I am likely to stop advertising support for Python 3.8 in the next
800 release at the end of April.
809 release at the end of April.
801
810
802
811
803 Here are some miscellaneous updates of interest:
812 Here are some miscellaneous updates of interest:
804
813
805 - :ghpull:`13957` brings updates to the Qt integration, particularly for Qt6.
814 - :ghpull:`13957` brings updates to the Qt integration, particularly for Qt6.
806 - :ghpull:`13960` fixes the %debug magic command to give access to the local
815 - :ghpull:`13960` fixes the %debug magic command to give access to the local
807 scope.
816 scope.
808 - :ghpull:`13964` fixes some crashes with the new fast traceback code. Note that
817 - :ghpull:`13964` fixes some crashes with the new fast traceback code. Note that
809 there are still some issues with the fast traceback code, and I a, likely
818 there are still some issues with the fast traceback code, and I a, likely
810 to fix and tweak behavior.
819 to fix and tweak behavior.
811 - :ghpull:`13973` We are slowly migrating IPython internals to use proper type
820 - :ghpull:`13973` We are slowly migrating IPython internals to use proper type
812 objects/dataclasses instead of dictionaries to allow static typing checks.
821 objects/dataclasses instead of dictionaries to allow static typing checks.
813 These are technically public API and could lead to breakage, so please let us
822 These are technically public API and could lead to breakage, so please let us
814 know if that's the case and I'll mitigate.
823 know if that's the case and I'll mitigate.
815 - :ghpull:`13990`, :ghpull:`13991`, :ghpull:`13994` all improve keybinding and
824 - :ghpull:`13990`, :ghpull:`13991`, :ghpull:`13994` all improve keybinding and
816 shortcut configurability.
825 shortcut configurability.
817
826
818 As usual you can find the full list of PRs on GitHub under `the 8.12 milestone
827 As usual you can find the full list of PRs on GitHub under `the 8.12 milestone
819 <https://github.com/ipython/ipython/milestone/114?closed=1>`__.
828 <https://github.com/ipython/ipython/milestone/114?closed=1>`__.
820
829
821 We want to thank the D.E. Shaw group for requesting and sponsoring the work on
830 We want to thank the D.E. Shaw group for requesting and sponsoring the work on
822 the following big feature. We had productive discussions on how to best expose
831 the following big feature. We had productive discussions on how to best expose
823 this feature
832 this feature
824
833
825 Dynamic documentation dispatch
834 Dynamic documentation dispatch
826 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
835 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
827
836
828 We are experimenting with dynamic documentation dispatch for object attribute.
837 We are experimenting with dynamic documentation dispatch for object attribute.
829 See :ghissue:`13860`. The goal is to allow object to define documentation for
838 See :ghissue:`13860`. The goal is to allow object to define documentation for
830 their attributes, properties, even when those are dynamically defined with
839 their attributes, properties, even when those are dynamically defined with
831 `__getattr__`.
840 `__getattr__`.
832
841
833 In particular when those objects are base types it can be useful to show the
842 In particular when those objects are base types it can be useful to show the
834 documentation
843 documentation
835
844
836
845
837 .. code-block:: ipython
846 .. code-block:: ipython
838
847
839
848
840 In [1]: class User:
849 In [1]: class User:
841 ...:
850 ...:
842 ...: __custom_documentations__ = {
851 ...: __custom_documentations__ = {
843 ...: "first": "The first name of the user.",
852 ...: "first": "The first name of the user.",
844 ...: "last": "The last name of the user.",
853 ...: "last": "The last name of the user.",
845 ...: }
854 ...: }
846 ...:
855 ...:
847 ...: first:str
856 ...: first:str
848 ...: last:str
857 ...: last:str
849 ...:
858 ...:
850 ...: def __init__(self, first, last):
859 ...: def __init__(self, first, last):
851 ...: self.first = first
860 ...: self.first = first
852 ...: self.last = last
861 ...: self.last = last
853 ...:
862 ...:
854 ...: @property
863 ...: @property
855 ...: def full(self):
864 ...: def full(self):
856 ...: """`self.first` and `self.last` joined by a space."""
865 ...: """`self.first` and `self.last` joined by a space."""
857 ...: return self.first + " " + self.last
866 ...: return self.first + " " + self.last
858 ...:
867 ...:
859 ...:
868 ...:
860 ...: user = Person('Jane', 'Doe')
869 ...: user = Person('Jane', 'Doe')
861
870
862 In [2]: user.first?
871 In [2]: user.first?
863 Type: str
872 Type: str
864 String form: Jane
873 String form: Jane
865 Length: 4
874 Length: 4
866 Docstring: the first name of a the person object, a str
875 Docstring: the first name of a the person object, a str
867 Class docstring:
876 Class docstring:
868 ....
877 ....
869
878
870 In [3]: user.last?
879 In [3]: user.last?
871 Type: str
880 Type: str
872 String form: Doe
881 String form: Doe
873 Length: 3
882 Length: 3
874 Docstring: the last name, also a str
883 Docstring: the last name, also a str
875 ...
884 ...
876
885
877
886
878 We can see here the symmetry with IPython looking for the docstring on the
887 We can see here the symmetry with IPython looking for the docstring on the
879 properties:
888 properties:
880
889
881 .. code-block:: ipython
890 .. code-block:: ipython
882
891
883
892
884 In [4]: user.full?
893 In [4]: user.full?
885 HERE
894 HERE
886 Type: property
895 Type: property
887 String form: <property object at 0x102bb15d0>
896 String form: <property object at 0x102bb15d0>
888 Docstring: first and last join by a space
897 Docstring: first and last join by a space
889
898
890
899
891 Note that while in the above example we use a static dictionary, libraries may
900 Note that while in the above example we use a static dictionary, libraries may
892 decide to use a custom object that define ``__getitem__``, we caution against
901 decide to use a custom object that define ``__getitem__``, we caution against
893 using objects that would trigger computation to show documentation, but it is
902 using objects that would trigger computation to show documentation, but it is
894 sometime preferable for highly dynamic code that for example export ans API as
903 sometime preferable for highly dynamic code that for example export ans API as
895 object.
904 object.
896
905
897
906
898
907
899 .. _version 8.11.0:
908 .. _version 8.11.0:
900
909
901 IPython 8.11
910 IPython 8.11
902 ------------
911 ------------
903
912
904 Back on almost regular monthly schedule for IPython with end-of-month
913 Back on almost regular monthly schedule for IPython with end-of-month
905 really-late-Friday release to make sure some bugs are properly fixed.
914 really-late-Friday release to make sure some bugs are properly fixed.
906 Small addition of with a few new features, bugfix and UX improvements.
915 Small addition of with a few new features, bugfix and UX improvements.
907
916
908 This is a non-exhaustive list, but among other you will find:
917 This is a non-exhaustive list, but among other you will find:
909
918
910 Faster Traceback Highlighting
919 Faster Traceback Highlighting
911 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
920 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
912
921
913 Resurrection of pre-IPython-8 traceback highlighting code.
922 Resurrection of pre-IPython-8 traceback highlighting code.
914
923
915 Really long and complicated files were slow to highlight in traceback with
924 Really long and complicated files were slow to highlight in traceback with
916 IPython 8 despite upstream improvement that make many case better. Therefore
925 IPython 8 despite upstream improvement that make many case better. Therefore
917 starting with IPython 8.11 when one of the highlighted file is more than 10 000
926 starting with IPython 8.11 when one of the highlighted file is more than 10 000
918 line long by default, we'll fallback to a faster path that does not have all the
927 line long by default, we'll fallback to a faster path that does not have all the
919 features of highlighting failing AST nodes.
928 features of highlighting failing AST nodes.
920
929
921 This can be configures by setting the value of
930 This can be configures by setting the value of
922 ``IPython.code.ultratb.FAST_THRESHOLD`` to an arbitrary low or large value.
931 ``IPython.code.ultratb.FAST_THRESHOLD`` to an arbitrary low or large value.
923
932
924
933
925 Autoreload verbosity
934 Autoreload verbosity
926 ~~~~~~~~~~~~~~~~~~~~
935 ~~~~~~~~~~~~~~~~~~~~
927
936
928 We introduce more descriptive names for the ``%autoreload`` parameter:
937 We introduce more descriptive names for the ``%autoreload`` parameter:
929
938
930 - ``%autoreload now`` (also ``%autoreload``) - perform autoreload immediately.
939 - ``%autoreload now`` (also ``%autoreload``) - perform autoreload immediately.
931 - ``%autoreload off`` (also ``%autoreload 0``) - turn off autoreload.
940 - ``%autoreload off`` (also ``%autoreload 0``) - turn off autoreload.
932 - ``%autoreload explicit`` (also ``%autoreload 1``) - turn on autoreload only for modules
941 - ``%autoreload explicit`` (also ``%autoreload 1``) - turn on autoreload only for modules
933 whitelisted by ``%aimport`` statements.
942 whitelisted by ``%aimport`` statements.
934 - ``%autoreload all`` (also ``%autoreload 2``) - turn on autoreload for all modules except those
943 - ``%autoreload all`` (also ``%autoreload 2``) - turn on autoreload for all modules except those
935 blacklisted by ``%aimport`` statements.
944 blacklisted by ``%aimport`` statements.
936 - ``%autoreload complete`` (also ``%autoreload 3``) - all the features of ``all`` but also adding new
945 - ``%autoreload complete`` (also ``%autoreload 3``) - all the features of ``all`` but also adding new
937 objects from the imported modules (see
946 objects from the imported modules (see
938 IPython/extensions/tests/test_autoreload.py::test_autoload_newly_added_objects).
947 IPython/extensions/tests/test_autoreload.py::test_autoload_newly_added_objects).
939
948
940 The original designations (e.g. "2") still work, and these new ones are case-insensitive.
949 The original designations (e.g. "2") still work, and these new ones are case-insensitive.
941
950
942 Additionally, the option ``--print`` or ``-p`` can be added to the line to print the names of
951 Additionally, the option ``--print`` or ``-p`` can be added to the line to print the names of
943 modules being reloaded. Similarly, ``--log`` or ``-l`` will output the names to the logger at INFO
952 modules being reloaded. Similarly, ``--log`` or ``-l`` will output the names to the logger at INFO
944 level. Both can be used simultaneously.
953 level. Both can be used simultaneously.
945
954
946 The parsing logic for ``%aimport`` is now improved such that modules can be whitelisted and
955 The parsing logic for ``%aimport`` is now improved such that modules can be whitelisted and
947 blacklisted in the same line, e.g. it's now possible to call ``%aimport os, -math`` to include
956 blacklisted in the same line, e.g. it's now possible to call ``%aimport os, -math`` to include
948 ``os`` for ``%autoreload explicit`` and exclude ``math`` for modes ``all`` and ``complete``.
957 ``os`` for ``%autoreload explicit`` and exclude ``math`` for modes ``all`` and ``complete``.
949
958
950 Terminal shortcuts customization
959 Terminal shortcuts customization
951 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
960 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
952
961
953 Previously modifying shortcuts was only possible by hooking into startup files
962 Previously modifying shortcuts was only possible by hooking into startup files
954 and practically limited to adding new shortcuts or removing all shortcuts bound
963 and practically limited to adding new shortcuts or removing all shortcuts bound
955 to a specific key. This release enables users to override existing terminal
964 to a specific key. This release enables users to override existing terminal
956 shortcuts, disable them or add new keybindings.
965 shortcuts, disable them or add new keybindings.
957
966
958 For example, to set the :kbd:`right` to accept a single character of auto-suggestion
967 For example, to set the :kbd:`right` to accept a single character of auto-suggestion
959 you could use::
968 you could use::
960
969
961 my_shortcuts = [
970 my_shortcuts = [
962 {
971 {
963 "command": "IPython:auto_suggest.accept_character",
972 "command": "IPython:auto_suggest.accept_character",
964 "new_keys": ["right"]
973 "new_keys": ["right"]
965 }
974 }
966 ]
975 ]
967 %config TerminalInteractiveShell.shortcuts = my_shortcuts
976 %config TerminalInteractiveShell.shortcuts = my_shortcuts
968
977
969 You can learn more in :std:configtrait:`TerminalInteractiveShell.shortcuts`
978 You can learn more in :std:configtrait:`TerminalInteractiveShell.shortcuts`
970 configuration reference.
979 configuration reference.
971
980
972 Miscellaneous
981 Miscellaneous
973 ~~~~~~~~~~~~~
982 ~~~~~~~~~~~~~
974
983
975 - ``%gui`` should now support PySide6. :ghpull:`13864`
984 - ``%gui`` should now support PySide6. :ghpull:`13864`
976 - Cli shortcuts can now be configured :ghpull:`13928`, see above.
985 - Cli shortcuts can now be configured :ghpull:`13928`, see above.
977 (note that there might be an issue with prompt_toolkit 3.0.37 and shortcut configuration).
986 (note that there might be an issue with prompt_toolkit 3.0.37 and shortcut configuration).
978
987
979 - Capture output should now respect ``;`` semicolon to suppress output.
988 - Capture output should now respect ``;`` semicolon to suppress output.
980 :ghpull:`13940`
989 :ghpull:`13940`
981 - Base64 encoded images (in jupyter frontend), will not have trailing newlines.
990 - Base64 encoded images (in jupyter frontend), will not have trailing newlines.
982 :ghpull:`13941`
991 :ghpull:`13941`
983
992
984 As usual you can find the full list of PRs on GitHub under `the 8.11 milestone
993 As usual you can find the full list of PRs on GitHub under `the 8.11 milestone
985 <https://github.com/ipython/ipython/milestone/113?closed=1>`__.
994 <https://github.com/ipython/ipython/milestone/113?closed=1>`__.
986
995
987 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
996 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
988 work on IPython and related libraries.
997 work on IPython and related libraries.
989
998
990 .. _version 8.10.0:
999 .. _version 8.10.0:
991
1000
992 IPython 8.10
1001 IPython 8.10
993 ------------
1002 ------------
994
1003
995 Out of schedule release of IPython with minor fixes to patch a potential CVE-2023-24816.
1004 Out of schedule release of IPython with minor fixes to patch a potential CVE-2023-24816.
996 This is a really low severity CVE that you most likely are not affected by unless:
1005 This is a really low severity CVE that you most likely are not affected by unless:
997
1006
998 - You are on windows.
1007 - You are on windows.
999 - You have a custom build of Python without ``_ctypes``
1008 - You have a custom build of Python without ``_ctypes``
1000 - You cd or start IPython or Jupyter in untrusted directory which names may be
1009 - You cd or start IPython or Jupyter in untrusted directory which names may be
1001 valid shell commands.
1010 valid shell commands.
1002
1011
1003 You can read more on `the advisory
1012 You can read more on `the advisory
1004 <https://github.com/ipython/ipython/security/advisories/GHSA-29gw-9793-fvw7>`__.
1013 <https://github.com/ipython/ipython/security/advisories/GHSA-29gw-9793-fvw7>`__.
1005
1014
1006 In addition to fixing this CVE we also fix a couple of outstanding bugs and issues.
1015 In addition to fixing this CVE we also fix a couple of outstanding bugs and issues.
1007
1016
1008 As usual you can find the full list of PRs on GitHub under `the 8.10 milestone
1017 As usual you can find the full list of PRs on GitHub under `the 8.10 milestone
1009 <https://github.com/ipython/ipython/milestone/112?closed=1>`__.
1018 <https://github.com/ipython/ipython/milestone/112?closed=1>`__.
1010
1019
1011 In Particular:
1020 In Particular:
1012
1021
1013 - bump minimum numpy to `>=1.21` version following NEP29. :ghpull:`13930`
1022 - bump minimum numpy to `>=1.21` version following NEP29. :ghpull:`13930`
1014 - fix for compatibility with MyPy 1.0. :ghpull:`13933`
1023 - fix for compatibility with MyPy 1.0. :ghpull:`13933`
1015 - fix nbgrader stalling when IPython's ``showtraceback`` function is
1024 - fix nbgrader stalling when IPython's ``showtraceback`` function is
1016 monkeypatched. :ghpull:`13934`
1025 monkeypatched. :ghpull:`13934`
1017
1026
1018
1027
1019
1028
1020 As this release also contains those minimal changes in addition to fixing the
1029 As this release also contains those minimal changes in addition to fixing the
1021 CVE I decided to bump the minor version anyway.
1030 CVE I decided to bump the minor version anyway.
1022
1031
1023 This will not affect the normal release schedule, so IPython 8.11 is due in
1032 This will not affect the normal release schedule, so IPython 8.11 is due in
1024 about 2 weeks.
1033 about 2 weeks.
1025
1034
1026 .. _version 8.9.0:
1035 .. _version 8.9.0:
1027
1036
1028 IPython 8.9.0
1037 IPython 8.9.0
1029 -------------
1038 -------------
1030
1039
1031 Second release of IPython in 2023, last Friday of the month, we are back on
1040 Second release of IPython in 2023, last Friday of the month, we are back on
1032 track. This is a small release with a few bug-fixes, and improvements, mostly
1041 track. This is a small release with a few bug-fixes, and improvements, mostly
1033 with respect to terminal shortcuts.
1042 with respect to terminal shortcuts.
1034
1043
1035
1044
1036 The biggest improvement for 8.9 is a drastic amelioration of the
1045 The biggest improvement for 8.9 is a drastic amelioration of the
1037 auto-suggestions sponsored by D.E. Shaw and implemented by the more and more
1046 auto-suggestions sponsored by D.E. Shaw and implemented by the more and more
1038 active contributor `@krassowski <https://github.com/krassowski>`.
1047 active contributor `@krassowski <https://github.com/krassowski>`.
1039
1048
1040 - ``right`` accepts a single character from suggestion
1049 - ``right`` accepts a single character from suggestion
1041 - ``ctrl+right`` accepts a semantic token (macos default shortcuts take
1050 - ``ctrl+right`` accepts a semantic token (macos default shortcuts take
1042 precedence and need to be disabled to make this work)
1051 precedence and need to be disabled to make this work)
1043 - ``backspace`` deletes a character and resumes hinting autosuggestions
1052 - ``backspace`` deletes a character and resumes hinting autosuggestions
1044 - ``ctrl-left`` accepts suggestion and moves cursor left one character.
1053 - ``ctrl-left`` accepts suggestion and moves cursor left one character.
1045 - ``backspace`` deletes a character and resumes hinting autosuggestions
1054 - ``backspace`` deletes a character and resumes hinting autosuggestions
1046 - ``down`` moves to suggestion to later in history when no lines are present below the cursors.
1055 - ``down`` moves to suggestion to later in history when no lines are present below the cursors.
1047 - ``up`` moves to suggestion from earlier in history when no lines are present above the cursor.
1056 - ``up`` moves to suggestion from earlier in history when no lines are present above the cursor.
1048
1057
1049 This is best described by the Gif posted by `@krassowski
1058 This is best described by the Gif posted by `@krassowski
1050 <https://github.com/krassowski>`, and in the PR itself :ghpull:`13888`.
1059 <https://github.com/krassowski>`, and in the PR itself :ghpull:`13888`.
1051
1060
1052 .. image:: ../_images/autosuggest.gif
1061 .. image:: ../_images/autosuggest.gif
1053
1062
1054 Please report any feedback in order for us to improve the user experience.
1063 Please report any feedback in order for us to improve the user experience.
1055 In particular we are also working on making the shortcuts configurable.
1064 In particular we are also working on making the shortcuts configurable.
1056
1065
1057 If you are interested in better terminal shortcuts, I also invite you to
1066 If you are interested in better terminal shortcuts, I also invite you to
1058 participate in issue `13879
1067 participate in issue `13879
1059 <https://github.com/ipython/ipython/issues/13879>`__.
1068 <https://github.com/ipython/ipython/issues/13879>`__.
1060
1069
1061
1070
1062 As we follow `NEP29
1071 As we follow `NEP29
1063 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__, next version of
1072 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__, next version of
1064 IPython will officially stop supporting numpy 1.20, and will stop supporting
1073 IPython will officially stop supporting numpy 1.20, and will stop supporting
1065 Python 3.8 after April release.
1074 Python 3.8 after April release.
1066
1075
1067 As usual you can find the full list of PRs on GitHub under `the 8.9 milestone
1076 As usual you can find the full list of PRs on GitHub under `the 8.9 milestone
1068 <https://github.com/ipython/ipython/milestone/111?closed=1>`__.
1077 <https://github.com/ipython/ipython/milestone/111?closed=1>`__.
1069
1078
1070
1079
1071 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1080 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1072 work on IPython and related libraries.
1081 work on IPython and related libraries.
1073
1082
1074 .. _version 8.8.0:
1083 .. _version 8.8.0:
1075
1084
1076 IPython 8.8.0
1085 IPython 8.8.0
1077 -------------
1086 -------------
1078
1087
1079 First release of IPython in 2023 as there was no release at the end of
1088 First release of IPython in 2023 as there was no release at the end of
1080 December.
1089 December.
1081
1090
1082 This is an unusually big release (relatively speaking) with more than 15 Pull
1091 This is an unusually big release (relatively speaking) with more than 15 Pull
1083 Requests merged.
1092 Requests merged.
1084
1093
1085 Of particular interest are:
1094 Of particular interest are:
1086
1095
1087 - :ghpull:`13852` that replaces the greedy completer and improves
1096 - :ghpull:`13852` that replaces the greedy completer and improves
1088 completion, in particular for dictionary keys.
1097 completion, in particular for dictionary keys.
1089 - :ghpull:`13858` that adds ``py.typed`` to ``setup.cfg`` to make sure it is
1098 - :ghpull:`13858` that adds ``py.typed`` to ``setup.cfg`` to make sure it is
1090 bundled in wheels.
1099 bundled in wheels.
1091 - :ghpull:`13869` that implements tab completions for IPython options in the
1100 - :ghpull:`13869` that implements tab completions for IPython options in the
1092 shell when using `argcomplete <https://github.com/kislyuk/argcomplete>`. I
1101 shell when using `argcomplete <https://github.com/kislyuk/argcomplete>`. I
1093 believe this also needs a recent version of Traitlets.
1102 believe this also needs a recent version of Traitlets.
1094 - :ghpull:`13865` makes the ``inspector`` class of `InteractiveShell`
1103 - :ghpull:`13865` makes the ``inspector`` class of `InteractiveShell`
1095 configurable.
1104 configurable.
1096 - :ghpull:`13880` that removes minor-version entrypoints as the minor version
1105 - :ghpull:`13880` that removes minor-version entrypoints as the minor version
1097 entry points that would be included in the wheel would be the one of the
1106 entry points that would be included in the wheel would be the one of the
1098 Python version that was used to build the ``whl`` file.
1107 Python version that was used to build the ``whl`` file.
1099
1108
1100 In no particular order, the rest of the changes update the test suite to be
1109 In no particular order, the rest of the changes update the test suite to be
1101 compatible with Pygments 2.14, various docfixes, testing on more recent python
1110 compatible with Pygments 2.14, various docfixes, testing on more recent python
1102 versions and various updates.
1111 versions and various updates.
1103
1112
1104 As usual you can find the full list of PRs on GitHub under `the 8.8 milestone
1113 As usual you can find the full list of PRs on GitHub under `the 8.8 milestone
1105 <https://github.com/ipython/ipython/milestone/110>`__.
1114 <https://github.com/ipython/ipython/milestone/110>`__.
1106
1115
1107 Many thanks to @krassowski for the many PRs and @jasongrout for reviewing and
1116 Many thanks to @krassowski for the many PRs and @jasongrout for reviewing and
1108 merging contributions.
1117 merging contributions.
1109
1118
1110 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1119 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1111 work on IPython and related libraries.
1120 work on IPython and related libraries.
1112
1121
1113 .. _version 8.7.0:
1122 .. _version 8.7.0:
1114
1123
1115 IPython 8.7.0
1124 IPython 8.7.0
1116 -------------
1125 -------------
1117
1126
1118
1127
1119 Small release of IPython with a couple of bug fixes and new features for this
1128 Small release of IPython with a couple of bug fixes and new features for this
1120 month. Next month is the end of year, it is unclear if there will be a release
1129 month. Next month is the end of year, it is unclear if there will be a release
1121 close to the new year's eve, or if the next release will be at the end of January.
1130 close to the new year's eve, or if the next release will be at the end of January.
1122
1131
1123 Here are a few of the relevant fixes,
1132 Here are a few of the relevant fixes,
1124 as usual you can find the full list of PRs on GitHub under `the 8.7 milestone
1133 as usual you can find the full list of PRs on GitHub under `the 8.7 milestone
1125 <https://github.com/ipython/ipython/pulls?q=milestone%3A8.7>`__.
1134 <https://github.com/ipython/ipython/pulls?q=milestone%3A8.7>`__.
1126
1135
1127
1136
1128 - :ghpull:`13834` bump the minimum prompt toolkit to 3.0.11.
1137 - :ghpull:`13834` bump the minimum prompt toolkit to 3.0.11.
1129 - IPython shipped with the ``py.typed`` marker now, and we are progressively
1138 - IPython shipped with the ``py.typed`` marker now, and we are progressively
1130 adding more types. :ghpull:`13831`
1139 adding more types. :ghpull:`13831`
1131 - :ghpull:`13817` add configuration of code blacks formatting.
1140 - :ghpull:`13817` add configuration of code blacks formatting.
1132
1141
1133
1142
1134 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1143 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1135 work on IPython and related libraries.
1144 work on IPython and related libraries.
1136
1145
1137
1146
1138 .. _version 8.6.0:
1147 .. _version 8.6.0:
1139
1148
1140 IPython 8.6.0
1149 IPython 8.6.0
1141 -------------
1150 -------------
1142
1151
1143 Back to a more regular release schedule (at least I try), as Friday is
1152 Back to a more regular release schedule (at least I try), as Friday is
1144 already over by more than 24h hours. This is a slightly bigger release with a
1153 already over by more than 24h hours. This is a slightly bigger release with a
1145 few new features that contain no less than 25 PRs.
1154 few new features that contain no less than 25 PRs.
1146
1155
1147 We'll notably found a couple of non negligible changes:
1156 We'll notably found a couple of non negligible changes:
1148
1157
1149 The ``install_ext`` and related functions have been removed after being
1158 The ``install_ext`` and related functions have been removed after being
1150 deprecated for years. You can use pip to install extensions. ``pip`` did not
1159 deprecated for years. You can use pip to install extensions. ``pip`` did not
1151 exist when ``install_ext`` was introduced. You can still load local extensions
1160 exist when ``install_ext`` was introduced. You can still load local extensions
1152 without installing them. Just set your ``sys.path`` for example. :ghpull:`13744`
1161 without installing them. Just set your ``sys.path`` for example. :ghpull:`13744`
1153
1162
1154 IPython now has extra entry points that use the major *and minor* version of
1163 IPython now has extra entry points that use the major *and minor* version of
1155 python. For some of you this means that you can do a quick ``ipython3.10`` to
1164 python. For some of you this means that you can do a quick ``ipython3.10`` to
1156 launch IPython from the Python 3.10 interpreter, while still using Python 3.11
1165 launch IPython from the Python 3.10 interpreter, while still using Python 3.11
1157 as your main Python. :ghpull:`13743`
1166 as your main Python. :ghpull:`13743`
1158
1167
1159 The completer matcher API has been improved. See :ghpull:`13745`. This should
1168 The completer matcher API has been improved. See :ghpull:`13745`. This should
1160 improve the type inference and improve dict keys completions in many use case.
1169 improve the type inference and improve dict keys completions in many use case.
1161 Thanks ``@krassowski`` for all the work, and the D.E. Shaw group for sponsoring
1170 Thanks ``@krassowski`` for all the work, and the D.E. Shaw group for sponsoring
1162 it.
1171 it.
1163
1172
1164 The color of error nodes in tracebacks can now be customized. See
1173 The color of error nodes in tracebacks can now be customized. See
1165 :ghpull:`13756`. This is a private attribute until someone finds the time to
1174 :ghpull:`13756`. This is a private attribute until someone finds the time to
1166 properly add a configuration option. Note that with Python 3.11 that also shows
1175 properly add a configuration option. Note that with Python 3.11 that also shows
1167 the relevant nodes in traceback, it would be good to leverage this information
1176 the relevant nodes in traceback, it would be good to leverage this information
1168 (plus the "did you mean" info added on attribute errors). But that's likely work
1177 (plus the "did you mean" info added on attribute errors). But that's likely work
1169 I won't have time to do before long, so contributions welcome.
1178 I won't have time to do before long, so contributions welcome.
1170
1179
1171 As we follow NEP 29, we removed support for numpy 1.19 :ghpull:`13760`.
1180 As we follow NEP 29, we removed support for numpy 1.19 :ghpull:`13760`.
1172
1181
1173
1182
1174 The ``open()`` function present in the user namespace by default will now refuse
1183 The ``open()`` function present in the user namespace by default will now refuse
1175 to open the file descriptors 0,1,2 (stdin, out, err), to avoid crashing IPython.
1184 to open the file descriptors 0,1,2 (stdin, out, err), to avoid crashing IPython.
1176 This mostly occurs in teaching context when incorrect values get passed around.
1185 This mostly occurs in teaching context when incorrect values get passed around.
1177
1186
1178
1187
1179 The ``?``, ``??``, and corresponding ``pinfo``, ``pinfo2`` magics can now find
1188 The ``?``, ``??``, and corresponding ``pinfo``, ``pinfo2`` magics can now find
1180 objects inside arrays. That is to say, the following now works::
1189 objects inside arrays. That is to say, the following now works::
1181
1190
1182
1191
1183 >>> def my_func(*arg, **kwargs):pass
1192 >>> def my_func(*arg, **kwargs):pass
1184 >>> container = [my_func]
1193 >>> container = [my_func]
1185 >>> container[0]?
1194 >>> container[0]?
1186
1195
1187
1196
1188 If ``container`` define a custom ``getitem``, this __will__ trigger the custom
1197 If ``container`` define a custom ``getitem``, this __will__ trigger the custom
1189 method. So don't put side effects in your ``getitems``. Thanks to the D.E. Shaw
1198 method. So don't put side effects in your ``getitems``. Thanks to the D.E. Shaw
1190 group for the request and sponsoring the work.
1199 group for the request and sponsoring the work.
1191
1200
1192
1201
1193 As usual you can find the full list of PRs on GitHub under `the 8.6 milestone
1202 As usual you can find the full list of PRs on GitHub under `the 8.6 milestone
1194 <https://github.com/ipython/ipython/pulls?q=milestone%3A8.6>`__.
1203 <https://github.com/ipython/ipython/pulls?q=milestone%3A8.6>`__.
1195
1204
1196 Thanks to all hacktoberfest contributors, please contribute to
1205 Thanks to all hacktoberfest contributors, please contribute to
1197 `closember.org <https://closember.org/>`__.
1206 `closember.org <https://closember.org/>`__.
1198
1207
1199 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1208 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1200 work on IPython and related libraries.
1209 work on IPython and related libraries.
1201
1210
1202 .. _version 8.5.0:
1211 .. _version 8.5.0:
1203
1212
1204 IPython 8.5.0
1213 IPython 8.5.0
1205 -------------
1214 -------------
1206
1215
1207 First release since a couple of month due to various reasons and timing preventing
1216 First release since a couple of month due to various reasons and timing preventing
1208 me for sticking to the usual monthly release the last Friday of each month. This
1217 me for sticking to the usual monthly release the last Friday of each month. This
1209 is of non negligible size as it has more than two dozen PRs with various fixes
1218 is of non negligible size as it has more than two dozen PRs with various fixes
1210 an bug fixes.
1219 an bug fixes.
1211
1220
1212 Many thanks to everybody who contributed PRs for your patience in review and
1221 Many thanks to everybody who contributed PRs for your patience in review and
1213 merges.
1222 merges.
1214
1223
1215 Here is a non-exhaustive list of changes that have been implemented for IPython
1224 Here is a non-exhaustive list of changes that have been implemented for IPython
1216 8.5.0. As usual you can find the full list of issues and PRs tagged with `the
1225 8.5.0. As usual you can find the full list of issues and PRs tagged with `the
1217 8.5 milestone
1226 8.5 milestone
1218 <https://github.com/ipython/ipython/pulls?q=is%3Aclosed+milestone%3A8.5+>`__.
1227 <https://github.com/ipython/ipython/pulls?q=is%3Aclosed+milestone%3A8.5+>`__.
1219
1228
1220 - Added a shortcut for accepting auto suggestion. The End key shortcut for
1229 - Added a shortcut for accepting auto suggestion. The End key shortcut for
1221 accepting auto-suggestion This binding works in Vi mode too, provided
1230 accepting auto-suggestion This binding works in Vi mode too, provided
1222 ``TerminalInteractiveShell.emacs_bindings_in_vi_insert_mode`` is set to be
1231 ``TerminalInteractiveShell.emacs_bindings_in_vi_insert_mode`` is set to be
1223 ``True`` :ghpull:`13566`.
1232 ``True`` :ghpull:`13566`.
1224
1233
1225 - No popup in window for latex generation when generating latex (e.g. via
1234 - No popup in window for latex generation when generating latex (e.g. via
1226 `_latex_repr_`) no popup window is shows under Windows. :ghpull:`13679`
1235 `_latex_repr_`) no popup window is shows under Windows. :ghpull:`13679`
1227
1236
1228 - Fixed error raised when attempting to tab-complete an input string with
1237 - Fixed error raised when attempting to tab-complete an input string with
1229 consecutive periods or forward slashes (such as "file:///var/log/...").
1238 consecutive periods or forward slashes (such as "file:///var/log/...").
1230 :ghpull:`13675`
1239 :ghpull:`13675`
1231
1240
1232 - Relative filenames in Latex rendering :
1241 - Relative filenames in Latex rendering :
1233 The `latex_to_png_dvipng` command internally generates input and output file
1242 The `latex_to_png_dvipng` command internally generates input and output file
1234 arguments to `latex` and `dvipis`. These arguments are now generated as
1243 arguments to `latex` and `dvipis`. These arguments are now generated as
1235 relative files to the current working directory instead of absolute file
1244 relative files to the current working directory instead of absolute file
1236 paths. This solves a problem where the current working directory contains
1245 paths. This solves a problem where the current working directory contains
1237 characters that are not handled properly by `latex` and `dvips`. There are
1246 characters that are not handled properly by `latex` and `dvips`. There are
1238 no changes to the user API. :ghpull:`13680`
1247 no changes to the user API. :ghpull:`13680`
1239
1248
1240 - Stripping decorators bug: Fixed bug which meant that ipython code blocks in
1249 - Stripping decorators bug: Fixed bug which meant that ipython code blocks in
1241 restructured text documents executed with the ipython-sphinx extension
1250 restructured text documents executed with the ipython-sphinx extension
1242 skipped any lines of code containing python decorators. :ghpull:`13612`
1251 skipped any lines of code containing python decorators. :ghpull:`13612`
1243
1252
1244 - Allow some modules with frozen dataclasses to be reloaded. :ghpull:`13732`
1253 - Allow some modules with frozen dataclasses to be reloaded. :ghpull:`13732`
1245 - Fix paste magic on wayland. :ghpull:`13671`
1254 - Fix paste magic on wayland. :ghpull:`13671`
1246 - show maxlen in deque's repr. :ghpull:`13648`
1255 - show maxlen in deque's repr. :ghpull:`13648`
1247
1256
1248 Restore line numbers for Input
1257 Restore line numbers for Input
1249 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1258 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1250
1259
1251 Line number information in tracebacks from input are restored.
1260 Line number information in tracebacks from input are restored.
1252 Line numbers from input were removed during the transition to v8 enhanced traceback reporting.
1261 Line numbers from input were removed during the transition to v8 enhanced traceback reporting.
1253
1262
1254 So, instead of::
1263 So, instead of::
1255
1264
1256 ---------------------------------------------------------------------------
1265 ---------------------------------------------------------------------------
1257 ZeroDivisionError Traceback (most recent call last)
1266 ZeroDivisionError Traceback (most recent call last)
1258 Input In [3], in <cell line: 1>()
1267 Input In [3], in <cell line: 1>()
1259 ----> 1 myfunc(2)
1268 ----> 1 myfunc(2)
1260
1269
1261 Input In [2], in myfunc(z)
1270 Input In [2], in myfunc(z)
1262 1 def myfunc(z):
1271 1 def myfunc(z):
1263 ----> 2 foo.boo(z-1)
1272 ----> 2 foo.boo(z-1)
1264
1273
1265 File ~/code/python/ipython/foo.py:3, in boo(x)
1274 File ~/code/python/ipython/foo.py:3, in boo(x)
1266 2 def boo(x):
1275 2 def boo(x):
1267 ----> 3 return 1/(1-x)
1276 ----> 3 return 1/(1-x)
1268
1277
1269 ZeroDivisionError: division by zero
1278 ZeroDivisionError: division by zero
1270
1279
1271 The error traceback now looks like::
1280 The error traceback now looks like::
1272
1281
1273 ---------------------------------------------------------------------------
1282 ---------------------------------------------------------------------------
1274 ZeroDivisionError Traceback (most recent call last)
1283 ZeroDivisionError Traceback (most recent call last)
1275 Cell In [3], line 1
1284 Cell In [3], line 1
1276 ----> 1 myfunc(2)
1285 ----> 1 myfunc(2)
1277
1286
1278 Cell In [2], line 2, in myfunc(z)
1287 Cell In [2], line 2, in myfunc(z)
1279 1 def myfunc(z):
1288 1 def myfunc(z):
1280 ----> 2 foo.boo(z-1)
1289 ----> 2 foo.boo(z-1)
1281
1290
1282 File ~/code/python/ipython/foo.py:3, in boo(x)
1291 File ~/code/python/ipython/foo.py:3, in boo(x)
1283 2 def boo(x):
1292 2 def boo(x):
1284 ----> 3 return 1/(1-x)
1293 ----> 3 return 1/(1-x)
1285
1294
1286 ZeroDivisionError: division by zero
1295 ZeroDivisionError: division by zero
1287
1296
1288 or, with xmode=Plain::
1297 or, with xmode=Plain::
1289
1298
1290 Traceback (most recent call last):
1299 Traceback (most recent call last):
1291 Cell In [12], line 1
1300 Cell In [12], line 1
1292 myfunc(2)
1301 myfunc(2)
1293 Cell In [6], line 2 in myfunc
1302 Cell In [6], line 2 in myfunc
1294 foo.boo(z-1)
1303 foo.boo(z-1)
1295 File ~/code/python/ipython/foo.py:3 in boo
1304 File ~/code/python/ipython/foo.py:3 in boo
1296 return 1/(1-x)
1305 return 1/(1-x)
1297 ZeroDivisionError: division by zero
1306 ZeroDivisionError: division by zero
1298
1307
1299 :ghpull:`13560`
1308 :ghpull:`13560`
1300
1309
1301 New setting to silence warning if working inside a virtual environment
1310 New setting to silence warning if working inside a virtual environment
1302 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1311 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1303
1312
1304 Previously, when starting IPython in a virtual environment without IPython installed (so IPython from the global environment is used), the following warning was printed:
1313 Previously, when starting IPython in a virtual environment without IPython installed (so IPython from the global environment is used), the following warning was printed:
1305
1314
1306 Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
1315 Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
1307
1316
1308 This warning can be permanently silenced by setting ``c.InteractiveShell.warn_venv`` to ``False`` (the default is ``True``).
1317 This warning can be permanently silenced by setting ``c.InteractiveShell.warn_venv`` to ``False`` (the default is ``True``).
1309
1318
1310 :ghpull:`13706`
1319 :ghpull:`13706`
1311
1320
1312 -------
1321 -------
1313
1322
1314 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1323 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1315 work on IPython and related libraries.
1324 work on IPython and related libraries.
1316
1325
1317
1326
1318 .. _version 8.4.0:
1327 .. _version 8.4.0:
1319
1328
1320 IPython 8.4.0
1329 IPython 8.4.0
1321 -------------
1330 -------------
1322
1331
1323 As for 7.34, this version contains a single fix: fix uncaught BdbQuit exceptions on ipdb
1332 As for 7.34, this version contains a single fix: fix uncaught BdbQuit exceptions on ipdb
1324 exit :ghpull:`13668`, and a single typo fix in documentation: :ghpull:`13682`
1333 exit :ghpull:`13668`, and a single typo fix in documentation: :ghpull:`13682`
1325
1334
1326 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1335 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1327 work on IPython and related libraries.
1336 work on IPython and related libraries.
1328
1337
1329
1338
1330 .. _version 8.3.0:
1339 .. _version 8.3.0:
1331
1340
1332 IPython 8.3.0
1341 IPython 8.3.0
1333 -------------
1342 -------------
1334
1343
1335 - :ghpull:`13625`, using ``?``, ``??``, ``*?`` will not call
1344 - :ghpull:`13625`, using ``?``, ``??``, ``*?`` will not call
1336 ``set_next_input`` as most frontend allow proper multiline editing and it was
1345 ``set_next_input`` as most frontend allow proper multiline editing and it was
1337 causing issues for many users of multi-cell frontends. This has been backported to 7.33
1346 causing issues for many users of multi-cell frontends. This has been backported to 7.33
1338
1347
1339
1348
1340 - :ghpull:`13600`, ``pre_run_*``-hooks will now have a ``cell_id`` attribute on
1349 - :ghpull:`13600`, ``pre_run_*``-hooks will now have a ``cell_id`` attribute on
1341 the info object when frontend provides it. This has been backported to 7.33
1350 the info object when frontend provides it. This has been backported to 7.33
1342
1351
1343 - :ghpull:`13624`, fixed :kbd:`End` key being broken after accepting an
1352 - :ghpull:`13624`, fixed :kbd:`End` key being broken after accepting an
1344 auto-suggestion.
1353 auto-suggestion.
1345
1354
1346 - :ghpull:`13657` fixed an issue where history from different sessions would be mixed.
1355 - :ghpull:`13657` fixed an issue where history from different sessions would be mixed.
1347
1356
1348 .. _version 8.2.0:
1357 .. _version 8.2.0:
1349
1358
1350 IPython 8.2.0
1359 IPython 8.2.0
1351 -------------
1360 -------------
1352
1361
1353 IPython 8.2 mostly bring bugfixes to IPython.
1362 IPython 8.2 mostly bring bugfixes to IPython.
1354
1363
1355 - Auto-suggestion can now be elected with the ``end`` key. :ghpull:`13566`
1364 - Auto-suggestion can now be elected with the ``end`` key. :ghpull:`13566`
1356 - Some traceback issues with ``assert etb is not None`` have been fixed. :ghpull:`13588`
1365 - Some traceback issues with ``assert etb is not None`` have been fixed. :ghpull:`13588`
1357 - History is now pulled from the sqitel database and not from in-memory.
1366 - History is now pulled from the sqitel database and not from in-memory.
1358 In particular when using the ``%paste`` magic, the content of the pasted text will
1367 In particular when using the ``%paste`` magic, the content of the pasted text will
1359 be part of the history and not the verbatim text ``%paste`` anymore. :ghpull:`13592`
1368 be part of the history and not the verbatim text ``%paste`` anymore. :ghpull:`13592`
1360 - Fix ``Ctrl-\\`` exit cleanup :ghpull:`13603`
1369 - Fix ``Ctrl-\\`` exit cleanup :ghpull:`13603`
1361 - Fixes to ``ultratb`` ipdb support when used outside of IPython. :ghpull:`13498`
1370 - Fixes to ``ultratb`` ipdb support when used outside of IPython. :ghpull:`13498`
1362
1371
1363
1372
1364 I am still trying to fix and investigate :ghissue:`13598`, which seems to be
1373 I am still trying to fix and investigate :ghissue:`13598`, which seems to be
1365 random, and would appreciate help if you find a reproducible minimal case. I've
1374 random, and would appreciate help if you find a reproducible minimal case. I've
1366 tried to make various changes to the codebase to mitigate it, but a proper fix
1375 tried to make various changes to the codebase to mitigate it, but a proper fix
1367 will be difficult without understanding the cause.
1376 will be difficult without understanding the cause.
1368
1377
1369
1378
1370 All the issues on pull-requests for this release can be found in the `8.2
1379 All the issues on pull-requests for this release can be found in the `8.2
1371 milestone. <https://github.com/ipython/ipython/milestone/100>`__ . And some
1380 milestone. <https://github.com/ipython/ipython/milestone/100>`__ . And some
1372 documentation only PR can be found as part of the `7.33 milestone
1381 documentation only PR can be found as part of the `7.33 milestone
1373 <https://github.com/ipython/ipython/milestone/101>`__ (currently not released).
1382 <https://github.com/ipython/ipython/milestone/101>`__ (currently not released).
1374
1383
1375 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1384 Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1376 work on IPython and related libraries.
1385 work on IPython and related libraries.
1377
1386
1378 .. _version 8.1.1:
1387 .. _version 8.1.1:
1379
1388
1380 IPython 8.1.1
1389 IPython 8.1.1
1381 -------------
1390 -------------
1382
1391
1383 Fix an issue with virtualenv and Python 3.8 introduced in 8.1
1392 Fix an issue with virtualenv and Python 3.8 introduced in 8.1
1384
1393
1385 Revert :ghpull:`13537` (fix an issue with symlinks in virtualenv) that raises an
1394 Revert :ghpull:`13537` (fix an issue with symlinks in virtualenv) that raises an
1386 error in Python 3.8, and fixed in a different way in :ghpull:`13559`.
1395 error in Python 3.8, and fixed in a different way in :ghpull:`13559`.
1387
1396
1388 .. _version 8.1:
1397 .. _version 8.1:
1389
1398
1390 IPython 8.1.0
1399 IPython 8.1.0
1391 -------------
1400 -------------
1392
1401
1393 IPython 8.1 is the first minor release after 8.0 and fixes a number of bugs and
1402 IPython 8.1 is the first minor release after 8.0 and fixes a number of bugs and
1394 updates a few behaviors that were problematic with the 8.0 as with many new major
1403 updates a few behaviors that were problematic with the 8.0 as with many new major
1395 release.
1404 release.
1396
1405
1397 Note that beyond the changes listed here, IPython 8.1.0 also contains all the
1406 Note that beyond the changes listed here, IPython 8.1.0 also contains all the
1398 features listed in :ref:`version 7.32`.
1407 features listed in :ref:`version 7.32`.
1399
1408
1400 - Misc and multiple fixes around quotation auto-closing. It is now disabled by
1409 - Misc and multiple fixes around quotation auto-closing. It is now disabled by
1401 default. Run with ``TerminalInteractiveShell.auto_match=True`` to re-enabled
1410 default. Run with ``TerminalInteractiveShell.auto_match=True`` to re-enabled
1402 - Require pygments>=2.4.0 :ghpull:`13459`, this was implicit in the code, but
1411 - Require pygments>=2.4.0 :ghpull:`13459`, this was implicit in the code, but
1403 is now explicit in ``setup.cfg``/``setup.py``
1412 is now explicit in ``setup.cfg``/``setup.py``
1404 - Docs improvement of ``core.magic_arguments`` examples. :ghpull:`13433`
1413 - Docs improvement of ``core.magic_arguments`` examples. :ghpull:`13433`
1405 - Multi-line edit executes too early with await. :ghpull:`13424`
1414 - Multi-line edit executes too early with await. :ghpull:`13424`
1406
1415
1407 - ``black`` is back as an optional dependency, and autoformatting disabled by
1416 - ``black`` is back as an optional dependency, and autoformatting disabled by
1408 default until some fixes are implemented (black improperly reformat magics).
1417 default until some fixes are implemented (black improperly reformat magics).
1409 :ghpull:`13471` Additionally the ability to use ``yapf`` as a code
1418 :ghpull:`13471` Additionally the ability to use ``yapf`` as a code
1410 reformatter has been added :ghpull:`13528` . You can use
1419 reformatter has been added :ghpull:`13528` . You can use
1411 ``TerminalInteractiveShell.autoformatter="black"``,
1420 ``TerminalInteractiveShell.autoformatter="black"``,
1412 ``TerminalInteractiveShell.autoformatter="yapf"`` to re-enable auto formatting
1421 ``TerminalInteractiveShell.autoformatter="yapf"`` to re-enable auto formatting
1413 with black, or switch to yapf.
1422 with black, or switch to yapf.
1414
1423
1415 - Fix and issue where ``display`` was not defined.
1424 - Fix and issue where ``display`` was not defined.
1416
1425
1417 - Auto suggestions are now configurable. Currently only
1426 - Auto suggestions are now configurable. Currently only
1418 ``AutoSuggestFromHistory`` (default) and ``None``. new provider contribution
1427 ``AutoSuggestFromHistory`` (default) and ``None``. new provider contribution
1419 welcomed. :ghpull:`13475`
1428 welcomed. :ghpull:`13475`
1420
1429
1421 - multiple packaging/testing improvement to simplify downstream packaging
1430 - multiple packaging/testing improvement to simplify downstream packaging
1422 (xfail with reasons, try to not access network...).
1431 (xfail with reasons, try to not access network...).
1423
1432
1424 - Update deprecation. ``InteractiveShell.magic`` internal method has been
1433 - Update deprecation. ``InteractiveShell.magic`` internal method has been
1425 deprecated for many years but did not emit a warning until now.
1434 deprecated for many years but did not emit a warning until now.
1426
1435
1427 - internal ``appended_to_syspath`` context manager has been deprecated.
1436 - internal ``appended_to_syspath`` context manager has been deprecated.
1428
1437
1429 - fix an issue with symlinks in virtualenv :ghpull:`13537` (Reverted in 8.1.1)
1438 - fix an issue with symlinks in virtualenv :ghpull:`13537` (Reverted in 8.1.1)
1430
1439
1431 - Fix an issue with vim mode, where cursor would not be reset on exit :ghpull:`13472`
1440 - Fix an issue with vim mode, where cursor would not be reset on exit :ghpull:`13472`
1432
1441
1433 - ipython directive now remove only known pseudo-decorators :ghpull:`13532`
1442 - ipython directive now remove only known pseudo-decorators :ghpull:`13532`
1434
1443
1435 - ``IPython/lib/security`` which used to be used for jupyter notebook has been
1444 - ``IPython/lib/security`` which used to be used for jupyter notebook has been
1436 removed.
1445 removed.
1437
1446
1438 - Fix an issue where ``async with`` would execute on new lines. :ghpull:`13436`
1447 - Fix an issue where ``async with`` would execute on new lines. :ghpull:`13436`
1439
1448
1440
1449
1441 We want to remind users that IPython is part of the Jupyter organisations, and
1450 We want to remind users that IPython is part of the Jupyter organisations, and
1442 thus governed by a Code of Conduct. Some of the behavior we have seen on GitHub is not acceptable.
1451 thus governed by a Code of Conduct. Some of the behavior we have seen on GitHub is not acceptable.
1443 Abuse and non-respectful comments on discussion will not be tolerated.
1452 Abuse and non-respectful comments on discussion will not be tolerated.
1444
1453
1445 Many thanks to all the contributors to this release, many of the above fixed issues and
1454 Many thanks to all the contributors to this release, many of the above fixed issues and
1446 new features were done by first time contributors, showing there is still
1455 new features were done by first time contributors, showing there is still
1447 plenty of easy contribution possible in IPython
1456 plenty of easy contribution possible in IPython
1448 . You can find all individual contributions
1457 . You can find all individual contributions
1449 to this milestone `on github <https://github.com/ipython/ipython/milestone/91>`__.
1458 to this milestone `on github <https://github.com/ipython/ipython/milestone/91>`__.
1450
1459
1451 Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1460 Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring
1452 work on IPython and related libraries. In particular the Lazy autoloading of
1461 work on IPython and related libraries. In particular the Lazy autoloading of
1453 magics that you will find described in the 7.32 release notes.
1462 magics that you will find described in the 7.32 release notes.
1454
1463
1455
1464
1456 .. _version 8.0.1:
1465 .. _version 8.0.1:
1457
1466
1458 IPython 8.0.1 (CVE-2022-21699)
1467 IPython 8.0.1 (CVE-2022-21699)
1459 ------------------------------
1468 ------------------------------
1460
1469
1461 IPython 8.0.1, 7.31.1 and 5.11 are security releases that change some default
1470 IPython 8.0.1, 7.31.1 and 5.11 are security releases that change some default
1462 values in order to prevent potential Execution with Unnecessary Privileges.
1471 values in order to prevent potential Execution with Unnecessary Privileges.
1463
1472
1464 Almost all version of IPython looks for configuration and profiles in current
1473 Almost all version of IPython looks for configuration and profiles in current
1465 working directory. Since IPython was developed before pip and environments
1474 working directory. Since IPython was developed before pip and environments
1466 existed it was used a convenient way to load code/packages in a project
1475 existed it was used a convenient way to load code/packages in a project
1467 dependent way.
1476 dependent way.
1468
1477
1469 In 2022, it is not necessary anymore, and can lead to confusing behavior where
1478 In 2022, it is not necessary anymore, and can lead to confusing behavior where
1470 for example cloning a repository and starting IPython or loading a notebook from
1479 for example cloning a repository and starting IPython or loading a notebook from
1471 any Jupyter-Compatible interface that has ipython set as a kernel can lead to
1480 any Jupyter-Compatible interface that has ipython set as a kernel can lead to
1472 code execution.
1481 code execution.
1473
1482
1474
1483
1475 I did not find any standard way for packaged to advertise CVEs they fix, I'm
1484 I did not find any standard way for packaged to advertise CVEs they fix, I'm
1476 thus trying to add a ``__patched_cves__`` attribute to the IPython module that
1485 thus trying to add a ``__patched_cves__`` attribute to the IPython module that
1477 list the CVEs that should have been fixed. This attribute is informational only
1486 list the CVEs that should have been fixed. This attribute is informational only
1478 as if a executable has a flaw, this value can always be changed by an attacker.
1487 as if a executable has a flaw, this value can always be changed by an attacker.
1479
1488
1480 .. code::
1489 .. code::
1481
1490
1482 In [1]: import IPython
1491 In [1]: import IPython
1483
1492
1484 In [2]: IPython.__patched_cves__
1493 In [2]: IPython.__patched_cves__
1485 Out[2]: {'CVE-2022-21699'}
1494 Out[2]: {'CVE-2022-21699'}
1486
1495
1487 In [3]: 'CVE-2022-21699' in IPython.__patched_cves__
1496 In [3]: 'CVE-2022-21699' in IPython.__patched_cves__
1488 Out[3]: True
1497 Out[3]: True
1489
1498
1490 Thus starting with this version:
1499 Thus starting with this version:
1491
1500
1492 - The current working directory is not searched anymore for profiles or
1501 - The current working directory is not searched anymore for profiles or
1493 configurations files.
1502 configurations files.
1494 - Added a ``__patched_cves__`` attribute (set of strings) to IPython module that contain
1503 - Added a ``__patched_cves__`` attribute (set of strings) to IPython module that contain
1495 the list of fixed CVE. This is informational only.
1504 the list of fixed CVE. This is informational only.
1496
1505
1497 Further details can be read on the `GitHub Advisory <https://github.com/ipython/ipython/security/advisories/GHSA-pq7m-3gw7-gq5x>`__
1506 Further details can be read on the `GitHub Advisory <https://github.com/ipython/ipython/security/advisories/GHSA-pq7m-3gw7-gq5x>`__
1498
1507
1499
1508
1500 .. _version 8.0:
1509 .. _version 8.0:
1501
1510
1502 IPython 8.0
1511 IPython 8.0
1503 -----------
1512 -----------
1504
1513
1505 IPython 8.0 is bringing a large number of new features and improvements to both the
1514 IPython 8.0 is bringing a large number of new features and improvements to both the
1506 user of the terminal and of the kernel via Jupyter. The removal of compatibility
1515 user of the terminal and of the kernel via Jupyter. The removal of compatibility
1507 with an older version of Python is also the opportunity to do a couple of
1516 with an older version of Python is also the opportunity to do a couple of
1508 performance improvements in particular with respect to startup time.
1517 performance improvements in particular with respect to startup time.
1509 The 8.x branch started diverging from its predecessor around IPython 7.12
1518 The 8.x branch started diverging from its predecessor around IPython 7.12
1510 (January 2020).
1519 (January 2020).
1511
1520
1512 This release contains 250+ pull requests, in addition to many of the features
1521 This release contains 250+ pull requests, in addition to many of the features
1513 and backports that have made it to the 7.x branch. Please see the
1522 and backports that have made it to the 7.x branch. Please see the
1514 `8.0 milestone <https://github.com/ipython/ipython/milestone/73?closed=1>`__ for the full list of pull requests.
1523 `8.0 milestone <https://github.com/ipython/ipython/milestone/73?closed=1>`__ for the full list of pull requests.
1515
1524
1516 Please feel free to send pull requests to update those notes after release,
1525 Please feel free to send pull requests to update those notes after release,
1517 I have likely forgotten a few things reviewing 250+ PRs.
1526 I have likely forgotten a few things reviewing 250+ PRs.
1518
1527
1519 Dependencies changes/downstream packaging
1528 Dependencies changes/downstream packaging
1520 -----------------------------------------
1529 -----------------------------------------
1521
1530
1522 Most of our building steps have been changed to be (mostly) declarative
1531 Most of our building steps have been changed to be (mostly) declarative
1523 and follow PEP 517. We are trying to completely remove ``setup.py`` (:ghpull:`13238`) and are
1532 and follow PEP 517. We are trying to completely remove ``setup.py`` (:ghpull:`13238`) and are
1524 looking for help to do so.
1533 looking for help to do so.
1525
1534
1526 - minimum supported ``traitlets`` version is now 5+
1535 - minimum supported ``traitlets`` version is now 5+
1527 - we now require ``stack_data``
1536 - we now require ``stack_data``
1528 - minimal Python is now 3.8
1537 - minimal Python is now 3.8
1529 - ``nose`` is not a testing requirement anymore
1538 - ``nose`` is not a testing requirement anymore
1530 - ``pytest`` replaces nose.
1539 - ``pytest`` replaces nose.
1531 - ``iptest``/``iptest3`` cli entrypoints do not exist anymore.
1540 - ``iptest``/``iptest3`` cli entrypoints do not exist anymore.
1532 - the minimum officially ​supported ``numpy`` version has been bumped, but this should
1541 - the minimum officially ​supported ``numpy`` version has been bumped, but this should
1533 not have much effect on packaging.
1542 not have much effect on packaging.
1534
1543
1535
1544
1536 Deprecation and removal
1545 Deprecation and removal
1537 -----------------------
1546 -----------------------
1538
1547
1539 We removed almost all features, arguments, functions, and modules that were
1548 We removed almost all features, arguments, functions, and modules that were
1540 marked as deprecated between IPython 1.0 and 5.0. As a reminder, 5.0 was released
1549 marked as deprecated between IPython 1.0 and 5.0. As a reminder, 5.0 was released
1541 in 2016, and 1.0 in 2013. Last release of the 5 branch was 5.10.0, in May 2020.
1550 in 2016, and 1.0 in 2013. Last release of the 5 branch was 5.10.0, in May 2020.
1542 The few remaining deprecated features we left have better deprecation warnings
1551 The few remaining deprecated features we left have better deprecation warnings
1543 or have been turned into explicit errors for better error messages.
1552 or have been turned into explicit errors for better error messages.
1544
1553
1545 I will use this occasion to add the following requests to anyone emitting a
1554 I will use this occasion to add the following requests to anyone emitting a
1546 deprecation warning:
1555 deprecation warning:
1547
1556
1548 - Please add at least ``stacklevel=2`` so that the warning is emitted into the
1557 - Please add at least ``stacklevel=2`` so that the warning is emitted into the
1549 caller context, and not the callee one.
1558 caller context, and not the callee one.
1550 - Please add **since which version** something is deprecated.
1559 - Please add **since which version** something is deprecated.
1551
1560
1552 As a side note, it is much easier to conditionally compare version
1561 As a side note, it is much easier to conditionally compare version
1553 numbers rather than using ``try/except`` when functionality changes with a version.
1562 numbers rather than using ``try/except`` when functionality changes with a version.
1554
1563
1555 I won't list all the removed features here, but modules like ``IPython.kernel``,
1564 I won't list all the removed features here, but modules like ``IPython.kernel``,
1556 which was just a shim module around ``ipykernel`` for the past 8 years, have been
1565 which was just a shim module around ``ipykernel`` for the past 8 years, have been
1557 removed, and so many other similar things that pre-date the name **Jupyter**
1566 removed, and so many other similar things that pre-date the name **Jupyter**
1558 itself.
1567 itself.
1559
1568
1560 We no longer need to add ``IPython.extensions`` to the PYTHONPATH because that is being
1569 We no longer need to add ``IPython.extensions`` to the PYTHONPATH because that is being
1561 handled by ``load_extension``.
1570 handled by ``load_extension``.
1562
1571
1563 We are also removing ``Cythonmagic``, ``sympyprinting`` and ``rmagic`` as they are now in
1572 We are also removing ``Cythonmagic``, ``sympyprinting`` and ``rmagic`` as they are now in
1564 other packages and no longer need to be inside IPython.
1573 other packages and no longer need to be inside IPython.
1565
1574
1566
1575
1567 Documentation
1576 Documentation
1568 -------------
1577 -------------
1569
1578
1570 The majority of our docstrings have now been reformatted and automatically fixed by
1579 The majority of our docstrings have now been reformatted and automatically fixed by
1571 the experimental `VΓ©lin <https://pypi.org/project/velin/>`_ project to conform
1580 the experimental `VΓ©lin <https://pypi.org/project/velin/>`_ project to conform
1572 to numpydoc.
1581 to numpydoc.
1573
1582
1574 Type annotations
1583 Type annotations
1575 ----------------
1584 ----------------
1576
1585
1577 While IPython itself is highly dynamic and can't be completely typed, many of
1586 While IPython itself is highly dynamic and can't be completely typed, many of
1578 the functions now have type annotations, and part of the codebase is now checked
1587 the functions now have type annotations, and part of the codebase is now checked
1579 by mypy.
1588 by mypy.
1580
1589
1581
1590
1582 Featured changes
1591 Featured changes
1583 ----------------
1592 ----------------
1584
1593
1585 Here is a features list of changes in IPython 8.0. This is of course non-exhaustive.
1594 Here is a features list of changes in IPython 8.0. This is of course non-exhaustive.
1586 Please note as well that many features have been added in the 7.x branch as well
1595 Please note as well that many features have been added in the 7.x branch as well
1587 (and hence why you want to read the 7.x what's new notes), in particular
1596 (and hence why you want to read the 7.x what's new notes), in particular
1588 features contributed by QuantStack (with respect to debugger protocol and Xeus
1597 features contributed by QuantStack (with respect to debugger protocol and Xeus
1589 Python), as well as many debugger features that I was pleased to implement as
1598 Python), as well as many debugger features that I was pleased to implement as
1590 part of my work at QuanSight and sponsored by DE Shaw.
1599 part of my work at QuanSight and sponsored by DE Shaw.
1591
1600
1592 Traceback improvements
1601 Traceback improvements
1593 ~~~~~~~~~~~~~~~~~~~~~~
1602 ~~~~~~~~~~~~~~~~~~~~~~
1594
1603
1595 Previously, error tracebacks for errors happening in code cells were showing a
1604 Previously, error tracebacks for errors happening in code cells were showing a
1596 hash, the one used for compiling the Python AST::
1605 hash, the one used for compiling the Python AST::
1597
1606
1598 In [1]: def foo():
1607 In [1]: def foo():
1599 ...: return 3 / 0
1608 ...: return 3 / 0
1600 ...:
1609 ...:
1601
1610
1602 In [2]: foo()
1611 In [2]: foo()
1603 ---------------------------------------------------------------------------
1612 ---------------------------------------------------------------------------
1604 ZeroDivisionError Traceback (most recent call last)
1613 ZeroDivisionError Traceback (most recent call last)
1605 <ipython-input-2-c19b6d9633cf> in <module>
1614 <ipython-input-2-c19b6d9633cf> in <module>
1606 ----> 1 foo()
1615 ----> 1 foo()
1607
1616
1608 <ipython-input-1-1595a74c32d5> in foo()
1617 <ipython-input-1-1595a74c32d5> in foo()
1609 1 def foo():
1618 1 def foo():
1610 ----> 2 return 3 / 0
1619 ----> 2 return 3 / 0
1611 3
1620 3
1612
1621
1613 ZeroDivisionError: division by zero
1622 ZeroDivisionError: division by zero
1614
1623
1615 The error traceback is now correctly formatted, showing the cell number in which the error happened::
1624 The error traceback is now correctly formatted, showing the cell number in which the error happened::
1616
1625
1617 In [1]: def foo():
1626 In [1]: def foo():
1618 ...: return 3 / 0
1627 ...: return 3 / 0
1619 ...:
1628 ...:
1620
1629
1621 Input In [2]: foo()
1630 Input In [2]: foo()
1622 ---------------------------------------------------------------------------
1631 ---------------------------------------------------------------------------
1623 ZeroDivisionError Traceback (most recent call last)
1632 ZeroDivisionError Traceback (most recent call last)
1624 input In [2], in <module>
1633 input In [2], in <module>
1625 ----> 1 foo()
1634 ----> 1 foo()
1626
1635
1627 Input In [1], in foo()
1636 Input In [1], in foo()
1628 1 def foo():
1637 1 def foo():
1629 ----> 2 return 3 / 0
1638 ----> 2 return 3 / 0
1630
1639
1631 ZeroDivisionError: division by zero
1640 ZeroDivisionError: division by zero
1632
1641
1633 The ``stack_data`` package has been integrated, which provides smarter information in the traceback;
1642 The ``stack_data`` package has been integrated, which provides smarter information in the traceback;
1634 in particular it will highlight the AST node where an error occurs which can help to quickly narrow down errors.
1643 in particular it will highlight the AST node where an error occurs which can help to quickly narrow down errors.
1635
1644
1636 For example in the following snippet::
1645 For example in the following snippet::
1637
1646
1638 def foo(i):
1647 def foo(i):
1639 x = [[[0]]]
1648 x = [[[0]]]
1640 return x[0][i][0]
1649 return x[0][i][0]
1641
1650
1642
1651
1643 def bar():
1652 def bar():
1644 return foo(0) + foo(
1653 return foo(0) + foo(
1645 1
1654 1
1646 ) + foo(2)
1655 ) + foo(2)
1647
1656
1648
1657
1649 calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``,
1658 calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``,
1650 and IPython 8.0 is capable of telling you where the index error occurs::
1659 and IPython 8.0 is capable of telling you where the index error occurs::
1651
1660
1652
1661
1653 IndexError
1662 IndexError
1654 Input In [2], in <module>
1663 Input In [2], in <module>
1655 ----> 1 bar()
1664 ----> 1 bar()
1656 ^^^^^
1665 ^^^^^
1657
1666
1658 Input In [1], in bar()
1667 Input In [1], in bar()
1659 6 def bar():
1668 6 def bar():
1660 ----> 7 return foo(0) + foo(
1669 ----> 7 return foo(0) + foo(
1661 ^^^^
1670 ^^^^
1662 8 1
1671 8 1
1663 ^^^^^^^^
1672 ^^^^^^^^
1664 9 ) + foo(2)
1673 9 ) + foo(2)
1665 ^^^^
1674 ^^^^
1666
1675
1667 Input In [1], in foo(i)
1676 Input In [1], in foo(i)
1668 1 def foo(i):
1677 1 def foo(i):
1669 2 x = [[[0]]]
1678 2 x = [[[0]]]
1670 ----> 3 return x[0][i][0]
1679 ----> 3 return x[0][i][0]
1671 ^^^^^^^
1680 ^^^^^^^
1672
1681
1673 The corresponding locations marked here with ``^`` will show up highlighted in
1682 The corresponding locations marked here with ``^`` will show up highlighted in
1674 the terminal and notebooks.
1683 the terminal and notebooks.
1675
1684
1676 Finally, a colon ``::`` and line number is appended after a filename in
1685 Finally, a colon ``::`` and line number is appended after a filename in
1677 traceback::
1686 traceback::
1678
1687
1679
1688
1680 ZeroDivisionError Traceback (most recent call last)
1689 ZeroDivisionError Traceback (most recent call last)
1681 File ~/error.py:4, in <module>
1690 File ~/error.py:4, in <module>
1682 1 def f():
1691 1 def f():
1683 2 1/0
1692 2 1/0
1684 ----> 4 f()
1693 ----> 4 f()
1685
1694
1686 File ~/error.py:2, in f()
1695 File ~/error.py:2, in f()
1687 1 def f():
1696 1 def f():
1688 ----> 2 1/0
1697 ----> 2 1/0
1689
1698
1690 Many terminals and editors have integrations enabling you to directly jump to the
1699 Many terminals and editors have integrations enabling you to directly jump to the
1691 relevant file/line when this syntax is used, so this small addition may have a high
1700 relevant file/line when this syntax is used, so this small addition may have a high
1692 impact on productivity.
1701 impact on productivity.
1693
1702
1694
1703
1695 Autosuggestions
1704 Autosuggestions
1696 ~~~~~~~~~~~~~~~
1705 ~~~~~~~~~~~~~~~
1697
1706
1698 Autosuggestion is a very useful feature available in `fish <https://fishshell.com/>`__, `zsh <https://en.wikipedia.org/wiki/Z_shell>`__, and `prompt-toolkit <https://python-prompt-toolkit.readthedocs.io/en/master/pages/asking_for_input.html#auto-suggestion>`__.
1707 Autosuggestion is a very useful feature available in `fish <https://fishshell.com/>`__, `zsh <https://en.wikipedia.org/wiki/Z_shell>`__, and `prompt-toolkit <https://python-prompt-toolkit.readthedocs.io/en/master/pages/asking_for_input.html#auto-suggestion>`__.
1699
1708
1700 `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in
1709 `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in
1701 `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__.
1710 `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__.
1702
1711
1703 This feature allows users to accept autosuggestions with ctrl e, ctrl f,
1712 This feature allows users to accept autosuggestions with ctrl e, ctrl f,
1704 or right arrow as described below.
1713 or right arrow as described below.
1705
1714
1706 1. Start ipython
1715 1. Start ipython
1707
1716
1708 .. image:: ../_images/8.0/auto_suggest_1_prompt_no_text.png
1717 .. image:: ../_images/8.0/auto_suggest_1_prompt_no_text.png
1709
1718
1710 2. Run ``print("hello")``
1719 2. Run ``print("hello")``
1711
1720
1712 .. image:: ../_images/8.0/auto_suggest_2_print_hello_suggest.png
1721 .. image:: ../_images/8.0/auto_suggest_2_print_hello_suggest.png
1713
1722
1714 3. start typing ``print`` again to see the autosuggestion
1723 3. start typing ``print`` again to see the autosuggestion
1715
1724
1716 .. image:: ../_images/8.0/auto_suggest_3_print_hello_suggest.png
1725 .. image:: ../_images/8.0/auto_suggest_3_print_hello_suggest.png
1717
1726
1718 4. Press ``ctrl-f``, or ``ctrl-e``, or ``right-arrow`` to accept the suggestion
1727 4. Press ``ctrl-f``, or ``ctrl-e``, or ``right-arrow`` to accept the suggestion
1719
1728
1720 .. image:: ../_images/8.0/auto_suggest_4_print_hello.png
1729 .. image:: ../_images/8.0/auto_suggest_4_print_hello.png
1721
1730
1722 You can also complete word by word:
1731 You can also complete word by word:
1723
1732
1724 1. Run ``def say_hello(): print("hello")``
1733 1. Run ``def say_hello(): print("hello")``
1725
1734
1726 .. image:: ../_images/8.0/auto_suggest_second_prompt.png
1735 .. image:: ../_images/8.0/auto_suggest_second_prompt.png
1727
1736
1728 2. Start typing the first letter if ``def`` to see the autosuggestion
1737 2. Start typing the first letter if ``def`` to see the autosuggestion
1729
1738
1730 .. image:: ../_images/8.0/auto_suggest_d_phantom.png
1739 .. image:: ../_images/8.0/auto_suggest_d_phantom.png
1731
1740
1732 3. Press ``alt-f`` (or ``escape`` followed by ``f``), to accept the first word of the suggestion
1741 3. Press ``alt-f`` (or ``escape`` followed by ``f``), to accept the first word of the suggestion
1733
1742
1734 .. image:: ../_images/8.0/auto_suggest_def_phantom.png
1743 .. image:: ../_images/8.0/auto_suggest_def_phantom.png
1735
1744
1736 Importantly, this feature does not interfere with tab completion:
1745 Importantly, this feature does not interfere with tab completion:
1737
1746
1738 1. After running ``def say_hello(): print("hello")``, press d
1747 1. After running ``def say_hello(): print("hello")``, press d
1739
1748
1740 .. image:: ../_images/8.0/auto_suggest_d_phantom.png
1749 .. image:: ../_images/8.0/auto_suggest_d_phantom.png
1741
1750
1742 2. Press Tab to start tab completion
1751 2. Press Tab to start tab completion
1743
1752
1744 .. image:: ../_images/8.0/auto_suggest_d_completions.png
1753 .. image:: ../_images/8.0/auto_suggest_d_completions.png
1745
1754
1746 3A. Press Tab again to select the first option
1755 3A. Press Tab again to select the first option
1747
1756
1748 .. image:: ../_images/8.0/auto_suggest_def_completions.png
1757 .. image:: ../_images/8.0/auto_suggest_def_completions.png
1749
1758
1750 3B. Press ``alt f`` (``escape``, ``f``) to accept to accept the first word of the suggestion
1759 3B. Press ``alt f`` (``escape``, ``f``) to accept to accept the first word of the suggestion
1751
1760
1752 .. image:: ../_images/8.0/auto_suggest_def_phantom.png
1761 .. image:: ../_images/8.0/auto_suggest_def_phantom.png
1753
1762
1754 3C. Press ``ctrl-f`` or ``ctrl-e`` to accept the entire suggestion
1763 3C. Press ``ctrl-f`` or ``ctrl-e`` to accept the entire suggestion
1755
1764
1756 .. image:: ../_images/8.0/auto_suggest_match_parens.png
1765 .. image:: ../_images/8.0/auto_suggest_match_parens.png
1757
1766
1758
1767
1759 Currently, autosuggestions are only shown in the emacs or vi insert editing modes:
1768 Currently, autosuggestions are only shown in the emacs or vi insert editing modes:
1760
1769
1761 - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode.
1770 - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode.
1762 - To use these shortcuts in vi insert mode, you will have to create `custom keybindings in your config.py <https://github.com/mskar/setup/commit/2892fcee46f9f80ef7788f0749edc99daccc52f4/>`__.
1771 - To use these shortcuts in vi insert mode, you will have to create `custom keybindings in your config.py <https://github.com/mskar/setup/commit/2892fcee46f9f80ef7788f0749edc99daccc52f4/>`__.
1763
1772
1764
1773
1765 Show pinfo information in ipdb using "?" and "??"
1774 Show pinfo information in ipdb using "?" and "??"
1766 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1775 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1767
1776
1768 In IPDB, it is now possible to show the information about an object using "?"
1777 In IPDB, it is now possible to show the information about an object using "?"
1769 and "??", in much the same way that it can be done when using the IPython prompt::
1778 and "??", in much the same way that it can be done when using the IPython prompt::
1770
1779
1771 ipdb> partial?
1780 ipdb> partial?
1772 Init signature: partial(self, /, *args, **kwargs)
1781 Init signature: partial(self, /, *args, **kwargs)
1773 Docstring:
1782 Docstring:
1774 partial(func, *args, **keywords) - new function with partial application
1783 partial(func, *args, **keywords) - new function with partial application
1775 of the given arguments and keywords.
1784 of the given arguments and keywords.
1776 File: ~/.pyenv/versions/3.8.6/lib/python3.8/functools.py
1785 File: ~/.pyenv/versions/3.8.6/lib/python3.8/functools.py
1777 Type: type
1786 Type: type
1778 Subclasses:
1787 Subclasses:
1779
1788
1780 Previously, ``pinfo`` or ``pinfo2`` command had to be used for this purpose.
1789 Previously, ``pinfo`` or ``pinfo2`` command had to be used for this purpose.
1781
1790
1782
1791
1783 Autoreload 3 feature
1792 Autoreload 3 feature
1784 ~~~~~~~~~~~~~~~~~~~~
1793 ~~~~~~~~~~~~~~~~~~~~
1785
1794
1786 Example: When an IPython session is run with the 'autoreload' extension loaded,
1795 Example: When an IPython session is run with the 'autoreload' extension loaded,
1787 you will now have the option '3' to select, which means the following:
1796 you will now have the option '3' to select, which means the following:
1788
1797
1789 1. replicate all functionality from option 2
1798 1. replicate all functionality from option 2
1790 2. autoload all new funcs/classes/enums/globals from the module when they are added
1799 2. autoload all new funcs/classes/enums/globals from the module when they are added
1791 3. autoload all newly imported funcs/classes/enums/globals from external modules
1800 3. autoload all newly imported funcs/classes/enums/globals from external modules
1792
1801
1793 Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload``.
1802 Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload``.
1794
1803
1795 For more information please see the following unit test : ``extensions/tests/test_autoreload.py:test_autoload_newly_added_objects``
1804 For more information please see the following unit test : ``extensions/tests/test_autoreload.py:test_autoload_newly_added_objects``
1796
1805
1797 Auto formatting with black in the CLI
1806 Auto formatting with black in the CLI
1798 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1807 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1799
1808
1800 This feature was present in 7.x, but disabled by default.
1809 This feature was present in 7.x, but disabled by default.
1801
1810
1802 In 8.0, input was automatically reformatted with Black when black was installed.
1811 In 8.0, input was automatically reformatted with Black when black was installed.
1803 This feature has been reverted for the time being.
1812 This feature has been reverted for the time being.
1804 You can re-enable it by setting ``TerminalInteractiveShell.autoformatter`` to ``"black"``
1813 You can re-enable it by setting ``TerminalInteractiveShell.autoformatter`` to ``"black"``
1805
1814
1806 History Range Glob feature
1815 History Range Glob feature
1807 ~~~~~~~~~~~~~~~~~~~~~~~~~~
1816 ~~~~~~~~~~~~~~~~~~~~~~~~~~
1808
1817
1809 Previously, when using ``%history``, users could specify either
1818 Previously, when using ``%history``, users could specify either
1810 a range of sessions and lines, for example:
1819 a range of sessions and lines, for example:
1811
1820
1812 .. code-block:: python
1821 .. code-block:: python
1813
1822
1814 ~8/1-~6/5 # see history from the first line of 8 sessions ago,
1823 ~8/1-~6/5 # see history from the first line of 8 sessions ago,
1815 # to the fifth line of 6 sessions ago.``
1824 # to the fifth line of 6 sessions ago.``
1816
1825
1817 Or users could specify a glob pattern:
1826 Or users could specify a glob pattern:
1818
1827
1819 .. code-block:: python
1828 .. code-block:: python
1820
1829
1821 -g <pattern> # glob ALL history for the specified pattern.
1830 -g <pattern> # glob ALL history for the specified pattern.
1822
1831
1823 However users could *not* specify both.
1832 However users could *not* specify both.
1824
1833
1825 If a user *did* specify both a range and a glob pattern,
1834 If a user *did* specify both a range and a glob pattern,
1826 then the glob pattern would be used (globbing *all* history) *and the range would be ignored*.
1835 then the glob pattern would be used (globbing *all* history) *and the range would be ignored*.
1827
1836
1828 With this enhancement, if a user specifies both a range and a glob pattern, then the glob pattern will be applied to the specified range of history.
1837 With this enhancement, if a user specifies both a range and a glob pattern, then the glob pattern will be applied to the specified range of history.
1829
1838
1830 Don't start a multi-line cell with sunken parenthesis
1839 Don't start a multi-line cell with sunken parenthesis
1831 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1840 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1832
1841
1833 From now on, IPython will not ask for the next line of input when given a single
1842 From now on, IPython will not ask for the next line of input when given a single
1834 line with more closing than opening brackets. For example, this means that if
1843 line with more closing than opening brackets. For example, this means that if
1835 you (mis)type ``]]`` instead of ``[]``, a ``SyntaxError`` will show up, instead of
1844 you (mis)type ``]]`` instead of ``[]``, a ``SyntaxError`` will show up, instead of
1836 the ``...:`` prompt continuation.
1845 the ``...:`` prompt continuation.
1837
1846
1838 IPython shell for ipdb interact
1847 IPython shell for ipdb interact
1839 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1848 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1840
1849
1841 The ipdb ``interact`` starts an IPython shell instead of Python's built-in ``code.interact()``.
1850 The ipdb ``interact`` starts an IPython shell instead of Python's built-in ``code.interact()``.
1842
1851
1843 Automatic Vi prompt stripping
1852 Automatic Vi prompt stripping
1844 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1853 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1845
1854
1846 When pasting code into IPython, it will strip the leading prompt characters if
1855 When pasting code into IPython, it will strip the leading prompt characters if
1847 there are any. For example, you can paste the following code into the console -
1856 there are any. For example, you can paste the following code into the console -
1848 it will still work, even though each line is prefixed with prompts (``In``,
1857 it will still work, even though each line is prefixed with prompts (``In``,
1849 ``Out``)::
1858 ``Out``)::
1850
1859
1851 In [1]: 2 * 2 == 4
1860 In [1]: 2 * 2 == 4
1852 Out[1]: True
1861 Out[1]: True
1853
1862
1854 In [2]: print("This still works as pasted")
1863 In [2]: print("This still works as pasted")
1855
1864
1856
1865
1857 Previously, this was not the case for the Vi-mode prompts::
1866 Previously, this was not the case for the Vi-mode prompts::
1858
1867
1859 In [1]: [ins] In [13]: 2 * 2 == 4
1868 In [1]: [ins] In [13]: 2 * 2 == 4
1860 ...: Out[13]: True
1869 ...: Out[13]: True
1861 ...:
1870 ...:
1862 File "<ipython-input-1-727bb88eaf33>", line 1
1871 File "<ipython-input-1-727bb88eaf33>", line 1
1863 [ins] In [13]: 2 * 2 == 4
1872 [ins] In [13]: 2 * 2 == 4
1864 ^
1873 ^
1865 SyntaxError: invalid syntax
1874 SyntaxError: invalid syntax
1866
1875
1867 This is now fixed, and Vi prompt prefixes - ``[ins]`` and ``[nav]`` - are
1876 This is now fixed, and Vi prompt prefixes - ``[ins]`` and ``[nav]`` - are
1868 skipped just as the normal ``In`` would be.
1877 skipped just as the normal ``In`` would be.
1869
1878
1870 IPython shell can be started in the Vi mode using ``ipython --TerminalInteractiveShell.editing_mode=vi``,
1879 IPython shell can be started in the Vi mode using ``ipython --TerminalInteractiveShell.editing_mode=vi``,
1871 You should be able to change mode dynamically with ``%config TerminalInteractiveShell.editing_mode='vi'``
1880 You should be able to change mode dynamically with ``%config TerminalInteractiveShell.editing_mode='vi'``
1872
1881
1873 Empty History Ranges
1882 Empty History Ranges
1874 ~~~~~~~~~~~~~~~~~~~~
1883 ~~~~~~~~~~~~~~~~~~~~
1875
1884
1876 A number of magics that take history ranges can now be used with an empty
1885 A number of magics that take history ranges can now be used with an empty
1877 range. These magics are:
1886 range. These magics are:
1878
1887
1879 * ``%save``
1888 * ``%save``
1880 * ``%load``
1889 * ``%load``
1881 * ``%pastebin``
1890 * ``%pastebin``
1882 * ``%pycat``
1891 * ``%pycat``
1883
1892
1884 Using them this way will make them take the history of the current session up
1893 Using them this way will make them take the history of the current session up
1885 to the point of the magic call (such that the magic itself will not be
1894 to the point of the magic call (such that the magic itself will not be
1886 included).
1895 included).
1887
1896
1888 Therefore it is now possible to save the whole history to a file using
1897 Therefore it is now possible to save the whole history to a file using
1889 ``%save <filename>``, load and edit it using ``%load`` (makes for a nice usage
1898 ``%save <filename>``, load and edit it using ``%load`` (makes for a nice usage
1890 when followed with :kbd:`F2`), send it to `dpaste.org <http://dpast.org>`_ using
1899 when followed with :kbd:`F2`), send it to `dpaste.org <http://dpast.org>`_ using
1891 ``%pastebin``, or view the whole thing syntax-highlighted with a single
1900 ``%pastebin``, or view the whole thing syntax-highlighted with a single
1892 ``%pycat``.
1901 ``%pycat``.
1893
1902
1894
1903
1895 Windows timing implementation: Switch to process_time
1904 Windows timing implementation: Switch to process_time
1896 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1905 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1897 Timing on Windows, for example with ``%%time``, was changed from being based on ``time.perf_counter``
1906 Timing on Windows, for example with ``%%time``, was changed from being based on ``time.perf_counter``
1898 (which counted time even when the process was sleeping) to being based on ``time.process_time`` instead
1907 (which counted time even when the process was sleeping) to being based on ``time.process_time`` instead
1899 (which only counts CPU time). This brings it closer to the behavior on Linux. See :ghpull:`12984`.
1908 (which only counts CPU time). This brings it closer to the behavior on Linux. See :ghpull:`12984`.
1900
1909
1901 Miscellaneous
1910 Miscellaneous
1902 ~~~~~~~~~~~~~
1911 ~~~~~~~~~~~~~
1903 - Non-text formatters are not disabled in the terminal, which should simplify
1912 - Non-text formatters are not disabled in the terminal, which should simplify
1904 writing extensions displaying images or other mimetypes in supporting terminals.
1913 writing extensions displaying images or other mimetypes in supporting terminals.
1905 :ghpull:`12315`
1914 :ghpull:`12315`
1906 - It is now possible to automatically insert matching brackets in Terminal IPython using the
1915 - It is now possible to automatically insert matching brackets in Terminal IPython using the
1907 ``TerminalInteractiveShell.auto_match=True`` option. :ghpull:`12586`
1916 ``TerminalInteractiveShell.auto_match=True`` option. :ghpull:`12586`
1908 - We are thinking of deprecating the current ``%%javascript`` magic in favor of a better replacement. See :ghpull:`13376`.
1917 - We are thinking of deprecating the current ``%%javascript`` magic in favor of a better replacement. See :ghpull:`13376`.
1909 - ``~`` is now expanded when part of a path in most magics :ghpull:`13385`
1918 - ``~`` is now expanded when part of a path in most magics :ghpull:`13385`
1910 - ``%/%%timeit`` magic now adds a comma every thousands to make reading a long number easier :ghpull:`13379`
1919 - ``%/%%timeit`` magic now adds a comma every thousands to make reading a long number easier :ghpull:`13379`
1911 - ``"info"`` messages can now be customised to hide some fields :ghpull:`13343`
1920 - ``"info"`` messages can now be customised to hide some fields :ghpull:`13343`
1912 - ``collections.UserList`` now pretty-prints :ghpull:`13320`
1921 - ``collections.UserList`` now pretty-prints :ghpull:`13320`
1913 - The debugger now has a persistent history, which should make it less
1922 - The debugger now has a persistent history, which should make it less
1914 annoying to retype commands :ghpull:`13246`
1923 annoying to retype commands :ghpull:`13246`
1915 - ``!pip`` ``!conda`` ``!cd`` or ``!ls`` are likely doing the wrong thing. We
1924 - ``!pip`` ``!conda`` ``!cd`` or ``!ls`` are likely doing the wrong thing. We
1916 now warn users if they use one of those commands. :ghpull:`12954`
1925 now warn users if they use one of those commands. :ghpull:`12954`
1917 - Make ``%precision`` work for ``numpy.float64`` type :ghpull:`12902`
1926 - Make ``%precision`` work for ``numpy.float64`` type :ghpull:`12902`
1918
1927
1919 Re-added support for XDG config directories
1928 Re-added support for XDG config directories
1920 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1929 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1921
1930
1922 XDG support through the years comes and goes. There is a tension between having
1931 XDG support through the years comes and goes. There is a tension between having
1923 an identical location for configuration in all platforms versus having simple instructions.
1932 an identical location for configuration in all platforms versus having simple instructions.
1924 After initial failures a couple of years ago, IPython was modified to automatically migrate XDG
1933 After initial failures a couple of years ago, IPython was modified to automatically migrate XDG
1925 config files back into ``~/.ipython``. That migration code has now been removed.
1934 config files back into ``~/.ipython``. That migration code has now been removed.
1926 IPython now checks the XDG locations, so if you _manually_ move your config
1935 IPython now checks the XDG locations, so if you _manually_ move your config
1927 files to your preferred location, IPython will not move them back.
1936 files to your preferred location, IPython will not move them back.
1928
1937
1929
1938
1930 Preparing for Python 3.10
1939 Preparing for Python 3.10
1931 -------------------------
1940 -------------------------
1932
1941
1933 To prepare for Python 3.10, we have started working on removing reliance and
1942 To prepare for Python 3.10, we have started working on removing reliance and
1934 any dependency that is not compatible with Python 3.10. This includes migrating our
1943 any dependency that is not compatible with Python 3.10. This includes migrating our
1935 test suite to pytest and starting to remove nose. This also means that the
1944 test suite to pytest and starting to remove nose. This also means that the
1936 ``iptest`` command is now gone and all testing is via pytest.
1945 ``iptest`` command is now gone and all testing is via pytest.
1937
1946
1938 This was in large part thanks to the NumFOCUS Small Developer grant, which enabled us to
1947 This was in large part thanks to the NumFOCUS Small Developer grant, which enabled us to
1939 allocate \$4000 to hire `Nikita Kniazev (@Kojoley) <https://github.com/Kojoley>`_,
1948 allocate \$4000 to hire `Nikita Kniazev (@Kojoley) <https://github.com/Kojoley>`_,
1940 who did a fantastic job at updating our code base, migrating to pytest, pushing
1949 who did a fantastic job at updating our code base, migrating to pytest, pushing
1941 our coverage, and fixing a large number of bugs. I highly recommend contacting
1950 our coverage, and fixing a large number of bugs. I highly recommend contacting
1942 them if you need help with C++ and Python projects.
1951 them if you need help with C++ and Python projects.
1943
1952
1944 You can find all relevant issues and PRs with `the SDG 2021 tag <https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+>`__
1953 You can find all relevant issues and PRs with `the SDG 2021 tag <https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+>`__
1945
1954
1946 Removing support for older Python versions
1955 Removing support for older Python versions
1947 ------------------------------------------
1956 ------------------------------------------
1948
1957
1949
1958
1950 We are removing support for Python up through 3.7, allowing internal code to use the more
1959 We are removing support for Python up through 3.7, allowing internal code to use the more
1951 efficient ``pathlib`` and to make better use of type annotations.
1960 efficient ``pathlib`` and to make better use of type annotations.
1952
1961
1953 .. image:: ../_images/8.0/pathlib_pathlib_everywhere.jpg
1962 .. image:: ../_images/8.0/pathlib_pathlib_everywhere.jpg
1954 :alt: "Meme image of Toy Story with Woody and Buzz, with the text 'pathlib, pathlib everywhere'"
1963 :alt: "Meme image of Toy Story with Woody and Buzz, with the text 'pathlib, pathlib everywhere'"
1955
1964
1956
1965
1957 We had about 34 PRs only to update some logic to update some functions from managing strings to
1966 We had about 34 PRs only to update some logic to update some functions from managing strings to
1958 using Pathlib.
1967 using Pathlib.
1959
1968
1960 The completer has also seen significant updates and now makes use of newer Jedi APIs,
1969 The completer has also seen significant updates and now makes use of newer Jedi APIs,
1961 offering faster and more reliable tab completion.
1970 offering faster and more reliable tab completion.
1962
1971
1963 Misc Statistics
1972 Misc Statistics
1964 ---------------
1973 ---------------
1965
1974
1966 Here are some numbers::
1975 Here are some numbers::
1967
1976
1968 7.x: 296 files, 12561 blank lines, 20282 comments, 35142 line of code.
1977 7.x: 296 files, 12561 blank lines, 20282 comments, 35142 line of code.
1969 8.0: 252 files, 12053 blank lines, 19232 comments, 34505 line of code.
1978 8.0: 252 files, 12053 blank lines, 19232 comments, 34505 line of code.
1970
1979
1971 $ git diff --stat 7.x...master | tail -1
1980 $ git diff --stat 7.x...master | tail -1
1972 340 files changed, 13399 insertions(+), 12421 deletions(-)
1981 340 files changed, 13399 insertions(+), 12421 deletions(-)
1973
1982
1974 We have commits from 162 authors, who contributed 1916 commits in 23 month, excluding merges (to not bias toward
1983 We have commits from 162 authors, who contributed 1916 commits in 23 month, excluding merges (to not bias toward
1975 maintainers pushing buttons).::
1984 maintainers pushing buttons).::
1976
1985
1977 $ git shortlog -s --no-merges 7.x...master | sort -nr
1986 $ git shortlog -s --no-merges 7.x...master | sort -nr
1978 535 Matthias Bussonnier
1987 535 Matthias Bussonnier
1979 86 Nikita Kniazev
1988 86 Nikita Kniazev
1980 69 Blazej Michalik
1989 69 Blazej Michalik
1981 49 Samuel Gaist
1990 49 Samuel Gaist
1982 27 Itamar Turner-Trauring
1991 27 Itamar Turner-Trauring
1983 18 Spas Kalaydzhisyki
1992 18 Spas Kalaydzhisyki
1984 17 Thomas Kluyver
1993 17 Thomas Kluyver
1985 17 Quentin Peter
1994 17 Quentin Peter
1986 17 James Morris
1995 17 James Morris
1987 17 Artur Svistunov
1996 17 Artur Svistunov
1988 15 Bart Skowron
1997 15 Bart Skowron
1989 14 Alex Hall
1998 14 Alex Hall
1990 13 rushabh-v
1999 13 rushabh-v
1991 13 Terry Davis
2000 13 Terry Davis
1992 13 Benjamin Ragan-Kelley
2001 13 Benjamin Ragan-Kelley
1993 8 martinRenou
2002 8 martinRenou
1994 8 farisachugthai
2003 8 farisachugthai
1995 7 dswij
2004 7 dswij
1996 7 Gal B
2005 7 Gal B
1997 7 Corentin Cadiou
2006 7 Corentin Cadiou
1998 6 yuji96
2007 6 yuji96
1999 6 Martin Skarzynski
2008 6 Martin Skarzynski
2000 6 Justin Palmer
2009 6 Justin Palmer
2001 6 Daniel Goldfarb
2010 6 Daniel Goldfarb
2002 6 Ben Greiner
2011 6 Ben Greiner
2003 5 Sammy Al Hashemi
2012 5 Sammy Al Hashemi
2004 5 Paul Ivanov
2013 5 Paul Ivanov
2005 5 Inception95
2014 5 Inception95
2006 5 Eyenpi
2015 5 Eyenpi
2007 5 Douglas Blank
2016 5 Douglas Blank
2008 5 Coco Mishra
2017 5 Coco Mishra
2009 5 Bibo Hao
2018 5 Bibo Hao
2010 5 AndrΓ© A. Gomes
2019 5 AndrΓ© A. Gomes
2011 5 Ahmed Fasih
2020 5 Ahmed Fasih
2012 4 takuya fujiwara
2021 4 takuya fujiwara
2013 4 palewire
2022 4 palewire
2014 4 Thomas A Caswell
2023 4 Thomas A Caswell
2015 4 Talley Lambert
2024 4 Talley Lambert
2016 4 Scott Sanderson
2025 4 Scott Sanderson
2017 4 Ram Rachum
2026 4 Ram Rachum
2018 4 Nick Muoh
2027 4 Nick Muoh
2019 4 Nathan Goldbaum
2028 4 Nathan Goldbaum
2020 4 Mithil Poojary
2029 4 Mithil Poojary
2021 4 Michael T
2030 4 Michael T
2022 4 Jakub Klus
2031 4 Jakub Klus
2023 4 Ian Castleden
2032 4 Ian Castleden
2024 4 Eli Rykoff
2033 4 Eli Rykoff
2025 4 Ashwin Vishnu
2034 4 Ashwin Vishnu
2026 3 谭九鼎
2035 3 谭九鼎
2027 3 sleeping
2036 3 sleeping
2028 3 Sylvain Corlay
2037 3 Sylvain Corlay
2029 3 Peter Corke
2038 3 Peter Corke
2030 3 Paul Bissex
2039 3 Paul Bissex
2031 3 Matthew Feickert
2040 3 Matthew Feickert
2032 3 Fernando Perez
2041 3 Fernando Perez
2033 3 Eric Wieser
2042 3 Eric Wieser
2034 3 Daniel Mietchen
2043 3 Daniel Mietchen
2035 3 Aditya Sathe
2044 3 Aditya Sathe
2036 3 007vedant
2045 3 007vedant
2037 2 rchiodo
2046 2 rchiodo
2038 2 nicolaslazo
2047 2 nicolaslazo
2039 2 luttik
2048 2 luttik
2040 2 gorogoroumaru
2049 2 gorogoroumaru
2041 2 foobarbyte
2050 2 foobarbyte
2042 2 bar-hen
2051 2 bar-hen
2043 2 Theo Ouzhinski
2052 2 Theo Ouzhinski
2044 2 Strawkage
2053 2 Strawkage
2045 2 Samreen Zarroug
2054 2 Samreen Zarroug
2046 2 Pete Blois
2055 2 Pete Blois
2047 2 Meysam Azad
2056 2 Meysam Azad
2048 2 Matthieu Ancellin
2057 2 Matthieu Ancellin
2049 2 Mark Schmitz
2058 2 Mark Schmitz
2050 2 Maor Kleinberger
2059 2 Maor Kleinberger
2051 2 MRCWirtz
2060 2 MRCWirtz
2052 2 Lumir Balhar
2061 2 Lumir Balhar
2053 2 Julien Rabinow
2062 2 Julien Rabinow
2054 2 Juan Luis Cano RodrΓ­guez
2063 2 Juan Luis Cano RodrΓ­guez
2055 2 Joyce Er
2064 2 Joyce Er
2056 2 Jakub
2065 2 Jakub
2057 2 Faris A Chugthai
2066 2 Faris A Chugthai
2058 2 Ethan Madden
2067 2 Ethan Madden
2059 2 Dimitri Papadopoulos
2068 2 Dimitri Papadopoulos
2060 2 Diego Fernandez
2069 2 Diego Fernandez
2061 2 Daniel Shimon
2070 2 Daniel Shimon
2062 2 Coco Bennett
2071 2 Coco Bennett
2063 2 Carlos Cordoba
2072 2 Carlos Cordoba
2064 2 Boyuan Liu
2073 2 Boyuan Liu
2065 2 BaoGiang HoangVu
2074 2 BaoGiang HoangVu
2066 2 Augusto
2075 2 Augusto
2067 2 Arthur Svistunov
2076 2 Arthur Svistunov
2068 2 Arthur Moreira
2077 2 Arthur Moreira
2069 2 Ali Nabipour
2078 2 Ali Nabipour
2070 2 Adam Hackbarth
2079 2 Adam Hackbarth
2071 1 richard
2080 1 richard
2072 1 linar-jether
2081 1 linar-jether
2073 1 lbennett
2082 1 lbennett
2074 1 juacrumar
2083 1 juacrumar
2075 1 gpotter2
2084 1 gpotter2
2076 1 digitalvirtuoso
2085 1 digitalvirtuoso
2077 1 dalthviz
2086 1 dalthviz
2078 1 Yonatan Goldschmidt
2087 1 Yonatan Goldschmidt
2079 1 Tomasz KΕ‚oczko
2088 1 Tomasz KΕ‚oczko
2080 1 Tobias Bengfort
2089 1 Tobias Bengfort
2081 1 Timur Kushukov
2090 1 Timur Kushukov
2082 1 Thomas
2091 1 Thomas
2083 1 Snir Broshi
2092 1 Snir Broshi
2084 1 Shao Yang Hong
2093 1 Shao Yang Hong
2085 1 Sanjana-03
2094 1 Sanjana-03
2086 1 Romulo Filho
2095 1 Romulo Filho
2087 1 Rodolfo Carvalho
2096 1 Rodolfo Carvalho
2088 1 Richard Shadrach
2097 1 Richard Shadrach
2089 1 Reilly Tucker Siemens
2098 1 Reilly Tucker Siemens
2090 1 Rakessh Roshan
2099 1 Rakessh Roshan
2091 1 Piers Titus van der Torren
2100 1 Piers Titus van der Torren
2092 1 PhanatosZou
2101 1 PhanatosZou
2093 1 Pavel Safronov
2102 1 Pavel Safronov
2094 1 Paulo S. Costa
2103 1 Paulo S. Costa
2095 1 Paul McCarthy
2104 1 Paul McCarthy
2096 1 NotWearingPants
2105 1 NotWearingPants
2097 1 Naelson Douglas
2106 1 Naelson Douglas
2098 1 Michael Tiemann
2107 1 Michael Tiemann
2099 1 Matt Wozniski
2108 1 Matt Wozniski
2100 1 Markus Wageringel
2109 1 Markus Wageringel
2101 1 Marcus Wirtz
2110 1 Marcus Wirtz
2102 1 Marcio Mazza
2111 1 Marcio Mazza
2103 1 LumΓ­r 'Frenzy' Balhar
2112 1 LumΓ­r 'Frenzy' Balhar
2104 1 Lightyagami1
2113 1 Lightyagami1
2105 1 Leon Anavi
2114 1 Leon Anavi
2106 1 LeafyLi
2115 1 LeafyLi
2107 1 L0uisJ0shua
2116 1 L0uisJ0shua
2108 1 Kyle Cutler
2117 1 Kyle Cutler
2109 1 Krzysztof Cybulski
2118 1 Krzysztof Cybulski
2110 1 Kevin Kirsche
2119 1 Kevin Kirsche
2111 1 KIU Shueng Chuan
2120 1 KIU Shueng Chuan
2112 1 Jonathan Slenders
2121 1 Jonathan Slenders
2113 1 Jay Qi
2122 1 Jay Qi
2114 1 Jake VanderPlas
2123 1 Jake VanderPlas
2115 1 Iwan Briquemont
2124 1 Iwan Briquemont
2116 1 Hussaina Begum Nandyala
2125 1 Hussaina Begum Nandyala
2117 1 Gordon Ball
2126 1 Gordon Ball
2118 1 Gabriel Simonetto
2127 1 Gabriel Simonetto
2119 1 Frank Tobia
2128 1 Frank Tobia
2120 1 Erik
2129 1 Erik
2121 1 Elliott Sales de Andrade
2130 1 Elliott Sales de Andrade
2122 1 Daniel Hahler
2131 1 Daniel Hahler
2123 1 Dan Green-Leipciger
2132 1 Dan Green-Leipciger
2124 1 Dan Green
2133 1 Dan Green
2125 1 Damian Yurzola
2134 1 Damian Yurzola
2126 1 Coon, Ethan T
2135 1 Coon, Ethan T
2127 1 Carol Willing
2136 1 Carol Willing
2128 1 Brian Lee
2137 1 Brian Lee
2129 1 Brendan Gerrity
2138 1 Brendan Gerrity
2130 1 Blake Griffin
2139 1 Blake Griffin
2131 1 Bastian Ebeling
2140 1 Bastian Ebeling
2132 1 Bartosz Telenczuk
2141 1 Bartosz Telenczuk
2133 1 Ankitsingh6299
2142 1 Ankitsingh6299
2134 1 Andrew Port
2143 1 Andrew Port
2135 1 Andrew J. Hesford
2144 1 Andrew J. Hesford
2136 1 Albert Zhang
2145 1 Albert Zhang
2137 1 Adam Johnson
2146 1 Adam Johnson
2138
2147
2139 This does not, of course, represent non-code contributions, for which we are also grateful.
2148 This does not, of course, represent non-code contributions, for which we are also grateful.
2140
2149
2141
2150
2142 API Changes using Frappuccino
2151 API Changes using Frappuccino
2143 -----------------------------
2152 -----------------------------
2144
2153
2145 This is an experimental exhaustive API difference using `Frappuccino <https://pypi.org/project/frappuccino/>`_
2154 This is an experimental exhaustive API difference using `Frappuccino <https://pypi.org/project/frappuccino/>`_
2146
2155
2147
2156
2148 The following items are new in IPython 8.0 ::
2157 The following items are new in IPython 8.0 ::
2149
2158
2150 + IPython.core.async_helpers.get_asyncio_loop()
2159 + IPython.core.async_helpers.get_asyncio_loop()
2151 + IPython.core.completer.Dict
2160 + IPython.core.completer.Dict
2152 + IPython.core.completer.Pattern
2161 + IPython.core.completer.Pattern
2153 + IPython.core.completer.Sequence
2162 + IPython.core.completer.Sequence
2154 + IPython.core.completer.__skip_doctest__
2163 + IPython.core.completer.__skip_doctest__
2155 + IPython.core.debugger.Pdb.precmd(self, line)
2164 + IPython.core.debugger.Pdb.precmd(self, line)
2156 + IPython.core.debugger.__skip_doctest__
2165 + IPython.core.debugger.__skip_doctest__
2157 + IPython.core.display.__getattr__(name)
2166 + IPython.core.display.__getattr__(name)
2158 + IPython.core.display.warn
2167 + IPython.core.display.warn
2159 + IPython.core.display_functions
2168 + IPython.core.display_functions
2160 + IPython.core.display_functions.DisplayHandle
2169 + IPython.core.display_functions.DisplayHandle
2161 + IPython.core.display_functions.DisplayHandle.display(self, obj, **kwargs)
2170 + IPython.core.display_functions.DisplayHandle.display(self, obj, **kwargs)
2162 + IPython.core.display_functions.DisplayHandle.update(self, obj, **kwargs)
2171 + IPython.core.display_functions.DisplayHandle.update(self, obj, **kwargs)
2163 + IPython.core.display_functions.__all__
2172 + IPython.core.display_functions.__all__
2164 + IPython.core.display_functions.__builtins__
2173 + IPython.core.display_functions.__builtins__
2165 + IPython.core.display_functions.__cached__
2174 + IPython.core.display_functions.__cached__
2166 + IPython.core.display_functions.__doc__
2175 + IPython.core.display_functions.__doc__
2167 + IPython.core.display_functions.__file__
2176 + IPython.core.display_functions.__file__
2168 + IPython.core.display_functions.__loader__
2177 + IPython.core.display_functions.__loader__
2169 + IPython.core.display_functions.__name__
2178 + IPython.core.display_functions.__name__
2170 + IPython.core.display_functions.__package__
2179 + IPython.core.display_functions.__package__
2171 + IPython.core.display_functions.__spec__
2180 + IPython.core.display_functions.__spec__
2172 + IPython.core.display_functions.b2a_hex
2181 + IPython.core.display_functions.b2a_hex
2173 + IPython.core.display_functions.clear_output(wait=False)
2182 + IPython.core.display_functions.clear_output(wait=False)
2174 + IPython.core.display_functions.display(*objs, include='None', exclude='None', metadata='None', transient='None', display_id='None', raw=False, clear=False, **kwargs)
2183 + IPython.core.display_functions.display(*objs, include='None', exclude='None', metadata='None', transient='None', display_id='None', raw=False, clear=False, **kwargs)
2175 + IPython.core.display_functions.publish_display_data(data, metadata='None', source='<deprecated>', *, transient='None', **kwargs)
2184 + IPython.core.display_functions.publish_display_data(data, metadata='None', source='<deprecated>', *, transient='None', **kwargs)
2176 + IPython.core.display_functions.update_display(obj, *, display_id, **kwargs)
2185 + IPython.core.display_functions.update_display(obj, *, display_id, **kwargs)
2177 + IPython.core.extensions.BUILTINS_EXTS
2186 + IPython.core.extensions.BUILTINS_EXTS
2178 + IPython.core.inputtransformer2.has_sunken_brackets(tokens)
2187 + IPython.core.inputtransformer2.has_sunken_brackets(tokens)
2179 + IPython.core.interactiveshell.Callable
2188 + IPython.core.interactiveshell.Callable
2180 + IPython.core.interactiveshell.__annotations__
2189 + IPython.core.interactiveshell.__annotations__
2181 + IPython.core.ultratb.List
2190 + IPython.core.ultratb.List
2182 + IPython.core.ultratb.Tuple
2191 + IPython.core.ultratb.Tuple
2183 + IPython.lib.pretty.CallExpression
2192 + IPython.lib.pretty.CallExpression
2184 + IPython.lib.pretty.CallExpression.factory(name)
2193 + IPython.lib.pretty.CallExpression.factory(name)
2185 + IPython.lib.pretty.RawStringLiteral
2194 + IPython.lib.pretty.RawStringLiteral
2186 + IPython.lib.pretty.RawText
2195 + IPython.lib.pretty.RawText
2187 + IPython.terminal.debugger.TerminalPdb.do_interact(self, arg)
2196 + IPython.terminal.debugger.TerminalPdb.do_interact(self, arg)
2188 + IPython.terminal.embed.Set
2197 + IPython.terminal.embed.Set
2189
2198
2190 The following items have been removed (or moved to superclass)::
2199 The following items have been removed (or moved to superclass)::
2191
2200
2192 - IPython.core.application.BaseIPythonApplication.initialize_subcommand
2201 - IPython.core.application.BaseIPythonApplication.initialize_subcommand
2193 - IPython.core.completer.Sentinel
2202 - IPython.core.completer.Sentinel
2194 - IPython.core.completer.skip_doctest
2203 - IPython.core.completer.skip_doctest
2195 - IPython.core.debugger.Tracer
2204 - IPython.core.debugger.Tracer
2196 - IPython.core.display.DisplayHandle
2205 - IPython.core.display.DisplayHandle
2197 - IPython.core.display.DisplayHandle.display
2206 - IPython.core.display.DisplayHandle.display
2198 - IPython.core.display.DisplayHandle.update
2207 - IPython.core.display.DisplayHandle.update
2199 - IPython.core.display.b2a_hex
2208 - IPython.core.display.b2a_hex
2200 - IPython.core.display.clear_output
2209 - IPython.core.display.clear_output
2201 - IPython.core.display.display
2210 - IPython.core.display.display
2202 - IPython.core.display.publish_display_data
2211 - IPython.core.display.publish_display_data
2203 - IPython.core.display.update_display
2212 - IPython.core.display.update_display
2204 - IPython.core.excolors.Deprec
2213 - IPython.core.excolors.Deprec
2205 - IPython.core.excolors.ExceptionColors
2214 - IPython.core.excolors.ExceptionColors
2206 - IPython.core.history.warn
2215 - IPython.core.history.warn
2207 - IPython.core.hooks.late_startup_hook
2216 - IPython.core.hooks.late_startup_hook
2208 - IPython.core.hooks.pre_run_code_hook
2217 - IPython.core.hooks.pre_run_code_hook
2209 - IPython.core.hooks.shutdown_hook
2218 - IPython.core.hooks.shutdown_hook
2210 - IPython.core.interactiveshell.InteractiveShell.init_deprecation_warnings
2219 - IPython.core.interactiveshell.InteractiveShell.init_deprecation_warnings
2211 - IPython.core.interactiveshell.InteractiveShell.init_readline
2220 - IPython.core.interactiveshell.InteractiveShell.init_readline
2212 - IPython.core.interactiveshell.InteractiveShell.write
2221 - IPython.core.interactiveshell.InteractiveShell.write
2213 - IPython.core.interactiveshell.InteractiveShell.write_err
2222 - IPython.core.interactiveshell.InteractiveShell.write_err
2214 - IPython.core.interactiveshell.get_default_colors
2223 - IPython.core.interactiveshell.get_default_colors
2215 - IPython.core.interactiveshell.removed_co_newlocals
2224 - IPython.core.interactiveshell.removed_co_newlocals
2216 - IPython.core.magics.execution.ExecutionMagics.profile_missing_notice
2225 - IPython.core.magics.execution.ExecutionMagics.profile_missing_notice
2217 - IPython.core.magics.script.PIPE
2226 - IPython.core.magics.script.PIPE
2218 - IPython.core.prefilter.PrefilterManager.init_transformers
2227 - IPython.core.prefilter.PrefilterManager.init_transformers
2219 - IPython.core.release.classifiers
2228 - IPython.core.release.classifiers
2220 - IPython.core.release.description
2229 - IPython.core.release.description
2221 - IPython.core.release.keywords
2230 - IPython.core.release.keywords
2222 - IPython.core.release.long_description
2231 - IPython.core.release.long_description
2223 - IPython.core.release.name
2232 - IPython.core.release.name
2224 - IPython.core.release.platforms
2233 - IPython.core.release.platforms
2225 - IPython.core.release.url
2234 - IPython.core.release.url
2226 - IPython.core.ultratb.VerboseTB.format_records
2235 - IPython.core.ultratb.VerboseTB.format_records
2227 - IPython.core.ultratb.find_recursion
2236 - IPython.core.ultratb.find_recursion
2228 - IPython.core.ultratb.findsource
2237 - IPython.core.ultratb.findsource
2229 - IPython.core.ultratb.fix_frame_records_filenames
2238 - IPython.core.ultratb.fix_frame_records_filenames
2230 - IPython.core.ultratb.inspect_error
2239 - IPython.core.ultratb.inspect_error
2231 - IPython.core.ultratb.is_recursion_error
2240 - IPython.core.ultratb.is_recursion_error
2232 - IPython.core.ultratb.with_patch_inspect
2241 - IPython.core.ultratb.with_patch_inspect
2233 - IPython.external.__all__
2242 - IPython.external.__all__
2234 - IPython.external.__builtins__
2243 - IPython.external.__builtins__
2235 - IPython.external.__cached__
2244 - IPython.external.__cached__
2236 - IPython.external.__doc__
2245 - IPython.external.__doc__
2237 - IPython.external.__file__
2246 - IPython.external.__file__
2238 - IPython.external.__loader__
2247 - IPython.external.__loader__
2239 - IPython.external.__name__
2248 - IPython.external.__name__
2240 - IPython.external.__package__
2249 - IPython.external.__package__
2241 - IPython.external.__path__
2250 - IPython.external.__path__
2242 - IPython.external.__spec__
2251 - IPython.external.__spec__
2243 - IPython.kernel.KernelConnectionInfo
2252 - IPython.kernel.KernelConnectionInfo
2244 - IPython.kernel.__builtins__
2253 - IPython.kernel.__builtins__
2245 - IPython.kernel.__cached__
2254 - IPython.kernel.__cached__
2246 - IPython.kernel.__warningregistry__
2255 - IPython.kernel.__warningregistry__
2247 - IPython.kernel.pkg
2256 - IPython.kernel.pkg
2248 - IPython.kernel.protocol_version
2257 - IPython.kernel.protocol_version
2249 - IPython.kernel.protocol_version_info
2258 - IPython.kernel.protocol_version_info
2250 - IPython.kernel.src
2259 - IPython.kernel.src
2251 - IPython.kernel.version_info
2260 - IPython.kernel.version_info
2252 - IPython.kernel.warn
2261 - IPython.kernel.warn
2253 - IPython.lib.backgroundjobs
2262 - IPython.lib.backgroundjobs
2254 - IPython.lib.backgroundjobs.BackgroundJobBase
2263 - IPython.lib.backgroundjobs.BackgroundJobBase
2255 - IPython.lib.backgroundjobs.BackgroundJobBase.run
2264 - IPython.lib.backgroundjobs.BackgroundJobBase.run
2256 - IPython.lib.backgroundjobs.BackgroundJobBase.traceback
2265 - IPython.lib.backgroundjobs.BackgroundJobBase.traceback
2257 - IPython.lib.backgroundjobs.BackgroundJobExpr
2266 - IPython.lib.backgroundjobs.BackgroundJobExpr
2258 - IPython.lib.backgroundjobs.BackgroundJobExpr.call
2267 - IPython.lib.backgroundjobs.BackgroundJobExpr.call
2259 - IPython.lib.backgroundjobs.BackgroundJobFunc
2268 - IPython.lib.backgroundjobs.BackgroundJobFunc
2260 - IPython.lib.backgroundjobs.BackgroundJobFunc.call
2269 - IPython.lib.backgroundjobs.BackgroundJobFunc.call
2261 - IPython.lib.backgroundjobs.BackgroundJobManager
2270 - IPython.lib.backgroundjobs.BackgroundJobManager
2262 - IPython.lib.backgroundjobs.BackgroundJobManager.flush
2271 - IPython.lib.backgroundjobs.BackgroundJobManager.flush
2263 - IPython.lib.backgroundjobs.BackgroundJobManager.new
2272 - IPython.lib.backgroundjobs.BackgroundJobManager.new
2264 - IPython.lib.backgroundjobs.BackgroundJobManager.remove
2273 - IPython.lib.backgroundjobs.BackgroundJobManager.remove
2265 - IPython.lib.backgroundjobs.BackgroundJobManager.result
2274 - IPython.lib.backgroundjobs.BackgroundJobManager.result
2266 - IPython.lib.backgroundjobs.BackgroundJobManager.status
2275 - IPython.lib.backgroundjobs.BackgroundJobManager.status
2267 - IPython.lib.backgroundjobs.BackgroundJobManager.traceback
2276 - IPython.lib.backgroundjobs.BackgroundJobManager.traceback
2268 - IPython.lib.backgroundjobs.__builtins__
2277 - IPython.lib.backgroundjobs.__builtins__
2269 - IPython.lib.backgroundjobs.__cached__
2278 - IPython.lib.backgroundjobs.__cached__
2270 - IPython.lib.backgroundjobs.__doc__
2279 - IPython.lib.backgroundjobs.__doc__
2271 - IPython.lib.backgroundjobs.__file__
2280 - IPython.lib.backgroundjobs.__file__
2272 - IPython.lib.backgroundjobs.__loader__
2281 - IPython.lib.backgroundjobs.__loader__
2273 - IPython.lib.backgroundjobs.__name__
2282 - IPython.lib.backgroundjobs.__name__
2274 - IPython.lib.backgroundjobs.__package__
2283 - IPython.lib.backgroundjobs.__package__
2275 - IPython.lib.backgroundjobs.__spec__
2284 - IPython.lib.backgroundjobs.__spec__
2276 - IPython.lib.kernel.__builtins__
2285 - IPython.lib.kernel.__builtins__
2277 - IPython.lib.kernel.__cached__
2286 - IPython.lib.kernel.__cached__
2278 - IPython.lib.kernel.__doc__
2287 - IPython.lib.kernel.__doc__
2279 - IPython.lib.kernel.__file__
2288 - IPython.lib.kernel.__file__
2280 - IPython.lib.kernel.__loader__
2289 - IPython.lib.kernel.__loader__
2281 - IPython.lib.kernel.__name__
2290 - IPython.lib.kernel.__name__
2282 - IPython.lib.kernel.__package__
2291 - IPython.lib.kernel.__package__
2283 - IPython.lib.kernel.__spec__
2292 - IPython.lib.kernel.__spec__
2284 - IPython.lib.kernel.__warningregistry__
2293 - IPython.lib.kernel.__warningregistry__
2285 - IPython.paths.fs_encoding
2294 - IPython.paths.fs_encoding
2286 - IPython.terminal.debugger.DEFAULT_BUFFER
2295 - IPython.terminal.debugger.DEFAULT_BUFFER
2287 - IPython.terminal.debugger.cursor_in_leading_ws
2296 - IPython.terminal.debugger.cursor_in_leading_ws
2288 - IPython.terminal.debugger.emacs_insert_mode
2297 - IPython.terminal.debugger.emacs_insert_mode
2289 - IPython.terminal.debugger.has_selection
2298 - IPython.terminal.debugger.has_selection
2290 - IPython.terminal.debugger.vi_insert_mode
2299 - IPython.terminal.debugger.vi_insert_mode
2291 - IPython.terminal.interactiveshell.DISPLAY_BANNER_DEPRECATED
2300 - IPython.terminal.interactiveshell.DISPLAY_BANNER_DEPRECATED
2292 - IPython.terminal.ipapp.TerminalIPythonApp.parse_command_line
2301 - IPython.terminal.ipapp.TerminalIPythonApp.parse_command_line
2293 - IPython.testing.test
2302 - IPython.testing.test
2294 - IPython.utils.contexts.NoOpContext
2303 - IPython.utils.contexts.NoOpContext
2295 - IPython.utils.io.IOStream
2304 - IPython.utils.io.IOStream
2296 - IPython.utils.io.IOStream.close
2305 - IPython.utils.io.IOStream.close
2297 - IPython.utils.io.IOStream.write
2306 - IPython.utils.io.IOStream.write
2298 - IPython.utils.io.IOStream.writelines
2307 - IPython.utils.io.IOStream.writelines
2299 - IPython.utils.io.__warningregistry__
2308 - IPython.utils.io.__warningregistry__
2300 - IPython.utils.io.atomic_writing
2309 - IPython.utils.io.atomic_writing
2301 - IPython.utils.io.stderr
2310 - IPython.utils.io.stderr
2302 - IPython.utils.io.stdin
2311 - IPython.utils.io.stdin
2303 - IPython.utils.io.stdout
2312 - IPython.utils.io.stdout
2304 - IPython.utils.io.unicode_std_stream
2313 - IPython.utils.io.unicode_std_stream
2305 - IPython.utils.path.get_ipython_cache_dir
2314 - IPython.utils.path.get_ipython_cache_dir
2306 - IPython.utils.path.get_ipython_dir
2315 - IPython.utils.path.get_ipython_dir
2307 - IPython.utils.path.get_ipython_module_path
2316 - IPython.utils.path.get_ipython_module_path
2308 - IPython.utils.path.get_ipython_package_dir
2317 - IPython.utils.path.get_ipython_package_dir
2309 - IPython.utils.path.locate_profile
2318 - IPython.utils.path.locate_profile
2310 - IPython.utils.path.unquote_filename
2319 - IPython.utils.path.unquote_filename
2311 - IPython.utils.py3compat.PY2
2320 - IPython.utils.py3compat.PY2
2312 - IPython.utils.py3compat.PY3
2321 - IPython.utils.py3compat.PY3
2313 - IPython.utils.py3compat.buffer_to_bytes
2322 - IPython.utils.py3compat.buffer_to_bytes
2314 - IPython.utils.py3compat.builtin_mod_name
2323 - IPython.utils.py3compat.builtin_mod_name
2315 - IPython.utils.py3compat.cast_bytes
2324 - IPython.utils.py3compat.cast_bytes
2316 - IPython.utils.py3compat.getcwd
2325 - IPython.utils.py3compat.getcwd
2317 - IPython.utils.py3compat.isidentifier
2326 - IPython.utils.py3compat.isidentifier
2318 - IPython.utils.py3compat.u_format
2327 - IPython.utils.py3compat.u_format
2319
2328
2320 The following signatures differ between 7.x and 8.0::
2329 The following signatures differ between 7.x and 8.0::
2321
2330
2322 - IPython.core.completer.IPCompleter.unicode_name_matches(self, text)
2331 - IPython.core.completer.IPCompleter.unicode_name_matches(self, text)
2323 + IPython.core.completer.IPCompleter.unicode_name_matches(text)
2332 + IPython.core.completer.IPCompleter.unicode_name_matches(text)
2324
2333
2325 - IPython.core.completer.match_dict_keys(keys, prefix, delims)
2334 - IPython.core.completer.match_dict_keys(keys, prefix, delims)
2326 + IPython.core.completer.match_dict_keys(keys, prefix, delims, extra_prefix='None')
2335 + IPython.core.completer.match_dict_keys(keys, prefix, delims, extra_prefix='None')
2327
2336
2328 - IPython.core.interactiveshell.InteractiveShell.object_inspect_mime(self, oname, detail_level=0)
2337 - IPython.core.interactiveshell.InteractiveShell.object_inspect_mime(self, oname, detail_level=0)
2329 + IPython.core.interactiveshell.InteractiveShell.object_inspect_mime(self, oname, detail_level=0, omit_sections='()')
2338 + IPython.core.interactiveshell.InteractiveShell.object_inspect_mime(self, oname, detail_level=0, omit_sections='()')
2330
2339
2331 - IPython.core.interactiveshell.InteractiveShell.set_hook(self, name, hook, priority=50, str_key='None', re_key='None', _warn_deprecated=True)
2340 - IPython.core.interactiveshell.InteractiveShell.set_hook(self, name, hook, priority=50, str_key='None', re_key='None', _warn_deprecated=True)
2332 + IPython.core.interactiveshell.InteractiveShell.set_hook(self, name, hook, priority=50, str_key='None', re_key='None')
2341 + IPython.core.interactiveshell.InteractiveShell.set_hook(self, name, hook, priority=50, str_key='None', re_key='None')
2333
2342
2334 - IPython.core.oinspect.Inspector.info(self, obj, oname='', formatter='None', info='None', detail_level=0)
2343 - IPython.core.oinspect.Inspector.info(self, obj, oname='', formatter='None', info='None', detail_level=0)
2335 + IPython.core.oinspect.Inspector.info(self, obj, oname='', info='None', detail_level=0)
2344 + IPython.core.oinspect.Inspector.info(self, obj, oname='', info='None', detail_level=0)
2336
2345
2337 - IPython.core.oinspect.Inspector.pinfo(self, obj, oname='', formatter='None', info='None', detail_level=0, enable_html_pager=True)
2346 - IPython.core.oinspect.Inspector.pinfo(self, obj, oname='', formatter='None', info='None', detail_level=0, enable_html_pager=True)
2338 + IPython.core.oinspect.Inspector.pinfo(self, obj, oname='', formatter='None', info='None', detail_level=0, enable_html_pager=True, omit_sections='()')
2347 + IPython.core.oinspect.Inspector.pinfo(self, obj, oname='', formatter='None', info='None', detail_level=0, enable_html_pager=True, omit_sections='()')
2339
2348
2340 - IPython.core.profiledir.ProfileDir.copy_config_file(self, config_file, path='None', overwrite=False)
2349 - IPython.core.profiledir.ProfileDir.copy_config_file(self, config_file, path='None', overwrite=False)
2341 + IPython.core.profiledir.ProfileDir.copy_config_file(self, config_file, path, overwrite=False)
2350 + IPython.core.profiledir.ProfileDir.copy_config_file(self, config_file, path, overwrite=False)
2342
2351
2343 - IPython.core.ultratb.VerboseTB.format_record(self, frame, file, lnum, func, lines, index)
2352 - IPython.core.ultratb.VerboseTB.format_record(self, frame, file, lnum, func, lines, index)
2344 + IPython.core.ultratb.VerboseTB.format_record(self, frame_info)
2353 + IPython.core.ultratb.VerboseTB.format_record(self, frame_info)
2345
2354
2346 - IPython.terminal.embed.InteractiveShellEmbed.mainloop(self, local_ns='None', module='None', stack_depth=0, display_banner='None', global_ns='None', compile_flags='None')
2355 - IPython.terminal.embed.InteractiveShellEmbed.mainloop(self, local_ns='None', module='None', stack_depth=0, display_banner='None', global_ns='None', compile_flags='None')
2347 + IPython.terminal.embed.InteractiveShellEmbed.mainloop(self, local_ns='None', module='None', stack_depth=0, compile_flags='None')
2356 + IPython.terminal.embed.InteractiveShellEmbed.mainloop(self, local_ns='None', module='None', stack_depth=0, compile_flags='None')
2348
2357
2349 - IPython.terminal.embed.embed(**kwargs)
2358 - IPython.terminal.embed.embed(**kwargs)
2350 + IPython.terminal.embed.embed(*, header='', compile_flags='None', **kwargs)
2359 + IPython.terminal.embed.embed(*, header='', compile_flags='None', **kwargs)
2351
2360
2352 - IPython.terminal.interactiveshell.TerminalInteractiveShell.interact(self, display_banner='<object object at 0xffffff>')
2361 - IPython.terminal.interactiveshell.TerminalInteractiveShell.interact(self, display_banner='<object object at 0xffffff>')
2353 + IPython.terminal.interactiveshell.TerminalInteractiveShell.interact(self)
2362 + IPython.terminal.interactiveshell.TerminalInteractiveShell.interact(self)
2354
2363
2355 - IPython.terminal.interactiveshell.TerminalInteractiveShell.mainloop(self, display_banner='<object object at 0xffffff>')
2364 - IPython.terminal.interactiveshell.TerminalInteractiveShell.mainloop(self, display_banner='<object object at 0xffffff>')
2356 + IPython.terminal.interactiveshell.TerminalInteractiveShell.mainloop(self)
2365 + IPython.terminal.interactiveshell.TerminalInteractiveShell.mainloop(self)
2357
2366
2358 - IPython.utils.path.get_py_filename(name, force_win32='None')
2367 - IPython.utils.path.get_py_filename(name, force_win32='None')
2359 + IPython.utils.path.get_py_filename(name)
2368 + IPython.utils.path.get_py_filename(name)
2360
2369
2361 The following are new attributes (that might be inherited)::
2370 The following are new attributes (that might be inherited)::
2362
2371
2363 + IPython.core.completer.IPCompleter.unicode_names
2372 + IPython.core.completer.IPCompleter.unicode_names
2364 + IPython.core.debugger.InterruptiblePdb.precmd
2373 + IPython.core.debugger.InterruptiblePdb.precmd
2365 + IPython.core.debugger.Pdb.precmd
2374 + IPython.core.debugger.Pdb.precmd
2366 + IPython.core.ultratb.AutoFormattedTB.has_colors
2375 + IPython.core.ultratb.AutoFormattedTB.has_colors
2367 + IPython.core.ultratb.ColorTB.has_colors
2376 + IPython.core.ultratb.ColorTB.has_colors
2368 + IPython.core.ultratb.FormattedTB.has_colors
2377 + IPython.core.ultratb.FormattedTB.has_colors
2369 + IPython.core.ultratb.ListTB.has_colors
2378 + IPython.core.ultratb.ListTB.has_colors
2370 + IPython.core.ultratb.SyntaxTB.has_colors
2379 + IPython.core.ultratb.SyntaxTB.has_colors
2371 + IPython.core.ultratb.TBTools.has_colors
2380 + IPython.core.ultratb.TBTools.has_colors
2372 + IPython.core.ultratb.VerboseTB.has_colors
2381 + IPython.core.ultratb.VerboseTB.has_colors
2373 + IPython.terminal.debugger.TerminalPdb.do_interact
2382 + IPython.terminal.debugger.TerminalPdb.do_interact
2374 + IPython.terminal.debugger.TerminalPdb.precmd
2383 + IPython.terminal.debugger.TerminalPdb.precmd
2375
2384
2376 The following attribute/methods have been removed::
2385 The following attribute/methods have been removed::
2377
2386
2378 - IPython.core.application.BaseIPythonApplication.deprecated_subcommands
2387 - IPython.core.application.BaseIPythonApplication.deprecated_subcommands
2379 - IPython.core.ultratb.AutoFormattedTB.format_records
2388 - IPython.core.ultratb.AutoFormattedTB.format_records
2380 - IPython.core.ultratb.ColorTB.format_records
2389 - IPython.core.ultratb.ColorTB.format_records
2381 - IPython.core.ultratb.FormattedTB.format_records
2390 - IPython.core.ultratb.FormattedTB.format_records
2382 - IPython.terminal.embed.InteractiveShellEmbed.init_deprecation_warnings
2391 - IPython.terminal.embed.InteractiveShellEmbed.init_deprecation_warnings
2383 - IPython.terminal.embed.InteractiveShellEmbed.init_readline
2392 - IPython.terminal.embed.InteractiveShellEmbed.init_readline
2384 - IPython.terminal.embed.InteractiveShellEmbed.write
2393 - IPython.terminal.embed.InteractiveShellEmbed.write
2385 - IPython.terminal.embed.InteractiveShellEmbed.write_err
2394 - IPython.terminal.embed.InteractiveShellEmbed.write_err
2386 - IPython.terminal.interactiveshell.TerminalInteractiveShell.init_deprecation_warnings
2395 - IPython.terminal.interactiveshell.TerminalInteractiveShell.init_deprecation_warnings
2387 - IPython.terminal.interactiveshell.TerminalInteractiveShell.init_readline
2396 - IPython.terminal.interactiveshell.TerminalInteractiveShell.init_readline
2388 - IPython.terminal.interactiveshell.TerminalInteractiveShell.write
2397 - IPython.terminal.interactiveshell.TerminalInteractiveShell.write
2389 - IPython.terminal.interactiveshell.TerminalInteractiveShell.write_err
2398 - IPython.terminal.interactiveshell.TerminalInteractiveShell.write_err
2390 - IPython.terminal.ipapp.LocateIPythonApp.deprecated_subcommands
2399 - IPython.terminal.ipapp.LocateIPythonApp.deprecated_subcommands
2391 - IPython.terminal.ipapp.LocateIPythonApp.initialize_subcommand
2400 - IPython.terminal.ipapp.LocateIPythonApp.initialize_subcommand
2392 - IPython.terminal.ipapp.TerminalIPythonApp.deprecated_subcommands
2401 - IPython.terminal.ipapp.TerminalIPythonApp.deprecated_subcommands
2393 - IPython.terminal.ipapp.TerminalIPythonApp.initialize_subcommand
2402 - IPython.terminal.ipapp.TerminalIPythonApp.initialize_subcommand
2394
2403
2395 ------
2404 ------
2396
2405
2397 .. [1] If this make you uncomfortable feel free to not use IPython 8.23.
2406 .. [1] If this make you uncomfortable feel free to not use IPython 8.23.
General Comments 0
You need to be logged in to leave comments. Login now