##// END OF EJS Templates
vmove to version8.rst
Matthias Bussonnier -
Show More
@@ -0,0 +1,428 b''
1 ============
2 8.x Series
3 ============
4
5 IPython 8.0
6 -----------
7
8 IPython 8.0 is still in alpha/beta stage. Please help us improve those release notes
9 by sending PRs that modify docs/source/whatsnew/version8.rst
10
11 IPython 8.0 is bringing a large number of new features and improvements to both the
12 user of the terminal and of the kernel via Jupyter. The removal of compatibility
13 with older version of Python is also the opportunity to do a couple of
14 performance improvement in particular with respect to startup time.
15 The 8.x branch started diverging from its predecessor around IPython 7.12
16 (January 2020).
17
18 This release contains 250+ Pull Requests, in addition to many of the features
19 and backports that have made it to the 7.x branch. All PRs that went into this
20 released are properly tagged with the 8.0 milestone if you wish to have a more
21 in depth look at the changes.
22
23 Please fell free to send pull-requests to updates those notes after release,
24 I have likely forgotten a few things reviewing 250+ PRs.
25
26 Dependencies changes/downstream packaging
27 -----------------------------------------
28
29 Note that most of our building step have been changes to be (mostly) declarative
30 and follow PEP 517, we are trying to completely remove ``setup.py`` (:ghpull:`13238`) and are
31 looking for help to do so.
32
33 - Minimum supported ``traitlets`` version if now 5+
34 - we now require ``stack_data``
35 - Minimal Python is now 3.8
36 - ``nose`` is not a testing requirement anymore
37 - ``pytest`` replaces nose.
38 - ``iptest``/``iptest3`` cli entrypoints do not exists anymore.
39 - minimum officially support ``numpy`` version has been bumped, but this should
40 not have much effect on packaging.
41
42
43 Deprecation and removal
44 -----------------------
45
46 We removed almost all features, arguments, functions, and modules that were
47 marked as deprecated between IPython 1.0 and 5.0. As reminder 5.0 was released
48 in 2016, and 1.0 in 2013. Last release of the 5 branch was 5.10.0, in may 2020.
49 The few remaining deprecated features we left have better deprecation warnings
50 or have been turned into explicit errors for better error messages.
51
52 I will use this occasion to add the following requests to anyone emitting a
53 deprecation warning:
54
55 - Please at at least ``stacklevel=2`` so that the warning is emitted into the
56 caller context, and not the callee one.
57 - Please add **since which version** something is deprecated.
58
59 As a side note it is much easier to deal with conditional comparing to versions
60 numbers than ``try/except`` when a functionality change with version.
61
62 I won't list all the removed features here, but modules like ``IPython.kernel``,
63 which was just a shim module around ``ipykernel`` for the past 8 years have been
64 remove, and so many other similar things that pre-date the name **Jupyter**
65 itself.
66
67 We no longer need to add ``IPyhton.extensions`` to the PYTHONPATH because that is being
68 handled by ``load_extension``.
69
70 We are also removing ``Cythonmagic``, ``sympyprinting`` and ``rmagic`` as they are now in
71 other packages and no longer need to be inside IPython.
72
73
74 Documentation
75 -------------
76
77 Majority of our docstrings have now been reformatted and automatically fixed by
78 the experimental `VΓ©lin <https://pypi.org/project/velin/>`_ project, to conform
79 to numpydoc.
80
81 Type annotations
82 ----------------
83
84 While IPython itself is highly dynamic and can't be completely typed, many of
85 the function now have type annotation, and part of the codebase and now checked
86 by mypy.
87
88
89 Featured changes
90 ----------------
91
92 Here is a features list of changes in IPython 8.0. This is of course non-exhaustive.
93 Please note as well that many features have been added in the 7.x branch as well
94 (and hence why you want to read the 7.x what's new notes), in particular
95 features contributed by QuantStack (with respect to debugger protocol, and Xeus
96 Python), as well as many debugger features that I was please to implement as
97 part of my work at QuanSight and Sponsored by DE Shaw.
98
99 Better Tracebacks
100 ~~~~~~~~~~~~~~~~~
101
102 The first on is the integration of the ``stack_data`` package;
103 which provide smarter informations in traceback; in particular it will highlight
104 the AST node where an error occurs which can help to quickly narrow down errors.
105
106 For example in the following snippet::
107
108 def foo(i):
109 x = [[[0]]]
110 return x[0][i][0]
111
112
113 def bar():
114 return foo(0) + foo(
115 1
116 ) + foo(2)
117
118
119 Calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``,
120 IPython 8.0 is capable of telling you, where the index error occurs::
121
122
123 IndexError
124 Input In [2], in <module>
125 ----> 1 bar()
126 ^^^^^
127
128 Input In [1], in bar()
129 6 def bar():
130 ----> 7 return foo(0) + foo(
131 ^^^^
132 8 1
133 ^^^^^^^^
134 9 ) + foo(2)
135 ^^^^
136
137 Input In [1], in foo(i)
138 1 def foo(i):
139 2 x = [[[0]]]
140 ----> 3 return x[0][i][0]
141 ^^^^^^^
142
143 Corresponding location marked here with ``^`` will show up highlighted in
144 terminal and notebooks.
145
146
147 Autosuggestons
148 ~~~~~~~~~~~~~~
149
150 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>`__.
151
152 `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in
153 `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__.
154
155 This feature allows users to accept autosuggestions with ctrl e, ctrl f,
156 or right arrow as described below.
157
158 1. Start ipython
159
160 .. image:: ../_images/8.0/auto_suggest_1_prompt_no_text.png
161
162 2. Run ``print("hello")``
163
164 .. image:: ../_images/8.0/auto_suggest_2_print_hello_suggest.png
165
166 3. start typing ``print`` again to see the autosuggestion
167
168 .. image:: ../_images/8.0/auto_suggest_3_print_hello_suggest.png
169
170 4. Press ``ctrl-f``, or ``ctrl-e``, or ``right-arrow`` to accept the suggestion
171
172 .. image:: ../_images/8.0/auto_suggest_4_print_hello.png
173
174 You can also complete word by word:
175
176 1. Run ``def say_hello(): print("hello")``
177
178 .. image:: ../_images/8.0/auto_suggest_second_prompt.png
179
180 2. Start typing the first letter if ``def`` to see the autosuggestion
181
182 .. image:: ../_images/8.0/auto_suggest_d_phantom.png
183
184 3. Press ``alt-f`` (or ``escape`` followed by ``f``), to accept the first word of the suggestion
185
186 .. image:: ../_images/8.0/auto_suggest_def_phantom.png
187
188 Importantly, this feature does not interfere with tab completion:
189
190 1. After running ``def say_hello(): print("hello")``, press d
191
192 .. image:: ../_images/8.0/auto_suggest_d_phantom.png
193
194 2. Press Tab to start tab completion
195
196 .. image:: ../_images/8.0/auto_suggest_d_completions.png
197
198 3A. Press Tab again to select the first option
199
200 .. image:: ../_images/8.0/auto_suggest_def_completions.png
201
202 3B. Press ``alt f`` (``escape``, ``f``) to accept to accept the first word of the suggestion
203
204 .. image:: ../_images/8.0/auto_suggest_def_phantom.png
205
206 3C. Press ``ctrl-f`` or ``ctrl-e`` to accept the entire suggestion
207
208 .. image:: ../_images/8.0/auto_suggest_match_parens.png
209
210
211 Currently, autosuggestions are only shown in the emacs or vi insert editing modes:
212
213 - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode.
214 - 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/>`__.
215
216
217 Show pinfo information in ipdb using "?" and "??"
218 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
219
220 In IPDB, it is now possible to show the information about an object using "?"
221 and "??", in much the same way it can be done when using the IPython prompt::
222
223 ipdb> partial?
224 Init signature: partial(self, /, *args, **kwargs)
225 Docstring:
226 partial(func, *args, **keywords) - new function with partial application
227 of the given arguments and keywords.
228 File: ~/.pyenv/versions/3.8.6/lib/python3.8/functools.py
229 Type: type
230 Subclasses:
231
232 Previously, ``pinfo`` or ``pinfo2`` command had to be used for this purpose.
233
234
235 Autoreload 3 feature
236 ~~~~~~~~~~~~~~~~~~~~
237
238 Example: When an IPython session is ran with the 'autoreload' extension loaded,
239 you will now have the option '3' to select which means the following:
240
241 1. replicate all functionality from option 2
242 2. autoload all new funcs/classes/enums/globals from the module when they are added
243 3. autoload all newly imported funcs/classes/enums/globals from external modules
244
245 Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload``
246
247 For more information please see the following unit test : ``extensions/tests/test_autoreload.py:test_autoload_newly_added_objects``
248
249
250
251
252 History Range Glob feature
253 ~~~~~~~~~~~~~~~~~~~~~~~~~~
254
255 Previously, when using ``%history``, users could specify either
256 a range of sessions and lines, for example:
257
258 .. code-block:: python
259
260 ~8/1-~6/5 # see history from the first line of 8 sessions ago,
261 # to the fifth line of 6 sessions ago.``
262
263 Or users could specify a glob pattern:
264
265 .. code-block:: python
266
267 -g <pattern> # glob ALL history for the specified pattern.
268
269 However users could *not* specify both.
270
271 If a user *did* specify both a range and a glob pattern,
272 then the glob pattern would be used (globbing *all* history) *and the range would be ignored*.
273
274 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.
275
276 Don't start a multi line cell with sunken parenthesis
277 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
278
279 From now on IPython will not ask for the next line of input when given a single
280 line with more closing than opening brackets. For example, this means that if
281 you (mis)type ``]]`` instead of ``[]``, a ``SyntaxError`` will show up, instead of
282 the ``...:`` prompt continuation.
283
284 IPython shell for ipdb interact
285 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
286
287 The ipdb ``interact`` starts an IPython shell instead of Python's built-in ``code.interact()``.
288
289 Automatic Vi prompt stripping
290 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
291
292 When pasting code into IPython, it will strip the leading prompt characters if
293 there are any. For example, you can paste the following code into the console -
294 it will still work, even though each line is prefixed with prompts (`In`,
295 `Out`)::
296
297 In [1]: 2 * 2 == 4
298 Out[1]: True
299
300 In [2]: print("This still works as pasted")
301
302
303 Previously, this was not the case for the Vi-mode prompts::
304
305 In [1]: [ins] In [13]: 2 * 2 == 4
306 ...: Out[13]: True
307 ...:
308 File "<ipython-input-1-727bb88eaf33>", line 1
309 [ins] In [13]: 2 * 2 == 4
310 ^
311 SyntaxError: invalid syntax
312
313 This is now fixed, and Vi prompt prefixes - ``[ins]`` and ``[nav]`` - are
314 skipped just as the normal ``In`` would be.
315
316 IPython shell can be started in the Vi mode using ``ipython --TerminalInteractiveShell.editing_mode=vi``,
317 You should be able to change mode dynamically with ``%config TerminalInteractiveShell.editing_mode='vi'``
318
319 Empty History Ranges
320 ~~~~~~~~~~~~~~~~~~~~
321
322 A number of magics that take history ranges can now be used with an empty
323 range. These magics are:
324
325 * ``%save``
326 * ``%load``
327 * ``%pastebin``
328 * ``%pycat``
329
330 Using them this way will make them take the history of the current session up
331 to the point of the magic call (such that the magic itself will not be
332 included).
333
334 Therefore it is now possible to save the whole history to a file using simple
335 ``%save <filename>``, load and edit it using ``%load`` (makes for a nice usage
336 when followed with :kbd:`F2`), send it to dpaste.org using ``%pastebin``, or
337 view the whole thing syntax-highlighted with a single ``%pycat``.
338
339 Traceback improvements
340 ~~~~~~~~~~~~~~~~~~~~~~
341
342
343 Previously, error tracebacks for errors happening in code cells were showing a hash, the one used for compiling the Python AST::
344
345 In [1]: def foo():
346 ...: return 3 / 0
347 ...:
348
349 In [2]: foo()
350 ---------------------------------------------------------------------------
351 ZeroDivisionError Traceback (most recent call last)
352 <ipython-input-2-c19b6d9633cf> in <module>
353 ----> 1 foo()
354
355 <ipython-input-1-1595a74c32d5> in foo()
356 1 def foo():
357 ----> 2 return 3 / 0
358 3
359
360 ZeroDivisionError: division by zero
361
362 The error traceback is now correctly formatted, showing the cell number in which the error happened::
363
364 In [1]: def foo():
365 ...: return 3 / 0
366 ...:
367
368 Input In [2]: foo()
369 ---------------------------------------------------------------------------
370 ZeroDivisionError Traceback (most recent call last)
371 input In [2], in <module>
372 ----> 1 foo()
373
374 Input In [1], in foo()
375 1 def foo():
376 ----> 2 return 3 / 0
377
378 ZeroDivisionError: division by zero
379
380 Miscellaneous
381 ~~~~~~~~~~~~~
382
383 - ``~`` is now expanded when part of a path in most magics :ghpull:`13385`
384 - ``%/%%timeit`` magic now adds comma every thousands to make reading long number easier :ghpull:`13379`
385 - ``"info"`` messages can now be customised to hide some fields :ghpull:`13343`
386 - ``collections.UserList`` now pretty-prints :ghpull:`13320`
387 - The debugger now have a persistent history, which should make it less
388 annoying to retype commands :ghpull:`13246`
389 - ``!pip`` ``!conda`` ``!cd`` or ``!ls`` are likely doing the wrong thing, we
390 now warn users if they use it. :ghpull:`12954`
391 - make ``%precision`` work for ``numpy.float64`` type :ghpull:`12902`
392
393
394
395
396 Numfocus Small Developer Grant
397 ------------------------------
398
399 To prepare for Python 3.10 we have also started working on removing reliance and
400 any dependency that is not Python 3.10 compatible; that include migrating our
401 test suite to pytest, and starting to remove nose. This also mean that the
402 ``iptest`` command is now gone, and all testing is via pytest.
403
404 This was in bog part thanks the NumFOCUS Small Developer grant, we were able to
405 allocate 4000 to hire `Nikita Kniazev (@Kojoley) <https://github.com/Kojoley>`__
406 who did a fantastic job at updating our code base, migrating to pytest, pushing
407 our coverage, and fixing a large number of bugs. I highly recommend contacting
408 them if you need help with C++ and Python projects
409
410 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+>`__
411
412 Removing support for Older Python
413 ---------------------------------
414
415
416 We are also removing support for Python up to 3.7 allowing internal code to use more
417 efficient ``pathlib``, and make better use of type annotations.
418
419 .. image:: ../_images/8.0/pathlib_pathlib_everywhere.jpg
420 :alt: "Meme image of Toy Story with Woody and Buzz, with the text 'pathlib, pathlib everywhere'"
421
422
423 We have about 34 PRs only to update some logic tu update some function from managing strings to
424 using Pathlib.
425
426 The completer has also seen significant updates and make use of newer Jedi API
427 offering faster and more reliable tab completion.
428
@@ -1,452 +1,31 b''
1 =====================
1 =====================
2 Development version
2 Development version
3 =====================
3 =====================
4
4
5 This document describes in-flight development work.
5 This document describes in-flight development work.
6
6
7 .. warning::
7 .. warning::
8
8
9 Please do not edit this file by hand (doing so will likely cause merge
9 Please do not edit this file by hand (doing so will likely cause merge
10 conflicts for other Pull Requests). Instead, create a new file in the
10 conflicts for other Pull Requests). Instead, create a new file in the
11 `docs/source/whatsnew/pr` folder
11 `docs/source/whatsnew/pr` folder
12
12
13
13
14 Released .... ...., 2019
14 Released .... ...., 2019
15
15
16
16
17 Need to be updated:
17 Need to be updated:
18
18
19 .. toctree::
19 .. toctree::
20 :maxdepth: 2
20 :maxdepth: 2
21 :glob:
21 :glob:
22
22
23 pr/*
23 pr/*
24
24
25 IPython 8.0 is bringing a large number of new features and improvements to both the
26 user of the terminal and of the kernel via Jupyter. The removal of compatibility
27 with older version of Python is also the opportunity to do a couple of
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).
31
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 -----------------------
59
60 We removed almost all features, arguments, functions, and modules that were
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.
65
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.
86
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
116 The first on is the integration of the ``stack_data`` package;
117 which provide smarter informations in traceback; in particular it will highlight
118 the AST node where an error occurs which can help to quickly narrow down errors.
119
120 For example in the following snippet::
121
122 def foo(i):
123 x = [[[0]]]
124 return x[0][i][0]
125
126
127 def bar():
128 return foo(0) + foo(
129 1
130 ) + foo(2)
131
132
133 Calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``,
134 IPython 8.0 is capable of telling you, where the index error occurs::
135
136
137 IndexError
138 Input In [2], in <module>
139 ----> 1 bar()
140 ^^^^^
141
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 ^^^^
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 ^^^^^^^
156
157 Corresponding location marked here with ``^`` will show up highlighted in
158 terminal and notebooks.
159
160
161 Autosuggestons
162 ~~~~~~~~~~~~~~
163
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>`__.
165
166 `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in
167 `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__.
168
169 This feature allows users to accept autosuggestions with ctrl e, ctrl f,
170 or right arrow as described below.
171
172 1. Start ipython
173
174 .. image:: ../_images/8.0/auto_suggest_1_prompt_no_text.png
175
176 2. Run ``print("hello")``
177
178 .. image:: ../_images/8.0/auto_suggest_2_print_hello_suggest.png
179
180 3. start typing ``print`` again to see the autosuggestion
181
182 .. image:: ../_images/8.0/auto_suggest_3_print_hello_suggest.png
183
184 4. Press ``ctrl-f``, or ``ctrl-e``, or ``right-arrow`` to accept the suggestion
185
186 .. image:: ../_images/8.0/auto_suggest_4_print_hello.png
187
188 You can also complete word by word:
189
190 1. Run ``def say_hello(): print("hello")``
191
192 .. image:: ../_images/8.0/auto_suggest_second_prompt.png
193
194 2. Start typing the first letter if ``def`` to see the autosuggestion
195
196 .. image:: ../_images/8.0/auto_suggest_d_phantom.png
197
198 3. Press ``alt-f`` (or ``escape`` followed by ``f``), to accept the first word of the suggestion
199
200 .. image:: ../_images/8.0/auto_suggest_def_phantom.png
201
202 Importantly, this feature does not interfere with tab completion:
203
204 1. After running ``def say_hello(): print("hello")``, press d
205
206 .. image:: ../_images/8.0/auto_suggest_d_phantom.png
207
208 2. Press Tab to start tab completion
209
210 .. image:: ../_images/8.0/auto_suggest_d_completions.png
211
212 3A. Press Tab again to select the first option
213
214 .. image:: ../_images/8.0/auto_suggest_def_completions.png
215
216 3B. Press ``alt f`` (``escape``, ``f``) to accept to accept the first word of the suggestion
217
218 .. image:: ../_images/8.0/auto_suggest_def_phantom.png
219
220 3C. Press ``ctrl-f`` or ``ctrl-e`` to accept the entire suggestion
221
222 .. image:: ../_images/8.0/auto_suggest_match_parens.png
223
224
225 Currently, autosuggestions are only shown in the emacs or vi insert editing modes:
226
227 - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode.
228 - 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/>`__.
229
230
231 Show pinfo information in ipdb using "?" and "??"
232 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233
234 In IPDB, it is now possible to show the information about an object using "?"
235 and "??", in much the same way it can be done when using the IPython prompt::
236
237 ipdb> partial?
238 Init signature: partial(self, /, *args, **kwargs)
239 Docstring:
240 partial(func, *args, **keywords) - new function with partial application
241 of the given arguments and keywords.
242 File: ~/.pyenv/versions/3.8.6/lib/python3.8/functools.py
243 Type: type
244 Subclasses:
245
246 Previously, ``pinfo`` or ``pinfo2`` command had to be used for this purpose.
247
248
249 Autoreload 3 feature
250 ~~~~~~~~~~~~~~~~~~~~
251
252 Example: When an IPython session is ran with the 'autoreload' extension loaded,
253 you will now have the option '3' to select which means the following:
254
255 1. replicate all functionality from option 2
256 2. autoload all new funcs/classes/enums/globals from the module when they are added
257 3. autoload all newly imported funcs/classes/enums/globals from external modules
258
259 Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload``
260
261 For more information please see the following unit test : ``extensions/tests/test_autoreload.py:test_autoload_newly_added_objects``
262
263
264
265
266 History Range Glob feature
267 ~~~~~~~~~~~~~~~~~~~~~~~~~~
268
269 Previously, when using ``%history``, users could specify either
270 a range of sessions and lines, for example:
271
272 .. code-block:: python
273
274 ~8/1-~6/5 # see history from the first line of 8 sessions ago,
275 # to the fifth line of 6 sessions ago.``
276
277 Or users could specify a glob pattern:
278
279 .. code-block:: python
280
281 -g <pattern> # glob ALL history for the specified pattern.
282
283 However users could *not* specify both.
284
285 If a user *did* specify both a range and a glob pattern,
286 then the glob pattern would be used (globbing *all* history) *and the range would be ignored*.
287
288 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.
289
290 Don't start a multi line cell with sunken parenthesis
291 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292
293 From now on IPython will not ask for the next line of input when given a single
294 line with more closing than opening brackets. For example, this means that if
295 you (mis)type ``]]`` instead of ``[]``, a ``SyntaxError`` will show up, instead of
296 the ``...:`` prompt continuation.
297
298 IPython shell for ipdb interact
299 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300
301 The ipdb ``interact`` starts an IPython shell instead of Python's built-in ``code.interact()``.
302
303 Automatic Vi prompt stripping
304 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
305
306 When pasting code into IPython, it will strip the leading prompt characters if
307 there are any. For example, you can paste the following code into the console -
308 it will still work, even though each line is prefixed with prompts (`In`,
309 `Out`)::
310
311 In [1]: 2 * 2 == 4
312 Out[1]: True
313
314 In [2]: print("This still works as pasted")
315
316
317 Previously, this was not the case for the Vi-mode prompts::
318
319 In [1]: [ins] In [13]: 2 * 2 == 4
320 ...: Out[13]: True
321 ...:
322 File "<ipython-input-1-727bb88eaf33>", line 1
323 [ins] In [13]: 2 * 2 == 4
324 ^
325 SyntaxError: invalid syntax
326
327 This is now fixed, and Vi prompt prefixes - ``[ins]`` and ``[nav]`` - are
328 skipped just as the normal ``In`` would be.
329
330 IPython shell can be started in the Vi mode using ``ipython --TerminalInteractiveShell.editing_mode=vi``,
331 You should be able to change mode dynamically with ``%config TerminalInteractiveShell.editing_mode='vi'``
332
333 Empty History Ranges
334 ~~~~~~~~~~~~~~~~~~~~
335
336 A number of magics that take history ranges can now be used with an empty
337 range. These magics are:
338
339 * ``%save``
340 * ``%load``
341 * ``%pastebin``
342 * ``%pycat``
343
344 Using them this way will make them take the history of the current session up
345 to the point of the magic call (such that the magic itself will not be
346 included).
347
348 Therefore it is now possible to save the whole history to a file using simple
349 ``%save <filename>``, load and edit it using ``%load`` (makes for a nice usage
350 when followed with :kbd:`F2`), send it to dpaste.org using ``%pastebin``, or
351 view the whole thing syntax-highlighted with a single ``%pycat``.
352
353 Traceback improvements
354 ~~~~~~~~~~~~~~~~~~~~~~
355
356
357 Previously, error tracebacks for errors happening in code cells were showing a hash, the one used for compiling the Python AST::
358
359 In [1]: def foo():
360 ...: return 3 / 0
361 ...:
362
363 In [2]: foo()
364 ---------------------------------------------------------------------------
365 ZeroDivisionError Traceback (most recent call last)
366 <ipython-input-2-c19b6d9633cf> in <module>
367 ----> 1 foo()
368
369 <ipython-input-1-1595a74c32d5> in foo()
370 1 def foo():
371 ----> 2 return 3 / 0
372 3
373
374 ZeroDivisionError: division by zero
375
376 The error traceback is now correctly formatted, showing the cell number in which the error happened::
377
378 In [1]: def foo():
379 ...: return 3 / 0
380 ...:
381
382 Input In [2]: foo()
383 ---------------------------------------------------------------------------
384 ZeroDivisionError Traceback (most recent call last)
385 input In [2], in <module>
386 ----> 1 foo()
387
388 Input In [1], in foo()
389 1 def foo():
390 ----> 2 return 3 / 0
391
392 ZeroDivisionError: division by zero
393
394 Miscellaneous
395 ~~~~~~~~~~~~~
396
397 - ``~`` is now expanded when part of a path in most magics :ghpull:`13385`
398 - ``%/%%timeit`` magic now adds comma every thousands to make reading long number easier :ghpull:`13379`
399 - ``"info"`` messages can now be customised to hide some fields :ghpull:`13343`
400 - ``collections.UserList`` now pretty-prints :ghpull:`13320`
401 - The debugger now have a persistent history, which should make it less
402 annoying to retype commands :ghpull:`13246`
403 - ``!pip`` ``!conda`` ``!cd`` or ``!ls`` are likely doing the wrong thing, we
404 now warn users if they use it. :ghpull:`12954`
405 - make ``%precision`` work for ``numpy.float64`` type :ghpull:`12902`
406
407
408
409
410 Numfocus Small Developer Grant
411 ------------------------------
412
413 To prepare for Python 3.10 we have also started working on removing reliance and
414 any dependency that is not Python 3.10 compatible; that include migrating our
415 test suite to pytest, and starting to remove nose. This also mean that the
416 ``iptest`` command is now gone, and all testing is via pytest.
417
418 This was in bog part thanks the NumFOCUS Small Developer grant, we were able to
419 allocate 4000 to hire `Nikita Kniazev (@Kojoley) <https://github.com/Kojoley>`__
420 who did a fantastic job at updating our code base, migrating to pytest, pushing
421 our coverage, and fixing a large number of bugs. I highly recommend contacting
422 them if you need help with C++ and Python projects
423
424 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+>`__
425
426 Removing support for Older Python
427 ---------------------------------
428
429
430 We are also removing support for Python up to 3.7 allowing internal code to use more
431 efficient ``pathlib``, and make better use of type annotations.
432
433 .. image:: ../_images/8.0/pathlib_pathlib_everywhere.jpg
434 :alt: "Meme image of Toy Story with Woody and Buzz, with the text 'pathlib, pathlib everywhere'"
435
436
437 We have about 34 PRs only to update some logic tu update some function from managing strings to
438 using Pathlib.
439
440 The completer has also seen significant updates and make use of newer Jedi API
441 offering faster and more reliable tab completion.
442
443
25
444 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
26 .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
445
27
446 As a reminder, IPython master has diverged from the 7.x branch, thus master may
447 have more feature and API changes.
448
449 Backwards incompatible changes
28 Backwards incompatible changes
450 ------------------------------
29 ------------------------------
451
30
452 .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT.
31 .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT.
@@ -1,71 +1,72 b''
1 .. Developers should add in this file, during each release cycle, information
1 .. Developers should add in this file, during each release cycle, information
2 .. about important changes they've made, in a summary format that's meant for
2 .. about important changes they've made, in a summary format that's meant for
3 .. end users. For each release we normally have three sections: features, bug
3 .. end users. For each release we normally have three sections: features, bug
4 .. fixes and api breakage.
4 .. fixes and api breakage.
5 .. Please remember to credit the authors of the contributions by name,
5 .. Please remember to credit the authors of the contributions by name,
6 .. especially when they are new users or developers who do not regularly
6 .. especially when they are new users or developers who do not regularly
7 .. participate in IPython's development.
7 .. participate in IPython's development.
8
8
9 .. _whatsnew_index:
9 .. _whatsnew_index:
10
10
11 =====================
11 =====================
12 What's new in IPython
12 What's new in IPython
13 =====================
13 =====================
14
14
15 ..
15 ..
16 this will appear in the docs if we are not releasing a version (ie if
16 this will appear in the docs if we are not releasing a version (ie if
17 `_version_extra` in release.py is an empty string)
17 `_version_extra` in release.py is an empty string)
18
18
19 .. only:: ipydev
19 .. only:: ipydev
20
20
21 Development version in-progress features:
21 Development version in-progress features:
22
22
23 .. toctree::
23 .. toctree::
24
24
25 development
25 development
26
26
27
27
28 This section documents the changes that have been made in various versions of
28 This section documents the changes that have been made in various versions of
29 IPython. Users should consult these pages to learn about new features, bug
29 IPython. Users should consult these pages to learn about new features, bug
30 fixes and backwards incompatibilities. Developers should summarize the
30 fixes and backwards incompatibilities. Developers should summarize the
31 development work they do here in a user friendly format.
31 development work they do here in a user friendly format.
32
32
33 .. toctree::
33 .. toctree::
34 :maxdepth: 1
34 :maxdepth: 1
35
35
36 version8
36 version7
37 version7
37 github-stats-7
38 github-stats-7
38 version6
39 version6
39 github-stats-6
40 github-stats-6
40 version5
41 version5
41 github-stats-5
42 github-stats-5
42 version4
43 version4
43 github-stats-4
44 github-stats-4
44 version3
45 version3
45 github-stats-3
46 github-stats-3
46 version3_widget_migration
47 version3_widget_migration
47 version2.0
48 version2.0
48 github-stats-2.0
49 github-stats-2.0
49 version1.0
50 version1.0
50 github-stats-1.0
51 github-stats-1.0
51 version0.13
52 version0.13
52 github-stats-0.13
53 github-stats-0.13
53 version0.12
54 version0.12
54 github-stats-0.12
55 github-stats-0.12
55 version0.11
56 version0.11
56 github-stats-0.11
57 github-stats-0.11
57 version0.10
58 version0.10
58 version0.9
59 version0.9
59 version0.8
60 version0.8
60
61
61 ..
62 ..
62 this makes a hidden toctree that keeps sphinx from complaining about
63 this makes a hidden toctree that keeps sphinx from complaining about
63 documents included nowhere when building docs for stable
64 documents included nowhere when building docs for stable
64 We place it at the end as it will still be reachable via prev/next links.
65 We place it at the end as it will still be reachable via prev/next links.
65
66
66 .. only:: ipystable
67 .. only:: ipystable
67
68
68 .. toctree::
69 .. toctree::
69 :hidden:
70 :hidden:
70
71
71 development
72 development
General Comments 0
You need to be logged in to leave comments. Login now