|
@@
-26,21
+26,95
b' IPython 8.0 is bringing a large number of new features and improvements to both '
|
|
26
|
26
|
user of the terminal and of the kernel via Jupyter. The removal of compatibility
|
|
27
|
27
|
with older version of Python is also the opportunity to do a couple of
|
|
28
|
28
|
performance improvement in particular with respect to startup time.
|
|
|
29
|
The 8.x branch started diverging from its predecessor around IPython 7.12
|
|
|
30
|
(January 2020).
|
|
29
|
31
|
|
|
30
|
|
This release contains 250+ Pull requests, in addition to many of the features
|
|
31
|
|
and backports that have made it to the 7.x branch.
|
|
|
32
|
This release contains 250+ Pull Requests, in addition to many of the features
|
|
|
33
|
and backports that have made it to the 7.x branch. All PRs that went into this
|
|
|
34
|
released are properly tagged with the 8.0 milestone if you wish to have a more
|
|
|
35
|
in depth look at the changes.
|
|
|
36
|
|
|
|
37
|
Please fell free to send pull-requests to updates those notes after release,
|
|
|
38
|
I have likely forgotten a few things reviewing 250+ PRs.
|
|
|
39
|
|
|
|
40
|
Dependencies changes/downstream packaging
|
|
|
41
|
-----------------------------------------
|
|
|
42
|
|
|
|
43
|
Note that most of our building step have been changes to be (mostly) declarative
|
|
|
44
|
and follow PEP 517, we are trying to completely remove ``setup.py`` (:ghpull:`13238`) and are
|
|
|
45
|
looking for help to do so.
|
|
|
46
|
|
|
|
47
|
- Minimum supported ``traitlets`` version if now 5+
|
|
|
48
|
- we now require ``stack_data``
|
|
|
49
|
- Minimal Python is now 3.8
|
|
|
50
|
- ``nose`` is not a testing requirement anymore
|
|
|
51
|
- ``pytest`` replaces nose.
|
|
|
52
|
- ``iptest``/``iptest3`` cli entrypoints do not exists anymore.
|
|
|
53
|
- minimum officially support ``numpy`` version has been bumped, but this should
|
|
|
54
|
not have much effect on packaging.
|
|
|
55
|
|
|
|
56
|
|
|
|
57
|
Deprecation and removal
|
|
|
58
|
-----------------------
|
|
32
|
59
|
|
|
33
|
60
|
We removed almost all features, arguments, functions, and modules that were
|
|
34
|
|
marked as deprecated between IPython 1.0 and 5.0 and before. As reminder 5.0 was
|
|
35
|
|
released in 2016, and 1.0 in 2013. Last release of the 5 branch was 5.10.0, in
|
|
36
|
|
may 2020. The few remaining deprecated features have better deprecation warnings
|
|
37
|
|
or errors.
|
|
|
61
|
marked as deprecated between IPython 1.0 and 5.0. As reminder 5.0 was released
|
|
|
62
|
in 2016, and 1.0 in 2013. Last release of the 5 branch was 5.10.0, in may 2020.
|
|
|
63
|
The few remaining deprecated features we left have better deprecation warnings
|
|
|
64
|
or have been turned into explicit errors for better error messages.
|
|
38
|
65
|
|
|
39
|
|
There are many change in IPython 8.0 will will try to describe subsequently,
|
|
|
66
|
I will use this occasion to add the following requests to anyone emitting a
|
|
|
67
|
deprecation warning:
|
|
|
68
|
|
|
|
69
|
- Please at at least ``stacklevel=2`` so that the warning is emitted into the
|
|
|
70
|
caller context, and not the callee one.
|
|
|
71
|
- Please add **since which version** something is deprecated.
|
|
|
72
|
|
|
|
73
|
As a side note it is much easier to deal with conditional comparing to versions
|
|
|
74
|
numbers than ``try/except`` when a functionality change with version.
|
|
|
75
|
|
|
|
76
|
I won't list all the removed features here, but modules like ``IPython.kernel``,
|
|
|
77
|
which was just a shim module around ``ipykernel`` for the past 8 years have been
|
|
|
78
|
remove, and so many other similar things that pre-date the name **Jupyter**
|
|
|
79
|
itself.
|
|
|
80
|
|
|
|
81
|
We no longer need to add ``IPyhton.extensions`` to the PYTHONPATH because that is being
|
|
|
82
|
handled by ``load_extension``.
|
|
|
83
|
|
|
|
84
|
We are also removing ``Cythonmagic``, ``sympyprinting`` and ``rmagic`` as they are now in
|
|
|
85
|
other packages and no longer need to be inside IPython.
|
|
40
|
86
|
|
|
41
|
87
|
|
|
|
88
|
Documentation
|
|
|
89
|
-------------
|
|
|
90
|
|
|
|
91
|
Majority of our docstrings have now been reformatted and automatically fixed by
|
|
|
92
|
the experimental `VΓ©lin <https://pypi.org/project/velin/>`_ project, to conform
|
|
|
93
|
to numpydoc.
|
|
|
94
|
|
|
|
95
|
Type annotations
|
|
|
96
|
----------------
|
|
|
97
|
|
|
|
98
|
While IPython itself is highly dynamic and can't be completely typed, many of
|
|
|
99
|
the function now have type annotation, and part of the codebase and now checked
|
|
|
100
|
by mypy.
|
|
|
101
|
|
|
|
102
|
|
|
|
103
|
Featured changes
|
|
|
104
|
----------------
|
|
|
105
|
|
|
|
106
|
Here is a features list of changes in IPython 8.0. This is of course non-exhaustive.
|
|
|
107
|
Please note as well that many features have been added in the 7.x branch as well
|
|
|
108
|
(and hence why you want to read the 7.x what's new notes), in particular
|
|
|
109
|
features contributed by QuantStack (with respect to debugger protocol, and Xeus
|
|
|
110
|
Python), as well as many debugger features that I was please to implement as
|
|
|
111
|
part of my work at QuanSight and Sponsored by DE Shaw.
|
|
|
112
|
|
|
|
113
|
Better Tracebacks
|
|
|
114
|
~~~~~~~~~~~~~~~~~
|
|
|
115
|
|
|
42
|
116
|
The first on is the integration of the ``stack_data`` package;
|
|
43
|
|
which provide smarter information in traceback; in particular it will highlight
|
|
|
117
|
which provide smarter informations in traceback; in particular it will highlight
|
|
44
|
118
|
the AST node where an error occurs which can help to quickly narrow down errors.
|
|
45
|
119
|
|
|
46
|
120
|
For example in the following snippet::
|
|
@@
-59,44
+133,33
b' For example in the following snippet::'
|
|
59
|
133
|
Calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``,
|
|
60
|
134
|
IPython 8.0 is capable of telling you, where the index error occurs::
|
|
61
|
135
|
|
|
62
|
|
return x[0][i][0]
|
|
63
|
|
^
|
|
64
|
|
|
|
65
|
|
|
|
66
|
|
Numfocus Small Developer Grant
|
|
67
|
|
------------------------------
|
|
68
|
|
|
|
69
|
|
To prepare for Python 3.10 we have also started working on removing reliance and
|
|
70
|
|
any dependency that is not Python 3.10 compatible; that include migrating our
|
|
71
|
|
test suite to pytest, and starting to remove nose. This also mean that the
|
|
72
|
|
``iptest`` command is now gone, and all testing is via pytest.
|
|
73
|
136
|
|
|
74
|
|
This was in bog part thanks the NumFOCUS Small Developer grant, we were able to
|
|
75
|
|
allocate 4000 to hire `Nikita Kniazev @Kojoley <https://github.com/Kojoley>`__
|
|
76
|
|
who did a fantastic job at updating our code base, migrating to pytest, pushing
|
|
77
|
|
our coverage, and fixing a large number of bugs. I highly recommend contacting
|
|
78
|
|
them if you need help with C++ and Python projects
|
|
|
137
|
IndexError
|
|
|
138
|
Input In [2], in <module>
|
|
|
139
|
----> 1 bar()
|
|
|
140
|
^^^^^
|
|
79
|
141
|
|
|
80
|
|
You can find all relevant issues and PRs with the SDG 2021 tag:
|
|
81
|
|
|
|
82
|
|
https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+
|
|
83
|
|
|
|
84
|
|
Removing support for Older Python
|
|
85
|
|
---------------------------------
|
|
|
142
|
Input In [1], in bar()
|
|
|
143
|
6 def bar():
|
|
|
144
|
----> 7 return foo(0) + foo(
|
|
|
145
|
^^^^
|
|
|
146
|
8 1
|
|
|
147
|
^^^^^^^^
|
|
|
148
|
9 ) + foo(2)
|
|
|
149
|
^^^^
|
|
86
|
150
|
|
|
|
151
|
Input In [1], in foo(i)
|
|
|
152
|
1 def foo(i):
|
|
|
153
|
2 x = [[[0]]]
|
|
|
154
|
----> 3 return x[0][i][0]
|
|
|
155
|
^^^^^^^
|
|
87
|
156
|
|
|
88
|
|
We are also removing support for Python up to 3.7 allowing internal code to use more
|
|
89
|
|
efficient ``pathlib``, and make better use of type annotations.
|
|
90
|
|
|
|
91
|
|
IMAGE : Pathlib, pathlib everywhere.
|
|
92
|
|
|
|
93
|
|
The completer has also seen significant updates and make use of newer Jedi API
|
|
94
|
|
offering faster and more reliable tab completion.
|
|
|
157
|
Corresponding location marked here with ``^`` will show up highlighted in
|
|
|
158
|
terminal and notebooks.
|
|
95
|
159
|
|
|
96
|
|
For the terminal users this also enable the auto-suggestion feature, described
|
|
97
|
|
below, which show "ghost text" ahead of your cursor you can accept without
|
|
98
|
|
having to press the tab key or ask the completer to suggest completions.
|
|
99
|
160
|
|
|
|
161
|
Autosuggestons
|
|
|
162
|
~~~~~~~~~~~~~~
|
|
100
|
163
|
|
|
101
|
164
|
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>`__.
|
|
102
|
165
|
|
|
@@
-108,55
+171,55
b' or right arrow as described below.'
|
|
108
|
171
|
|
|
109
|
172
|
1. Start ipython
|
|
110
|
173
|
|
|
111
|
|
.. image:: ../_images/auto_suggest_prompt_no_text.png
|
|
|
174
|
.. image:: ../_images/8.0/auto_suggest_prompt_no_text.png
|
|
112
|
175
|
|
|
113
|
176
|
2. Run ``print("hello")``
|
|
114
|
177
|
|
|
115
|
|
.. image:: ../_images/auto_suggest_print_hello_suggest.png
|
|
|
178
|
.. image:: ../_images/8.0/auto_suggest_print_hello_suggest.png
|
|
116
|
179
|
|
|
117
|
180
|
3. Press p to see the autosuggestion
|
|
118
|
181
|
|
|
119
|
|
.. image:: ../_images/auto_suggest_print_hello_suggest.png
|
|
|
182
|
.. image:: ../_images/8.0/auto_suggest_print_hello_suggest.png
|
|
120
|
183
|
|
|
121
|
184
|
4. Press ctrl f, or ctrl e, or right arrow to accept the suggestion
|
|
122
|
185
|
|
|
123
|
|
.. image:: ../_images/auto_suggest_print_hello.png
|
|
|
186
|
.. image:: ../_images/8.0/auto_suggest_print_hello.png
|
|
124
|
187
|
|
|
125
|
188
|
You can also complete word by word:
|
|
126
|
189
|
|
|
127
|
190
|
1. Run ``def say_hello(): print("hello")``
|
|
128
|
191
|
|
|
129
|
|
.. image:: ../_images/auto_suggest_second_prompt.png
|
|
|
192
|
.. image:: ../_images/8.0/auto_suggest_second_prompt.png
|
|
130
|
193
|
|
|
131
|
194
|
2. Press d to see the autosuggestion
|
|
132
|
195
|
|
|
133
|
|
.. image:: ../_images/audo_suggest_d_phantom.png
|
|
|
196
|
.. image:: ../_images/8.0/auto_suggest_d_phantom.png
|
|
134
|
197
|
|
|
135
|
198
|
3. Press alt f to accept the first word of the suggestion
|
|
136
|
199
|
|
|
137
|
|
.. image:: ../_images/auto_suggest_def_phantom.png
|
|
|
200
|
.. image:: ../_images/8.0/auto_suggest_def_phantom.png
|
|
138
|
201
|
|
|
139
|
202
|
Importantly, this feature does not interfere with tab completion:
|
|
140
|
203
|
|
|
141
|
204
|
1. After running ``def say_hello(): print("hello")``, press d
|
|
142
|
205
|
|
|
143
|
|
.. image:: ../_images/audo_suggest_d_phantom.png
|
|
|
206
|
.. image:: ../_images/8.0/auto_suggest_d_phantom.png
|
|
144
|
207
|
|
|
145
|
208
|
2. Press Tab to start tab completion
|
|
146
|
209
|
|
|
147
|
|
.. image:: ../_images/auto_suggest_d_completions.png
|
|
|
210
|
.. image:: ../_images/8.0/auto_suggest_d_completions.png
|
|
148
|
211
|
|
|
149
|
212
|
3A. Press Tab again to select the first option
|
|
150
|
213
|
|
|
151
|
|
.. image:: ../_images/auto_suggest_def_completions.png
|
|
|
214
|
.. image:: ../_images/8.0/auto_suggest_def_completions.png
|
|
152
|
215
|
|
|
153
|
216
|
3B. Press alt f to accept to accept the first word of the suggestion
|
|
154
|
217
|
|
|
155
|
|
.. image:: ../_images/auto_suggest_def_phantom.png
|
|
|
218
|
.. image:: ../_images/8.0/auto_suggest_def_phantom.png
|
|
156
|
219
|
|
|
157
|
220
|
3C. Press ctrl f or ctrl e to accept the entire suggestion
|
|
158
|
221
|
|
|
159
|
|
.. image:: ../_images/auto_suggest_match_parens.png
|
|
|
222
|
.. image:: ../_images/8.0/auto_suggest_match_parens.png
|
|
160
|
223
|
|
|
161
|
224
|
To install a version of ipython with autosuggestions enabled, run:
|
|
162
|
225
|
|
|
@@
-169,7
+232,7
b' Currently, autosuggestions are only shown in the emacs or vi insert editing mode'
|
|
169
|
232
|
|
|
170
|
233
|
|
|
171
|
234
|
Show pinfo information in ipdb using "?" and "??"
|
|
172
|
|
-------------------------------------------------
|
|
|
235
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
173
|
236
|
|
|
174
|
237
|
In IPDB, it is now possible to show the information about an object using "?"
|
|
175
|
238
|
and "??", in much the same way it can be done when using the IPython prompt::
|
|
@@
-187,7
+250,7
b' Previously, "pinfo" or "pinfo2" command had to be used for this purpose.'
|
|
187
|
250
|
|
|
188
|
251
|
|
|
189
|
252
|
Autoreload 3 feature
|
|
190
|
|
====================
|
|
|
253
|
~~~~~~~~~~~~~~~~~~~~
|
|
191
|
254
|
|
|
192
|
255
|
Example: When an IPython session is ran with the 'autoreload' extension loaded,
|
|
193
|
256
|
you will now have the option '3' to select which means the following:
|
|
@@
-202,14
+265,10
b' For more information please see unit test -'
|
|
202
|
265
|
extensions/tests/test_autoreload.py : 'test_autoload_newly_added_objects'
|
|
203
|
266
|
|
|
204
|
267
|
|
|
205
|
|
Miscelanious
|
|
206
|
|
------------
|
|
207
|
|
|
|
208
|
|
Minimum supported
|
|
209
|
268
|
|
|
210
|
269
|
|
|
211
|
270
|
History Range Glob feature
|
|
212
|
|
==========================
|
|
|
271
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
213
|
272
|
|
|
214
|
273
|
Previously, when using ``%history``, users could specify either
|
|
215
|
274
|
a range of sessions and lines, for example:
|
|
@@
-230,12
+289,10
b' However users could *not* specify both.'
|
|
230
|
289
|
If a user *did* specify both a range and a glob pattern,
|
|
231
|
290
|
then the glob pattern would be used (globbing *all* history) *and the range would be ignored*.
|
|
232
|
291
|
|
|
233
|
|
---
|
|
234
|
|
|
|
235
|
292
|
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.
|
|
236
|
293
|
|
|
237
|
294
|
Don't start a multi line cell with sunken parenthesis
|
|
238
|
|
-----------------------------------------------------
|
|
|
295
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
239
|
296
|
|
|
240
|
297
|
From now on IPython will not ask for the next line of input when given a single
|
|
241
|
298
|
line with more closing than opening brackets. For example, this means that if
|
|
@@
-243,12
+300,12
b" you (mis)type ']]' instead of '[]', a ``SyntaxError`` will show up, instead of"
|
|
243
|
300
|
the ``...:`` prompt continuation.
|
|
244
|
301
|
|
|
245
|
302
|
IPython shell for ipdb interact
|
|
246
|
|
-------------------------------
|
|
|
303
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
247
|
304
|
|
|
248
|
305
|
The ipdb ``interact`` starts an IPython shell instead of Python's built-in ``code.interact()``.
|
|
249
|
306
|
|
|
250
|
307
|
Automatic Vi prompt stripping
|
|
251
|
|
=============================
|
|
|
308
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
252
|
309
|
|
|
253
|
310
|
When pasting code into IPython, it will strip the leading prompt characters if
|
|
254
|
311
|
there are any. For example, you can paste the following code into the console -
|
|
@@
-278,7
+335,7
b' IPython shell can be started in the Vi mode using ``ipython'
|
|
278
|
335
|
--TerminalInteractiveShell.editing_mode=vi``
|
|
279
|
336
|
|
|
280
|
337
|
Empty History Ranges
|
|
281
|
|
====================
|
|
|
338
|
~~~~~~~~~~~~~~~~~~~~
|
|
282
|
339
|
|
|
283
|
340
|
A number of magics that take history ranges can now be used with an empty
|
|
284
|
341
|
range. These magics are:
|
|
@@
-298,7
+355,7
b' when followed with :kbd:`F2`), send it to dpaste.org using ``%pastebin``, or'
|
|
298
|
355
|
view the whole thing syntax-highlighted with a single ``%pycat``.
|
|
299
|
356
|
|
|
300
|
357
|
Traceback improvements
|
|
301
|
|
======================
|
|
|
358
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
302
|
359
|
|
|
303
|
360
|
|
|
304
|
361
|
UPDATE THIS IN INPUT.
|
|
@@
-328,27
+385,76
b' The error traceback is now correctly formatted, showing the cell number in which'
|
|
328
|
385
|
...: return 3 / 0
|
|
329
|
386
|
...:
|
|
330
|
387
|
|
|
331
|
|
In [2]: foo()
|
|
|
388
|
Input In [2]: foo()
|
|
332
|
389
|
---------------------------------------------------------------------------
|
|
333
|
390
|
ZeroDivisionError Traceback (most recent call last)
|
|
334
|
|
In [2], in <module>
|
|
|
391
|
input In [2], in <module>
|
|
335
|
392
|
----> 1 foo()
|
|
336
|
393
|
|
|
337
|
|
In [1], in foo()
|
|
|
394
|
Input In [1], in foo()
|
|
338
|
395
|
1 def foo():
|
|
339
|
396
|
----> 2 return 3 / 0
|
|
340
|
397
|
|
|
341
|
398
|
ZeroDivisionError: division by zero
|
|
342
|
399
|
|
|
343
|
|
Remove Deprecated Stuff
|
|
344
|
|
=======================
|
|
|
400
|
Miscellaneous
|
|
|
401
|
~~~~~~~~~~~~~
|
|
345
|
402
|
|
|
|
403
|
- ``~`` is now expanded when part of a path in most magics :ghpull:`13385`
|
|
|
404
|
- ``%/%%timeit`` magic now adds comma every thousands to make reading long number easier :ghpull:`13379`
|
|
|
405
|
- ``"info"`` messages can now be customised to hide some fields :ghpull:`13343`
|
|
|
406
|
- ``collections.UserList`` now pretty-prints :ghpull:`13320`
|
|
|
407
|
- The debugger now have a persistent history, which should make it less
|
|
|
408
|
annoying to retype commands :ghpull:`13246`
|
|
|
409
|
- ``!pip`` ``!conda`` ``!cd`` or ``!ls`` are likely doing the wrong thing, we
|
|
|
410
|
now warn users if they use it. :ghpull:`12954`
|
|
|
411
|
- make ``%precision`` work for ``numpy.float64`` type :ghpull:`12902`
|
|
|
412
|
|
|
|
413
|
|
|
|
414
|
|
|
|
415
|
|
|
|
416
|
Numfocus Small Developer Grant
|
|
|
417
|
------------------------------
|
|
|
418
|
|
|
|
419
|
To prepare for Python 3.10 we have also started working on removing reliance and
|
|
|
420
|
any dependency that is not Python 3.10 compatible; that include migrating our
|
|
|
421
|
test suite to pytest, and starting to remove nose. This also mean that the
|
|
|
422
|
``iptest`` command is now gone, and all testing is via pytest.
|
|
|
423
|
|
|
|
424
|
This was in bog part thanks the NumFOCUS Small Developer grant, we were able to
|
|
|
425
|
allocate 4000 to hire `Nikita Kniazev @Kojoley <https://github.com/Kojoley>`__
|
|
|
426
|
who did a fantastic job at updating our code base, migrating to pytest, pushing
|
|
|
427
|
our coverage, and fixing a large number of bugs. I highly recommend contacting
|
|
|
428
|
them if you need help with C++ and Python projects
|
|
|
429
|
|
|
|
430
|
You can find all relevant issues and PRs with the SDG 2021 tag:
|
|
|
431
|
|
|
|
432
|
https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+
|
|
|
433
|
|
|
|
434
|
Removing support for Older Python
|
|
|
435
|
---------------------------------
|
|
|
436
|
|
|
|
437
|
|
|
|
438
|
We are also removing support for Python up to 3.7 allowing internal code to use more
|
|
|
439
|
efficient ``pathlib``, and make better use of type annotations.
|
|
|
440
|
|
|
|
441
|
.. image:: ../_images/8.0/pathlib_pathlib_everywhere.jpg
|
|
|
442
|
:alt: "Meme image of Toy story with Woody and Buzz, with the text 'pathlib, pathlib everywhere'"
|
|
|
443
|
|
|
|
444
|
|
|
|
445
|
IMAGE : Pathlib, pathlib everywhere.
|
|
|
446
|
|
|
|
447
|
We have about 34 PRs only to update some logic tu update some function from managing strings to
|
|
|
448
|
using Pathlib.
|
|
|
449
|
|
|
|
450
|
The completer has also seen significant updates and make use of newer Jedi API
|
|
|
451
|
offering faster and more reliable tab completion.
|
|
|
452
|
|
|
|
453
|
For the terminal users this also enable the auto-suggestion feature, described
|
|
|
454
|
below, which show "ghost text" ahead of your cursor you can accept without
|
|
|
455
|
having to press the tab key or ask the completer to suggest completions.
|
|
346
|
456
|
|
|
347
|
|
We no longer need to add `extensions` to the PYTHONPATH because that is being
|
|
348
|
|
handled by `load_extension`.
|
|
349
|
457
|
|
|
350
|
|
We are also removing Cythonmagic, sympyprinting and rmagic as they are now in
|
|
351
|
|
other packages and no longer need to be inside IPython.
|
|
352
|
458
|
|
|
353
|
459
|
.. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
|
|
354
|
460
|
|