##// END OF EJS Templates
Backport PR #12862: prepare 7.22 release notes
Matthias Bussonnier -
Show More
@@ -1,1260 +1,1280 b''
1 1 ============
2 2 7.x Series
3 3 ============
4 4
5 .. _version 7.22:
6 =================
7
8
9 Thanks
10 ------
11
12 We have a new team member that you should see more often on the IPython
13 repository, BΕ‚aΕΌej Michalik (@MrMino) have been doing regular contributions to
14 IPython, and spent time replying to many issues and guiding new users to the
15 codebase; they now have triage permissions to the IPython repository and we'll
16 work toward giving them more permission in the future.
17
18 Many thanks to all the contributors to this release you can find all individual
19 contributions to this milestone `on github <https://github.com/ipython/ipython/milestone/XX>`_.
20
21 Thanks as well to organisations, QuantStack for working on debugger
22 compatibility for Xeus_python, and the `D. E. Shaw group
23 <https://deshaw.com/>` for sponsoring work on IPython and related libraries.
24
5 25 .. _version 721:
6 26
7 27 IPython 7.21
8 28 ============
9 29
10 30 IPython 7.21 is the first release we have back on schedule of one release every
11 31 month; it contains a number of minor fixes and improvements, notably, the new
12 32 context command for ipdb
13 33
14 34
15 35 New "context" command in ipdb
16 36 -----------------------------
17 37
18 38 It is now possible to change the number of lines shown in the backtrace
19 39 information in ipdb using "context" command. :ghpull:`12826`
20 40
21 41 (thanks @MrMino, there are other improvement from them on master).
22 42
23 43 Other notable changes in IPython 7.21
24 44 -------------------------------------
25 45
26 46 - Fix some issues on new osx-arm64 :ghpull:`12804`, :ghpull:`12807`.
27 47 - Compatibility with Xeus-Python for debugger protocol, :ghpull:`12809`
28 48 - Misc docs fixes for compatibility and uniformity with Numpydoc.
29 49 :ghpull:`12824`
30 50
31 51
32 52 Thanks
33 53 ------
34 54
35 55 Many thanks to all the contributors to this release you can find all individual
36 56 contribution to this milestone `on github <https://github.com/ipython/ipython/milestone/83>`_.
37 57
38 58
39 59 .. _version 720:
40 60
41 61 IPython 7.20
42 62 ============
43 63
44 64 IPython 7.20 is the accumulation of 3 month of work on IPython, spacing between
45 65 IPython release have been increased from the usual once a month for various
46 66 reason.
47 67
48 68 - Mainly as I'm too busy and the effectively sole maintainer, and
49 69 - Second because not much changes happened before mid December.
50 70
51 71 The main driver for this release was the new version of Jedi 0.18 breaking API;
52 72 which was taken care of in the master branch early in 2020 but not in 7.x as I
53 73 though that by now 8.0 would be out.
54 74
55 75 The inclusion of a resolver in pip did not help and actually made things worse.
56 76 If usually I would have simply pinned Jedi to ``<0.18``; this is not a solution
57 77 anymore as now pip is free to install Jedi 0.18, and downgrade IPython.
58 78
59 79 I'll do my best to keep the regular release, but as the 8.0-dev branch and 7.x
60 80 are starting to diverge this is becoming difficult in particular with my limited
61 81 time, so if you have any cycles to spare I'll appreciate your help to respond to
62 82 issues and pushing 8.0 forward.
63 83
64 84 Here are thus some of the changes for IPython 7.20.
65 85
66 86 - Support for PyQt5 >= 5.11 :ghpull:`12715`
67 87 - ``%reset`` remove imports more agressively :ghpull:`12718`
68 88 - fix the ``%conda`` magic :ghpull:`12739`
69 89 - compatibility with Jedi 0.18, and bump minimum Jedi version. :ghpull:`12793`
70 90
71 91
72 92 .. _version 719:
73 93
74 94 IPython 7.19
75 95 ============
76 96
77 97 IPython 7.19 accumulative two month of works, bug fixes and improvements, there
78 98 was exceptionally no release last month.
79 99
80 100 - Fix to restore the ability to specify more than one extension using command
81 101 line flags when using traitlets 5.0 :ghpull:`12543`
82 102 - Docs docs formatting that make the install commands work on zsh
83 103 :ghpull:`12587`
84 104 - Always display the last frame in tracebacks even if hidden with
85 105 ``__traceback_hide__`` :ghpull:`12601`
86 106 - Avoid an issue where a callback can be registered multiple times.
87 107 :ghpull:`12625`
88 108 - Avoid an issue in debugger mode where frames changes could be lost.
89 109 :ghpull:`12627`
90 110
91 111 - Never hide the frames that invoke a debugger, even if marked as hidden by
92 112 ``__traceback_hide__`` :ghpull:`12631`
93 113 - Fix calling the debugger in a recursive manner :ghpull:`12659`
94 114
95 115
96 116 A number of code changes have landed on master and we are getting close to
97 117 enough new features and codebase improvement that a 8.0 start to make sens.
98 118 For downstream packages, please start working on migrating downstream testing
99 119 away from iptest and using pytest, as nose will not work on Python 3.10 and we
100 120 will likely start removing it as a dependency for testing.
101 121
102 122 .. _version 718:
103 123
104 124 IPython 7.18
105 125 ============
106 126
107 127 IPython 7.18 is a minor release that mostly contains bugfixes.
108 128
109 129 - ``CRLF`` is now handled by magics my default; solving some issues due to copy
110 130 pasting on windows. :ghpull:`12475`
111 131
112 132 - Requiring pexpect ``>=4.3`` as we are Python 3.7+ only and earlier version of
113 133 pexpect will be incompatible. :ghpull:`12510`
114 134
115 135 - Minimum jedi version is now 0.16. :ghpull:`12488`
116 136
117 137
118 138
119 139 .. _version 717:
120 140
121 141 IPython 7.17
122 142 ============
123 143
124 144 IPython 7.17 brings a couple of new improvements to API and a couple of user
125 145 facing changes to make the terminal experience more user friendly.
126 146
127 147 :ghpull:`12407` introduces the ability to pass extra argument to the IPython
128 148 debugger class; this is to help a new project from ``kmaork``
129 149 (https://github.com/kmaork/madbg) to feature a fully remote debugger.
130 150
131 151 :ghpull:`12410` finally remove support for 3.6, while the codebase is still
132 152 technically compatible; IPython will not install on Python 3.6.
133 153
134 154 lots of work on the debugger and hidden frames from ``@impact27`` in
135 155 :ghpull:`12437`, :ghpull:`12445`, :ghpull:`12460` and in particular
136 156 :ghpull:`12453` which make the debug magic more robust at handling spaces.
137 157
138 158 Biggest API addition is code transformation which is done before code execution;
139 159 IPython allows a number of hooks to catch non-valid Python syntax (magic, prompt
140 160 stripping...etc). Transformers are usually called many time; typically:
141 161
142 162 - When trying to figure out whether the code is complete and valid (should we
143 163 insert a new line or execute ?)
144 164 - During actual code execution pass before giving the code to Python's
145 165 ``exec``.
146 166
147 167 This lead to issues when transformer might have had side effects; or do external
148 168 queries. Starting with IPython 7.17 you can expect your transformer to be called
149 169 less time.
150 170
151 171 Input transformers are now called only once in the execution path of
152 172 `InteractiveShell`, allowing to register transformer that potentially have side
153 173 effects (note that this is not recommended). Internal methods `should_run_async`, and
154 174 `run_cell_async` now take a recommended optional `transformed_cell`, and
155 175 `preprocessing_exc_tuple` parameters that will become mandatory at some point in
156 176 the future; that is to say cells need to be explicitly transformed to be valid
157 177 Python syntax ahead of trying to run them. :ghpull:`12440`;
158 178
159 179 ``input_transformers`` can now also have an attribute ``has_side_effects`` set
160 180 to `True`, when this attribute is present; this will prevent the transformers
161 181 from being ran when IPython is trying to guess whether the user input is
162 182 complete. Note that this may means you will need to explicitly execute in some
163 183 case where your transformations are now not ran; but will not affect users with
164 184 no custom extensions.
165 185
166 186
167 187 API Changes
168 188 -----------
169 189
170 190 Change of API and exposed objects automatically detected using `frappuccino
171 191 <https://pypi.org/project/frappuccino/>`_
172 192
173 193
174 194 The following items are new since 7.16.0::
175 195
176 196 + IPython.core.interactiveshell.InteractiveShell.get_local_scope(self, stack_depth)
177 197
178 198 The following signatures differ since 7.16.0::
179 199
180 200 - IPython.core.interactiveshell.InteractiveShell.run_cell_async(self, raw_cell, store_history=False, silent=False, shell_futures=True)
181 201 + IPython.core.interactiveshell.InteractiveShell.run_cell_async(self, raw_cell, store_history=False, silent=False, shell_futures=True, *, transformed_cell=None, preprocessing_exc_tuple=None)
182 202
183 203 - IPython.core.interactiveshell.InteractiveShell.should_run_async(self, raw_cell)
184 204 + IPython.core.interactiveshell.InteractiveShell.should_run_async(self, raw_cell, *, transformed_cell=None, preprocessing_exc_tuple=None)
185 205
186 206 - IPython.terminal.debugger.TerminalPdb.pt_init(self)
187 207 + IPython.terminal.debugger.TerminalPdb.pt_init(self, pt_session_options=None)
188 208
189 209 This method was added::
190 210
191 211 + IPython.core.interactiveshell.InteractiveShell.get_local_scope
192 212
193 213 Which is now also present on subclasses::
194 214
195 215 + IPython.terminal.embed.InteractiveShellEmbed.get_local_scope
196 216 + IPython.terminal.interactiveshell.TerminalInteractiveShell.get_local_scope
197 217
198 218
199 219 .. _version 716:
200 220
201 221 IPython 7.16
202 222 ============
203 223
204 224
205 225 The default traceback mode will now skip frames that are marked with
206 226 ``__tracebackhide__ = True`` and show how many traceback frames have been
207 227 skipped. This can be toggled by using :magic:`xmode` with the ``--show`` or
208 228 ``--hide`` attribute. It will have no effect on non verbose traceback modes.
209 229
210 230 The ipython debugger also now understands ``__tracebackhide__`` as well and will
211 231 skip hidden frames when displaying. Movement up and down the stack will skip the
212 232 hidden frames and will show how many frames were hidden. Internal IPython frames
213 233 are also now hidden by default. The behavior can be changed with the
214 234 ``skip_hidden`` while in the debugger, command and accepts "yes", "no", "true"
215 235 and "false" case insensitive parameters.
216 236
217 237
218 238 Misc Noticeable changes:
219 239 ------------------------
220 240
221 241 - Exceptions are now (re)raised when running notebooks via the :magic:`%run`, helping to catch issues in workflows and
222 242 pipelines. :ghpull:`12301`
223 243 - Fix inputhook for qt 5.15.0 :ghpull:`12355`
224 244 - Fix wx inputhook :ghpull:`12375`
225 245 - Add handling for malformed pathext env var (Windows) :ghpull:`12367`
226 246 - use $SHELL in system_piped :ghpull:`12360` for uniform behavior with
227 247 ipykernel.
228 248
229 249 Reproducible Build
230 250 ------------------
231 251
232 252 IPython 7.15 reproducible build did not work, so we try again this month
233 253 :ghpull:`12358`.
234 254
235 255
236 256 API Changes
237 257 -----------
238 258
239 259 Change of API and exposed objects automatically detected using `frappuccino
240 260 <https://pypi.org/project/frappuccino/>`_ (still in beta):
241 261
242 262
243 263 The following items are new and mostly related to understanding ``__tracebackbhide__``::
244 264
245 265 + IPython.core.debugger.Pdb.do_down(self, arg)
246 266 + IPython.core.debugger.Pdb.do_skip_hidden(self, arg)
247 267 + IPython.core.debugger.Pdb.do_up(self, arg)
248 268 + IPython.core.debugger.Pdb.hidden_frames(self, stack)
249 269 + IPython.core.debugger.Pdb.stop_here(self, frame)
250 270
251 271
252 272 The following items have been removed::
253 273
254 274 - IPython.core.debugger.Pdb.new_do_down
255 275 - IPython.core.debugger.Pdb.new_do_up
256 276
257 277 Those were implementation details.
258 278
259 279
260 280 .. _version 715:
261 281
262 282 IPython 7.15
263 283 ============
264 284
265 285 IPython 7.15 brings a number of bug fixes and user facing improvements.
266 286
267 287 Misc Noticeable changes:
268 288 ------------------------
269 289
270 290 - Long completion name have better elision in terminal :ghpull:`12284`
271 291 - I've started to test on Python 3.9 :ghpull:`12307` and fix some errors.
272 292 - Hi DPI scaling of figures when using qt eventloop :ghpull:`12314`
273 293 - Document the ability to have systemwide configuration for IPython.
274 294 :ghpull:`12328`
275 295 - Fix issues with input autoformatting :ghpull:`12336`
276 296 - ``IPython.core.debugger.Pdb`` is now interruptible (:ghpull:`12168`, in 7.14
277 297 but forgotten in release notes)
278 298 - Video HTML attributes (:ghpull:`12212`, in 7.14 but forgotten in release
279 299 notes)
280 300
281 301 Reproducible Build
282 302 ------------------
283 303
284 304 Starting with IPython 7.15, I am attempting to provide reproducible builds,
285 305 that is to say you should be able from the source tree to generate an sdist
286 306 and wheel that are identical byte for byte with the publish version on PyPI.
287 307
288 308 I've only tested on a couple of machines so far and the process is relatively
289 309 straightforward, so this mean that IPython not only have a deterministic build
290 310 process, but also I have either removed, or put under control all effects of
291 311 the build environments on the final artifact. I encourage you to attempt the
292 312 build process on your machine as documented in :ref:`core_developer_guide`
293 313 and let me know if you do not obtain an identical artifact.
294 314
295 315 While reproducible builds is critical to check that the supply chain of (open
296 316 source) software has not been compromised, it can also help to speedup many
297 317 of the build processes in large environment (conda, apt...) by allowing
298 318 better caching of intermediate build steps.
299 319
300 320 Learn more on `<https://reproducible-builds.org/>`_. `Reflections on trusting
301 321 trust <https://dl.acm.org/doi/10.1145/358198.358210>`_ is also one of the
302 322 cornerstone and recommended reads on this subject.
303 323
304 324 .. note::
305 325
306 326 The build commit from which the sdist is generated is also `signed
307 327 <https://en.wikipedia.org/wiki/Digital_signature>`_, so you should be able to
308 328 check it has not been compromised, and the git repository is a `merkle-tree
309 329 <https://en.wikipedia.org/wiki/Merkle_tree>`_, you can check the consistency
310 330 with `git-fsck <https://git-scm.com/docs/git-fsck>`_ which you likely `want
311 331 to enable by default
312 332 <https://gist.github.com/mbbx6spp/14b86437e794bffb4120>`_.
313 333
314 334 NEP29: Last version to support Python 3.6
315 335 -----------------------------------------
316 336
317 337 IPython 7.15 will be the Last IPython version to officially support Python
318 338 3.6, as stated by `NumPy Enhancement Proposal 29
319 339 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_. Starting with
320 340 next minor version of IPython I may stop testing on Python 3.6 and may stop
321 341 publishing release artifacts that install on Python 3.6
322 342
323 343 Highlighted features
324 344 --------------------
325 345
326 346 Highlighted features are not new, but seem to not be widely known, this
327 347 section will help you discover in more narrative form what you can do with
328 348 IPython.
329 349
330 350 Increase Tab Completion Menu Height
331 351 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
332 352
333 353 In terminal IPython it is possible to increase the hight of the tab-completion
334 354 menu. To do so set the value of
335 355 :configtrait:`TerminalInteractiveShell.space_for_menu`, this will reserve more
336 356 space at the bottom of the screen for various kind of menus in IPython including
337 357 tab completion and searching in history.
338 358
339 359 Autoformat Code in the terminal
340 360 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
341 361
342 362 If you have a preferred code formatter, you can configure IPython to
343 363 reformat your code. Set the value of
344 364 :configtrait:`TerminalInteractiveShell.autoformatter` to for example ``'black'``
345 365 and IPython will auto format your code when possible.
346 366
347 367
348 368 .. _version 714:
349 369
350 370 IPython 7.14
351 371 ============
352 372
353 373 IPython 7.14 is a minor release that fix a couple of bugs and prepare
354 374 compatibility with new or future versions of some libraries.
355 375
356 376 Important changes:
357 377 ------------------
358 378
359 379 - Fix compatibility with Sphinx 3+ :ghpull:`12235`
360 380 - Remove deprecated matplotlib parameter usage, compatibility with matplotlib
361 381 3.3+ :`122250`
362 382
363 383 Misc Changes
364 384 ------------
365 385
366 386 - set ``.py`` extension when editing current buffer in vi/emacs. :ghpull:`12167`
367 387 - support for unicode identifiers in ``?``/``??`` :ghpull:`12208`
368 388 - add extra options to the ``Video`` Rich objects :ghpull:`12212`
369 389 - add pretty-printing to ``SimpleNamespace`` :ghpull:`12230`
370 390
371 391 IPython.core.debugger.Pdb is now interruptible
372 392 ----------------------------------------------
373 393
374 394 A ``KeyboardInterrupt`` will now interrupt IPython's extended debugger, in order to make Jupyter able to interrupt it. (:ghpull:`12168`)
375 395
376 396 Video HTML attributes
377 397 ---------------------
378 398
379 399 Add an option to `IPython.display.Video` to change the attributes of the HTML display of the video (:ghpull:`12212`)
380 400
381 401
382 402 Pending deprecated imports
383 403 --------------------------
384 404
385 405 Many object present in ``IPython.core.display`` are there for internal use only,
386 406 and should already been imported from ``IPython.display`` by users and external
387 407 libraries. Trying to import those from ``IPython.core.display`` is still possible
388 408 but will trigger a
389 409 deprecation warning in later versions of IPython and will become errors in the
390 410 future.
391 411
392 412 This will simplify compatibility with other Python kernels (like Xeus-Python),
393 413 and simplify code base.
394 414
395 415
396 416
397 417
398 418 .. _version 713:
399 419
400 420 IPython 7.13
401 421 ============
402 422
403 423 IPython 7.13 is the final release of the 7.x branch since master is diverging
404 424 toward an 8.0. Exiting new features have already been merged in 8.0 and will
405 425 not be available on the 7.x branch. All the changes below have been backported
406 426 from the master branch.
407 427
408 428
409 429 - Fix inability to run PDB when inside an event loop :ghpull:`12141`
410 430 - Fix ability to interrupt some processes on windows :ghpull:`12137`
411 431 - Fix debugger shortcuts :ghpull:`12132`
412 432 - improve tab completion when inside a string by removing irrelevant elements :ghpull:`12128`
413 433 - Fix display of filename tab completion when the path is long :ghpull:`12122`
414 434 - Many removal of Python 2 specific code path :ghpull:`12110`
415 435 - displaying wav files do not require NumPy anymore, and is 5x to 30x faster :ghpull:`12113`
416 436
417 437 See the list of all closed issues and pull request on `github
418 438 <https://github.com/ipython/ipython/pulls?q=is%3Aclosed+milestone%3A7.13>`_.
419 439
420 440 .. _version 712:
421 441
422 442 IPython 7.12
423 443 ============
424 444
425 445 IPython 7.12 is a minor update that mostly brings code cleanup, removal of
426 446 longtime deprecated function and a couple update to documentation cleanup as well.
427 447
428 448 Notable changes are the following:
429 449
430 450 - Exit non-zero when ipython is given a file path to run that doesn't exist :ghpull:`12074`
431 451 - Test PR on ARM64 with Travis-CI :ghpull:`12073`
432 452 - Update CI to work with latest Pytest :ghpull:`12086`
433 453 - Add infrastructure to run ipykernel eventloop via trio :ghpull:`12097`
434 454 - Support git blame ignore revs :ghpull:`12091`
435 455 - Start multi-line ``__repr__`` s on their own line :ghpull:`12099`
436 456
437 457 .. _version 7111:
438 458
439 459 IPython 7.11.1
440 460 ==============
441 461
442 462 A couple of deprecated functions (no-op) have been reintroduces in py3compat as
443 463 Cython was still relying on them, and will be removed in a couple of versions.
444 464
445 465 .. _version 711:
446 466
447 467 IPython 7.11
448 468 ============
449 469
450 470 IPython 7.11 received a couple of compatibility fixes and code cleanup.
451 471
452 472 A number of function in the ``py3compat`` have been removed; a number of types
453 473 in the IPython code base are now non-ambiguous and now always ``unicode``
454 474 instead of ``Union[Unicode,bytes]``; many of the relevant code path have thus
455 475 been simplified/cleaned and types annotation added.
456 476
457 477 IPython support several verbosity level from exceptions. ``xmode plain`` now
458 478 support chained exceptions. :ghpull:`11999`
459 479
460 480 We are starting to remove ``shell=True`` in some usages of subprocess. While not directly
461 481 a security issue (as IPython is made to run arbitrary code anyway) it is not good
462 482 practice and we'd like to show the example. :ghissue:`12023`. This discussion
463 483 was started by ``@mschwager`` thanks to a new auditing tool they are working on
464 484 with duo-labs (`dlint <https://github.com/duo-labs/dlint>`_).
465 485
466 486 Work around some bugs in Python 3.9 tokenizer :ghpull:`12057`
467 487
468 488 IPython will now print its version after a crash. :ghpull:`11986`
469 489
470 490 This is likely the last release from the 7.x series that will see new feature.
471 491 The master branch will soon accept large code changes and thrilling new
472 492 features; the 7.x branch will only start to accept critical bug fixes, and
473 493 update dependencies.
474 494
475 495 .. _version 7102:
476 496
477 497 IPython 7.10.2
478 498 ==============
479 499
480 500 IPython 7.10.2 fix a couple of extra incompatibility between IPython, ipdb,
481 501 asyncio and Prompt Toolkit 3.
482 502
483 503 .. _version 7101:
484 504
485 505 IPython 7.10.1
486 506 ==============
487 507
488 508 IPython 7.10.1 fix a couple of incompatibilities with Prompt toolkit 3 (please
489 509 update Prompt toolkit to 3.0.2 at least), and fixes some interaction with
490 510 headless IPython.
491 511
492 512 .. _version 7100:
493 513
494 514 IPython 7.10.0
495 515 ==============
496 516
497 517 IPython 7.10 is the first double digit minor release in the last decade, and
498 518 first since the release of IPython 1.0, previous double digit minor release was
499 519 in August 2009.
500 520
501 521 We've been trying to give you regular release on the last Friday of every month
502 522 for a guaranty of rapid access to bug fixes and new features.
503 523
504 524 Unlike the previous first few releases that have seen only a couple of code
505 525 changes, 7.10 bring a number of changes, new features and bugfixes.
506 526
507 527 Stop Support for Python 3.5 – Adopt NEP 29
508 528 ------------------------------------------
509 529
510 530 IPython has decided to follow the informational `NEP 29
511 531 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`_ which layout a clear
512 532 policy as to which version of (C)Python and NumPy are supported.
513 533
514 534 We thus dropped support for Python 3.5, and cleaned up a number of code path
515 535 that were Python-version dependant. If you are on 3.5 or earlier pip should
516 536 automatically give you the latest compatible version of IPython so you do not
517 537 need to pin to a given version.
518 538
519 539 Support for Prompt Toolkit 3.0
520 540 ------------------------------
521 541
522 542 Prompt Toolkit 3.0 was release a week before IPython 7.10 and introduces a few
523 543 breaking changes. We believe IPython 7.10 should be compatible with both Prompt
524 544 Toolkit 2.x and 3.x, though it has not been extensively tested with 3.x so
525 545 please report any issues.
526 546
527 547
528 548 Prompt Rendering Performance improvements
529 549 -----------------------------------------
530 550
531 551 Pull Request :ghpull:`11933` introduced an optimisation in the prompt rendering
532 552 logic that should decrease the resource usage of IPython when using the
533 553 _default_ configuration but could potentially introduce a regression of
534 554 functionalities if you are using a custom prompt.
535 555
536 556 We know assume if you haven't changed the default keybindings that the prompt
537 557 **will not change** during the duration of your input – which is for example
538 558 not true when using vi insert mode that switches between `[ins]` and `[nor]`
539 559 for the current mode.
540 560
541 561 If you are experiencing any issue let us know.
542 562
543 563 Code autoformatting
544 564 -------------------
545 565
546 566 The IPython terminal can now auto format your code just before entering a new
547 567 line or executing a command. To do so use the
548 568 ``--TerminalInteractiveShell.autoformatter`` option and set it to ``'black'``;
549 569 if black is installed IPython will use black to format your code when possible.
550 570
551 571 IPython cannot always properly format your code; in particular it will
552 572 auto formatting with *black* will only work if:
553 573
554 574 - Your code does not contains magics or special python syntax.
555 575
556 576 - There is no code after your cursor.
557 577
558 578 The Black API is also still in motion; so this may not work with all versions of
559 579 black.
560 580
561 581 It should be possible to register custom formatter, though the API is till in
562 582 flux.
563 583
564 584 Arbitrary Mimetypes Handing in Terminal (Aka inline images in terminal)
565 585 -----------------------------------------------------------------------
566 586
567 587 When using IPython terminal it is now possible to register function to handle
568 588 arbitrary mimetypes. While rendering non-text based representation was possible in
569 589 many jupyter frontend; it was not possible in terminal IPython, as usually
570 590 terminal are limited to displaying text. As many terminal these days provide
571 591 escape sequences to display non-text; bringing this loved feature to IPython CLI
572 592 made a lot of sens. This functionality will not only allow inline images; but
573 593 allow opening of external program; for example ``mplayer`` to "display" sound
574 594 files.
575 595
576 596 So far only the hooks necessary for this are in place, but no default mime
577 597 renderers added; so inline images will only be available via extensions. We will
578 598 progressively enable these features by default in the next few releases, and
579 599 contribution is welcomed.
580 600
581 601 We welcome any feedback on the API. See :ref:`shell_mimerenderer` for more
582 602 informations.
583 603
584 604 This is originally based on work form in :ghpull:`10610` from @stephanh42
585 605 started over two years ago, and still a lot need to be done.
586 606
587 607 MISC
588 608 ----
589 609
590 610 - Completions can define their own ordering :ghpull:`11855`
591 611 - Enable Plotting in the same cell than the one that import matplotlib
592 612 :ghpull:`11916`
593 613 - Allow to store and restore multiple variables at once :ghpull:`11930`
594 614
595 615 You can see `all pull-requests <https://github.com/ipython/ipython/pulls?q=is%3Apr+milestone%3A7.10+is%3Aclosed>`_ for this release.
596 616
597 617 API Changes
598 618 -----------
599 619
600 620 Change of API and exposed objects automatically detected using `frappuccino <https://pypi.org/project/frappuccino/>`_ (still in beta):
601 621
602 622 The following items are new in IPython 7.10::
603 623
604 624 + IPython.terminal.shortcuts.reformat_text_before_cursor(buffer, document, shell)
605 625 + IPython.terminal.interactiveshell.PTK3
606 626 + IPython.terminal.interactiveshell.black_reformat_handler(text_before_cursor)
607 627 + IPython.terminal.prompts.RichPromptDisplayHook.write_format_data(self, format_dict, md_dict='None')
608 628
609 629 The following items have been removed in 7.10::
610 630
611 631 - IPython.lib.pretty.DICT_IS_ORDERED
612 632
613 633 The following signatures differ between versions::
614 634
615 635 - IPython.extensions.storemagic.restore_aliases(ip)
616 636 + IPython.extensions.storemagic.restore_aliases(ip, alias='None')
617 637
618 638 Special Thanks
619 639 --------------
620 640
621 641 - @stephanh42 who started the work on inline images in terminal 2 years ago
622 642 - @augustogoulart who spent a lot of time triaging issues and responding to
623 643 users.
624 644 - @con-f-use who is my (@Carreau) first sponsor on GitHub, as a reminder if you
625 645 like IPython, Jupyter and many other library of the SciPy stack you can
626 646 donate to numfocus.org non profit
627 647
628 648 .. _version 790:
629 649
630 650 IPython 7.9.0
631 651 =============
632 652
633 653 IPython 7.9 is a small release with a couple of improvement and bug fixes.
634 654
635 655 - Xterm terminal title should be restored on exit :ghpull:`11910`
636 656 - special variables ``_``,``__``, ``___`` are not set anymore when cache size
637 657 is 0 or less. :ghpull:`11877`
638 658 - Autoreload should have regained some speed by using a new heuristic logic to
639 659 find all objects needing reload. This should avoid large objects traversal
640 660 like pandas dataframes. :ghpull:`11876`
641 661 - Get ready for Python 4. :ghpull:`11874`
642 662 - `%env` Magic now has heuristic to hide potentially sensitive values :ghpull:`11896`
643 663
644 664 This is a small release despite a number of Pull Request Pending that need to
645 665 be reviewed/worked on. Many of the core developers have been busy outside of
646 666 IPython/Jupyter and we thanks all contributor for their patience; we'll work on
647 667 these as soon as we have time.
648 668
649 669
650 670 .. _version780:
651 671
652 672 IPython 7.8.0
653 673 =============
654 674
655 675 IPython 7.8.0 contain a few bugfix and 2 new APIs:
656 676
657 677 - Enable changing the font color for LaTeX rendering :ghpull:`11840`
658 678 - and Re-Expose some PDB API (see below)
659 679
660 680 Expose Pdb API
661 681 --------------
662 682
663 683 Expose the built-in ``pdb.Pdb`` API. ``Pdb`` constructor arguments are generically
664 684 exposed, regardless of python version.
665 685 Newly exposed arguments:
666 686
667 687 - ``skip`` - Python 3.1+
668 688 - ``nosiginnt`` - Python 3.2+
669 689 - ``readrc`` - Python 3.6+
670 690
671 691 Try it out::
672 692
673 693 from IPython.terminal.debugger import TerminalPdb
674 694 pdb = TerminalPdb(skip=["skipthismodule"])
675 695
676 696
677 697 See :ghpull:`11840`
678 698
679 699 .. _version770:
680 700
681 701 IPython 7.7.0
682 702 =============
683 703
684 704 IPython 7.7.0 contain multiple bug fixes and documentation updates; Here are a
685 705 few of the outstanding issue fixed:
686 706
687 707 - Fix a bug introduced in 7.6 where the ``%matplotlib`` magic would fail on
688 708 previously acceptable arguments :ghpull:`11814`.
689 709 - Fix the manage location on freebsd :ghpull:`11808`.
690 710 - Fix error message about aliases after ``%reset`` call in ipykernel
691 711 :ghpull:`11806`
692 712 - Fix Duplication completions in emacs :ghpull:`11803`
693 713
694 714 We are planning to adopt `NEP29 <https://github.com/numpy/numpy/pull/14086>`_
695 715 (still currently in draft) which may make this minor version of IPython the
696 716 last one to support Python 3.5 and will make the code base more aggressive
697 717 toward removing compatibility with older versions of Python.
698 718
699 719 GitHub now support to give only "Triage" permissions to users; if you'd like to
700 720 help close stale issues and labels issues please reach to us with your GitHub
701 721 Username and we'll add you to the triage team. It is a great way to start
702 722 contributing and a path toward getting commit rights.
703 723
704 724 .. _version761:
705 725
706 726 IPython 7.6.1
707 727 =============
708 728
709 729 IPython 7.6.1 contain a critical bugfix in the ``%timeit`` magic, which would
710 730 crash on some inputs as a side effect of :ghpull:`11716`. See :ghpull:`11812`
711 731
712 732
713 733 .. _whatsnew760:
714 734
715 735 IPython 7.6.0
716 736 =============
717 737
718 738 IPython 7.6.0 contains a couple of bug fixes and number of small features
719 739 additions as well as some compatibility with the current development version of
720 740 Python 3.8.
721 741
722 742 - Add a ``-l`` option to :magic:`psearch` to list the available search
723 743 types. :ghpull:`11672`
724 744 - Support ``PathLike`` for ``DisplayObject`` and ``Image``. :ghpull:`11764`
725 745 - Configurability of timeout in the test suite for slow platforms.
726 746 :ghpull:`11756`
727 747 - Accept any casing for matplotlib backend. :ghpull:`121748`
728 748 - Properly skip test that requires numpy to be installed :ghpull:`11723`
729 749 - More support for Python 3.8 and positional only arguments (pep570)
730 750 :ghpull:`11720`
731 751 - Unicode names for the completion are loaded lazily on first use which
732 752 should decrease startup time. :ghpull:`11693`
733 753 - Autoreload now update the types of reloaded objects; this for example allow
734 754 pickling of reloaded objects. :ghpull:`11644`
735 755 - Fix a bug where ``%%time`` magic would suppress cell output. :ghpull:`11716`
736 756
737 757
738 758 Prepare migration to pytest (instead of nose) for testing
739 759 ---------------------------------------------------------
740 760
741 761 Most of the work between 7.5 and 7.6 was to prepare the migration from our
742 762 testing framework to pytest. Most of the test suite should now work by simply
743 763 issuing ``pytest`` from the root of the repository.
744 764
745 765 The migration to pytest is just at its beginning. Many of our test still rely
746 766 on IPython-specific plugins for nose using pytest (doctest using IPython syntax
747 767 is one example of this where test appear as "passing", while no code has been
748 768 ran). Many test also need to be updated like ``yield-test`` to be properly
749 769 parametrized tests.
750 770
751 771 Migration to pytest allowed me to discover a number of issues in our test
752 772 suite; which was hiding a number of subtle issues – or not actually running
753 773 some of the tests in our test suite – I have thus corrected many of those; like
754 774 improperly closed resources; or used of deprecated features. I also made use of
755 775 the ``pytest --durations=...`` to find some of our slowest test and speed them
756 776 up (our test suite can now be up to 10% faster). Pytest as also a variety of
757 777 plugins and flags which will make the code quality of IPython and the testing
758 778 experience better.
759 779
760 780 Misc
761 781 ----
762 782
763 783 We skipped the release of 7.6 at the end of May, but will attempt to get back
764 784 on schedule. We are starting to think about making introducing backward
765 785 incompatible change and start the 8.0 series.
766 786
767 787 Special Thanks to Gabriel (@gpotter2 on GitHub), who among other took care many
768 788 of the remaining task for 7.4 and 7.5, like updating the website.
769 789
770 790 .. _whatsnew750:
771 791
772 792 IPython 7.5.0
773 793 =============
774 794
775 795 IPython 7.5.0 consist mostly of bug-fixes, and documentation updates, with one
776 796 minor new feature. The `Audio` display element can now be assigned an element
777 797 id when displayed in browser. See :ghpull:`11670`
778 798
779 799 The major outstanding bug fix correct a change of behavior that was introduce
780 800 in 7.4.0 where some cell magics would not be able to access or modify global
781 801 scope when using the ``@needs_local_scope`` decorator. This was typically
782 802 encountered with the ``%%time`` and ``%%timeit`` magics. See :ghissue:`11659`
783 803 and :ghpull:`11698`.
784 804
785 805 .. _whatsnew740:
786 806
787 807 IPython 7.4.0
788 808 =============
789 809
790 810 Unicode name completions
791 811 ------------------------
792 812
793 813 Previously, we provided completion for a unicode name with its relative symbol.
794 814 With this, now IPython provides complete suggestions to unicode name symbols.
795 815
796 816 As on the PR, if user types ``\LAT<tab>``, IPython provides a list of
797 817 possible completions. In this case, it would be something like::
798 818
799 819 'LATIN CAPITAL LETTER A',
800 820 'LATIN CAPITAL LETTER B',
801 821 'LATIN CAPITAL LETTER C',
802 822 'LATIN CAPITAL LETTER D',
803 823 ....
804 824
805 825 This help to type unicode character that do not have short latex aliases, and
806 826 have long unicode names. for example ``Ν°``, ``\GREEK CAPITAL LETTER HETA``.
807 827
808 828 This feature was contributed by Luciana Marques :ghpull:`11583`.
809 829
810 830 Make audio normalization optional
811 831 ---------------------------------
812 832
813 833 Added 'normalize' argument to `IPython.display.Audio`. This argument applies
814 834 when audio data is given as an array of samples. The default of `normalize=True`
815 835 preserves prior behavior of normalizing the audio to the maximum possible range.
816 836 Setting to `False` disables normalization.
817 837
818 838
819 839 Miscellaneous
820 840 -------------
821 841
822 842 - Fix improper acceptation of ``return`` outside of functions. :ghpull:`11641`.
823 843 - Fixed PyQt 5.11 backwards incompatibility causing sip import failure.
824 844 :ghpull:`11613`.
825 845 - Fix Bug where ``type?`` would crash IPython. :ghpull:`1608`.
826 846 - Allow to apply ``@needs_local_scope`` to cell magics for convenience.
827 847 :ghpull:`11542`.
828 848
829 849 .. _whatsnew730:
830 850
831 851 IPython 7.3.0
832 852 =============
833 853
834 854 .. _whatsnew720:
835 855
836 856 IPython 7.3.0 bring several bug fixes and small improvements that you will
837 857 described bellow.
838 858
839 859 The biggest change to this release is the implementation of the ``%conda`` and
840 860 ``%pip`` magics, that will attempt to install packages in the **current
841 861 environment**. You may still need to restart your interpreter or kernel for the
842 862 change to be taken into account, but it should simplify installation of packages
843 863 into remote environment. Installing using pip/conda from the command line is
844 864 still the prefer method.
845 865
846 866 The ``%pip`` magic was already present, but was only printing a warning; now it
847 867 will actually forward commands to pip.
848 868
849 869 Misc bug fixes and improvements:
850 870
851 871 - Compatibility with Python 3.8.
852 872 - Do not expand shell variable in execution magics, and added the
853 873 ``no_var_expand`` decorator for magic requiring a similar functionality
854 874 :ghpull:`11516`
855 875 - Add ``%pip`` and ``%conda`` magic :ghpull:`11524`
856 876 - Re-initialize posix aliases after a ``%reset`` :ghpull:`11528`
857 877 - Allow the IPython command line to run ``*.ipynb`` files :ghpull:`11529`
858 878
859 879 IPython 7.2.0
860 880 =============
861 881
862 882 IPython 7.2.0 brings minor bugfixes, improvements, and new configuration options:
863 883
864 884 - Fix a bug preventing PySide2 GUI integration from working :ghpull:`11464`
865 885 - Run CI on Mac OS ! :ghpull:`11471`
866 886 - Fix IPython "Demo" mode. :ghpull:`11498`
867 887 - Fix ``%run`` magic with path in name :ghpull:`11499`
868 888 - Fix: add CWD to sys.path *after* stdlib :ghpull:`11502`
869 889 - Better rendering of signatures, especially long ones. :ghpull:`11505`
870 890 - Re-enable jedi by default if it's installed :ghpull:`11506`
871 891 - Add New ``minimal`` exception reporting mode (useful for educational purpose). See :ghpull:`11509`
872 892
873 893
874 894 Added ability to show subclasses when using pinfo and other utilities
875 895 ---------------------------------------------------------------------
876 896
877 897 When using ``?``/``??`` on a class, IPython will now list the first 10 subclasses.
878 898
879 899 Special Thanks to Chris Mentzel of the Moore Foundation for this feature. Chris
880 900 is one of the people who played a critical role in IPython/Jupyter getting
881 901 funding.
882 902
883 903 We are grateful for all the help Chris has given us over the years,
884 904 and we're now proud to have code contributed by Chris in IPython.
885 905
886 906 OSMagics.cd_force_quiet configuration option
887 907 --------------------------------------------
888 908
889 909 You can set this option to force the %cd magic to behave as if ``-q`` was passed:
890 910 ::
891 911
892 912 In [1]: cd /
893 913 /
894 914
895 915 In [2]: %config OSMagics.cd_force_quiet = True
896 916
897 917 In [3]: cd /tmp
898 918
899 919 In [4]:
900 920
901 921 See :ghpull:`11491`
902 922
903 923 In vi editing mode, whether the prompt includes the current vi mode can now be configured
904 924 -----------------------------------------------------------------------------------------
905 925
906 926 Set the ``TerminalInteractiveShell.prompt_includes_vi_mode`` to a boolean value
907 927 (default: True) to control this feature. See :ghpull:`11492`
908 928
909 929 .. _whatsnew710:
910 930
911 931 IPython 7.1.0
912 932 =============
913 933
914 934 IPython 7.1.0 is the first minor release after 7.0.0 and mostly brings fixes to
915 935 new features, internal refactoring, and fixes for regressions that happened during the 6.x->7.x
916 936 transition. It also brings **Compatibility with Python 3.7.1**, as we're
917 937 unwillingly relying on a bug in CPython.
918 938
919 939 New Core Dev:
920 940
921 941 - We welcome Jonathan Slenders to the commiters. Jonathan has done a fantastic
922 942 work on prompt_toolkit, and we'd like to recognise his impact by giving him
923 943 commit rights. :ghissue:`11397`
924 944
925 945 Notable Changes
926 946
927 947 - Major update of "latex to unicode" tab completion map (see below)
928 948
929 949 Notable New Features:
930 950
931 951 - Restore functionality and documentation of the **sphinx directive**, which
932 952 is now stricter (fail on error by daefault), has new configuration options,
933 953 has a brand new documentation page :ref:`ipython_directive` (which needs
934 954 some cleanup). It is also now *tested* so we hope to have less regressions.
935 955 :ghpull:`11402`
936 956
937 957 - ``IPython.display.Video`` now supports ``width`` and ``height`` arguments,
938 958 allowing a custom width and height to be set instead of using the video's
939 959 width and height. :ghpull:`11353`
940 960
941 961 - Warn when using ``HTML('<iframe>')`` instead of ``IFrame`` :ghpull:`11350`
942 962
943 963 - Allow Dynamic switching of editing mode between vi/emacs and show
944 964 normal/input mode in prompt when using vi. :ghpull:`11390`. Use ``%config
945 965 TerminalInteractiveShell.editing_mode = 'vi'`` or ``%config
946 966 TerminalInteractiveShell.editing_mode = 'emacs'`` to dynamically switch
947 967 between modes.
948 968
949 969
950 970 Notable Fixes:
951 971
952 972 - Fix entering of **multi-line blocks in terminal** IPython, and various
953 973 crashes in the new input transformation machinery :ghpull:`11354`,
954 974 :ghpull:`11356`, :ghpull:`11358`. These also fix a **Compatibility bug
955 975 with Python 3.7.1**.
956 976
957 977 - Fix moving through generator stack in ipdb :ghpull:`11266`
958 978
959 979 - %Magic command arguments now support quoting. :ghpull:`11330`
960 980
961 981 - Re-add ``rprint`` and ``rprinte`` aliases. :ghpull:`11331`
962 982
963 983 - Remove implicit dependency on ``ipython_genutils`` :ghpull:`11317`
964 984
965 985 - Make ``nonlocal`` raise ``SyntaxError`` instead of silently failing in async
966 986 mode. :ghpull:`11382`
967 987
968 988 - Fix mishandling of magics and ``= !`` assignment just after a dedent in
969 989 nested code blocks :ghpull:`11418`
970 990
971 991 - Fix instructions for custom shortcuts :ghpull:`11426`
972 992
973 993
974 994 Notable Internals improvements:
975 995
976 996 - Use of ``os.scandir`` (Python 3 only) to speed up some file system operations.
977 997 :ghpull:`11365`
978 998
979 999 - use ``perf_counter`` instead of ``clock`` for more precise
980 1000 timing results with ``%time`` :ghpull:`11376`
981 1001
982 1002 Many thanks to all the contributors and in particular to ``bartskowron`` and
983 1003 ``tonyfast`` who handled some pretty complicated bugs in the input machinery. We
984 1004 had a number of first time contributors and maybe hacktoberfest participants that
985 1005 made significant contributions and helped us free some time to focus on more
986 1006 complicated bugs.
987 1007
988 1008 You
989 1009 can see all the closed issues and Merged PR, new features and fixes `here
990 1010 <https://github.com/ipython/ipython/issues?utf8=%E2%9C%93&q=+is%3Aclosed+milestone%3A7.1+>`_.
991 1011
992 1012 Unicode Completion update
993 1013 -------------------------
994 1014
995 1015 In IPython 7.1 the Unicode completion map has been updated and synchronized with
996 1016 the Julia language.
997 1017
998 1018 Added and removed character characters:
999 1019
1000 1020 ``\jmath`` (``Θ·``), ``\\underleftrightarrow`` (U+034D, combining) have been
1001 1021 added, while ``\\textasciicaron`` have been removed
1002 1022
1003 1023 Some sequences have seen their prefix removed:
1004 1024
1005 1025 - 6 characters ``\text...<tab>`` should now be inputed with ``\...<tab>`` directly,
1006 1026 - 45 characters ``\Elz...<tab>`` should now be inputed with ``\...<tab>`` directly,
1007 1027 - 65 characters ``\B...<tab>`` should now be inputed with ``\...<tab>`` directly,
1008 1028 - 450 characters ``\m...<tab>`` should now be inputed with ``\...<tab>`` directly,
1009 1029
1010 1030 Some sequences have seen their prefix shortened:
1011 1031
1012 1032 - 5 characters ``\mitBbb...<tab>`` should now be inputed with ``\bbi...<tab>`` directly,
1013 1033 - 52 characters ``\mit...<tab>`` should now be inputed with ``\i...<tab>`` directly,
1014 1034 - 216 characters ``\mbfit...<tab>`` should now be inputed with ``\bi...<tab>`` directly,
1015 1035 - 222 characters ``\mbf...<tab>`` should now be inputed with ``\b...<tab>`` directly,
1016 1036
1017 1037 A couple of characters had their sequence simplified:
1018 1038
1019 1039 - ``Γ°``, type ``\dh<tab>``, instead of ``\eth<tab>``
1020 1040 - ``Δ§``, type ``\hbar<tab>``, instead of ``\Elzxh<tab>``
1021 1041 - ``ΙΈ``, type ``\ltphi<tab>``, instead of ``\textphi<tab>``
1022 1042 - ``Ο΄``, type ``\varTheta<tab>``, instead of ``\textTheta<tab>``
1023 1043 - ``ℇ``, type ``\eulermascheroni<tab>``, instead of ``\Eulerconst<tab>``
1024 1044 - ``β„Ž``, type ``\planck<tab>``, instead of ``\Planckconst<tab>``
1025 1045
1026 1046 - U+0336 (COMBINING LONG STROKE OVERLAY), type ``\strike<tab>``, instead of ``\Elzbar<tab>``.
1027 1047
1028 1048 A couple of sequences have been updated:
1029 1049
1030 1050 - ``\varepsilon`` now gives ``Ι›`` (GREEK SMALL LETTER EPSILON) instead of ``Ξ΅`` (GREEK LUNATE EPSILON SYMBOL),
1031 1051 - ``\underbar`` now gives U+0331 (COMBINING MACRON BELOW) instead of U+0332 (COMBINING LOW LINE).
1032 1052
1033 1053
1034 1054 .. _whatsnew700:
1035 1055
1036 1056 IPython 7.0.0
1037 1057 =============
1038 1058
1039 1059 Released Thursday September 27th, 2018
1040 1060
1041 1061 IPython 7 includes major feature improvements.
1042 1062 This is also the second major version of IPython to support only
1043 1063 Python 3 – starting at Python 3.4. Python 2 is still community-supported
1044 1064 on the bugfix only 5.x branch, but we remind you that Python 2 "end of life"
1045 1065 is on Jan 1st 2020.
1046 1066
1047 1067 We were able to backport bug fixes to the 5.x branch thanks to our backport bot which
1048 1068 backported more than `70 Pull-Requests
1049 1069 <https://github.com/ipython/ipython/pulls?page=3&q=is%3Apr+sort%3Aupdated-desc+author%3Aapp%2Fmeeseeksdev++5.x&utf8=%E2%9C%93>`_, but there are still many PRs that required manual work. This is an area of the project where you can easily contribute by looking for `PRs that still need manual backport <https://github.com/ipython/ipython/issues?q=label%3A%22Still+Needs+Manual+Backport%22+is%3Aclosed+sort%3Aupdated-desc>`_
1050 1070
1051 1071 The IPython 6.x branch will likely not see any further release unless critical
1052 1072 bugs are found.
1053 1073
1054 1074 Make sure you have pip > 9.0 before upgrading. You should be able to update by running:
1055 1075
1056 1076 .. code::
1057 1077
1058 1078 pip install ipython --upgrade
1059 1079
1060 1080 .. only:: ipydev
1061 1081
1062 1082 If you are trying to install or update an ``alpha``, ``beta``, or ``rc``
1063 1083 version, use pip ``--pre`` flag.
1064 1084
1065 1085 .. code::
1066 1086
1067 1087 pip install ipython --upgrade --pre
1068 1088
1069 1089
1070 1090 Or, if you have conda installed:
1071 1091
1072 1092 .. code::
1073 1093
1074 1094 conda install ipython
1075 1095
1076 1096
1077 1097
1078 1098 Prompt Toolkit 2.0
1079 1099 ------------------
1080 1100
1081 1101 IPython 7.0+ now uses ``prompt_toolkit 2.0``. If you still need to use an earlier
1082 1102 ``prompt_toolkit`` version, you may need to pin IPython to ``<7.0``.
1083 1103
1084 1104 Autowait: Asynchronous REPL
1085 1105 ---------------------------
1086 1106
1087 1107 Staring with IPython 7.0 on Python 3.6+, IPython can automatically ``await``
1088 1108 top level code. You should not need to access an event loop or runner
1089 1109 yourself. To learn more, read the :ref:`autoawait` section of our docs, see
1090 1110 :ghpull:`11265`, or try the following code::
1091 1111
1092 1112 Python 3.6.0
1093 1113 Type 'copyright', 'credits' or 'license' for more information
1094 1114 IPython 7.0.0 -- An enhanced Interactive Python. Type '?' for help.
1095 1115
1096 1116 In [1]: import aiohttp
1097 1117 ...: result = aiohttp.get('https://api.github.com')
1098 1118
1099 1119 In [2]: response = await result
1100 1120 <pause for a few 100s ms>
1101 1121
1102 1122 In [3]: await response.json()
1103 1123 Out[3]:
1104 1124 {'authorizations_url': 'https://api.github.com/authorizations',
1105 1125 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}',
1106 1126 ...
1107 1127 }
1108 1128
1109 1129 .. note::
1110 1130
1111 1131 Async integration is experimental code, behavior may change or be removed
1112 1132 between Python and IPython versions without warnings.
1113 1133
1114 1134 Integration is by default with `asyncio`, but other libraries can be configured --
1115 1135 like ``curio`` or ``trio`` -- to improve concurrency in the REPL::
1116 1136
1117 1137 In [1]: %autoawait trio
1118 1138
1119 1139 In [2]: import trio
1120 1140
1121 1141 In [3]: async def child(i):
1122 1142 ...: print(" child %s goes to sleep"%i)
1123 1143 ...: await trio.sleep(2)
1124 1144 ...: print(" child %s wakes up"%i)
1125 1145
1126 1146 In [4]: print('parent start')
1127 1147 ...: async with trio.open_nursery() as n:
1128 1148 ...: for i in range(3):
1129 1149 ...: n.spawn(child, i)
1130 1150 ...: print('parent end')
1131 1151 parent start
1132 1152 child 2 goes to sleep
1133 1153 child 0 goes to sleep
1134 1154 child 1 goes to sleep
1135 1155 <about 2 seconds pause>
1136 1156 child 2 wakes up
1137 1157 child 1 wakes up
1138 1158 child 0 wakes up
1139 1159 parent end
1140 1160
1141 1161 See :ref:`autoawait` for more information.
1142 1162
1143 1163
1144 1164 Asynchronous code in a Notebook interface or any other frontend using the
1145 1165 Jupyter Protocol will require further updates to the IPykernel package.
1146 1166
1147 1167 Non-Asynchronous code
1148 1168 ~~~~~~~~~~~~~~~~~~~~~
1149 1169
1150 1170 As the internal API of IPython is now asynchronous, IPython needs to run under
1151 1171 an event loop. In order to allow many workflows, (like using the :magic:`%run`
1152 1172 magic, or copy-pasting code that explicitly starts/stop event loop), when
1153 1173 top-level code is detected as not being asynchronous, IPython code is advanced
1154 1174 via a pseudo-synchronous runner, and may not advance pending tasks.
1155 1175
1156 1176 Change to Nested Embed
1157 1177 ~~~~~~~~~~~~~~~~~~~~~~
1158 1178
1159 1179 The introduction of the ability to run async code had some effect on the
1160 1180 ``IPython.embed()`` API. By default, embed will not allow you to run asynchronous
1161 1181 code unless an event loop is specified.
1162 1182
1163 1183 Effects on Magics
1164 1184 ~~~~~~~~~~~~~~~~~
1165 1185
1166 1186 Some magics will not work with async until they're updated.
1167 1187 Contributions welcome.
1168 1188
1169 1189 Expected Future changes
1170 1190 ~~~~~~~~~~~~~~~~~~~~~~~
1171 1191
1172 1192 We expect more internal but public IPython functions to become ``async``, and
1173 1193 will likely end up having a persistent event loop while IPython is running.
1174 1194
1175 1195 Thanks
1176 1196 ~~~~~~
1177 1197
1178 1198 This release took more than a year in the making.
1179 1199 The code was rebased a number of
1180 1200 times; leading to commit authorship that may have been lost in the final
1181 1201 Pull-Request. Huge thanks to many people for contribution, discussion, code,
1182 1202 documentation, use-cases: dalejung, danielballan, ellisonbg, fperez, gnestor,
1183 1203 minrk, njsmith, pganssle, tacaswell, takluyver , vidartf ... And many others.
1184 1204
1185 1205
1186 1206 Autoreload Improvement
1187 1207 ----------------------
1188 1208
1189 1209 The magic :magic:`%autoreload 2 <autoreload>` now captures new methods added to
1190 1210 classes. Earlier, only methods existing as of the initial import were being
1191 1211 tracked and updated.
1192 1212
1193 1213 This new feature helps dual environment development - Jupyter+IDE - where the
1194 1214 code gradually moves from notebook cells to package files as it gets
1195 1215 structured.
1196 1216
1197 1217 **Example**: An instance of the class ``MyClass`` will be able to access the
1198 1218 method ``cube()`` after it is uncommented and the file ``file1.py`` is saved on
1199 1219 disk.
1200 1220
1201 1221
1202 1222 .. code::
1203 1223
1204 1224 # notebook
1205 1225
1206 1226 from mymodule import MyClass
1207 1227 first = MyClass(5)
1208 1228
1209 1229 .. code::
1210 1230
1211 1231 # mymodule/file1.py
1212 1232
1213 1233 class MyClass:
1214 1234
1215 1235 def __init__(self, a=10):
1216 1236 self.a = a
1217 1237
1218 1238 def square(self):
1219 1239 print('compute square')
1220 1240 return self.a*self.a
1221 1241
1222 1242 # def cube(self):
1223 1243 # print('compute cube')
1224 1244 # return self.a*self.a*self.a
1225 1245
1226 1246
1227 1247
1228 1248
1229 1249 Misc
1230 1250 ----
1231 1251
1232 1252 The autoindent feature that was deprecated in 5.x was re-enabled and
1233 1253 un-deprecated in :ghpull:`11257`
1234 1254
1235 1255 Make :magic:`%run -n -i ... <run>` work correctly. Earlier, if :magic:`%run` was
1236 1256 passed both arguments, ``-n`` would be silently ignored. See :ghpull:`10308`
1237 1257
1238 1258
1239 1259 The :cellmagic:`%%script` (as well as :cellmagic:`%%bash`,
1240 1260 :cellmagic:`%%ruby`... ) cell magics now raise by default if the return code of
1241 1261 the given code is non-zero (thus halting execution of further cells in a
1242 1262 notebook). The behavior can be disable by passing the ``--no-raise-error`` flag.
1243 1263
1244 1264
1245 1265 Deprecations
1246 1266 ------------
1247 1267
1248 1268 A couple of unused functions and methods have been deprecated and will be removed
1249 1269 in future versions:
1250 1270
1251 1271 - ``IPython.utils.io.raw_print_err``
1252 1272 - ``IPython.utils.io.raw_print``
1253 1273
1254 1274
1255 1275 Backwards incompatible changes
1256 1276 ------------------------------
1257 1277
1258 1278 * The API for transforming input before it is parsed as Python code has been
1259 1279 completely redesigned: any custom input transformations will need to be
1260 1280 rewritten. See :doc:`/config/inputtransforms` for details of the new API.
General Comments 0
You need to be logged in to leave comments. Login now