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