Show More
@@ -1,547 +1,552 b'' | |||
|
1 | 1 | ============ |
|
2 | 2 | 7.x Series |
|
3 | 3 | ============ |
|
4 | 4 | |
|
5 | 5 | .. _whatsnew760: |
|
6 | 6 | |
|
7 | 7 | IPython 7.6.0 |
|
8 | 8 | ============= |
|
9 | 9 | |
|
10 | 10 | IPython 7.6.0 contains a couple of bug fixes and number of small features |
|
11 | 11 | additions as well as some compatibility with the current development version of |
|
12 | 12 | Python 3.8. |
|
13 | 13 | |
|
14 | 14 | - Add a ``-l`` option to :magic:`psearch` to list the available search |
|
15 | 15 | types. :ghpull:`11672` |
|
16 | 16 | - Support ``PathLike`` for ``DisplayObject`` and ``Image``. :ghpull:`11764` |
|
17 | 17 | - Configurability of timeout in the test suite for slow platforms. |
|
18 | 18 | :ghpull:`11756` |
|
19 | 19 | - Accept any casing for matplotlib backend. :ghpull:`121748` |
|
20 | 20 | - Properly skip test that requires numpy to be installed :ghpull:`11723` |
|
21 | 21 | - More support for Python 3.8 and positional only arguments (pep570) |
|
22 | 22 | :ghpull:`11720` |
|
23 | 23 | - Unicode names for the completion are loaded lazily on first use which |
|
24 | 24 | should decrease startup time. :ghpull:`11693` |
|
25 |
- Autoreload now |
|
|
25 | - Autoreload now update the types of reloaded objects; this for example allow | |
|
26 | 26 | pickling of reloaded objects. :ghpull:`11644` |
|
27 | - Fix a big where ``%%time`` magic would suppress cell output. :ghpull:`11716` | |
|
27 | 28 | |
|
28 | 29 | |
|
29 | 30 | Prepare migration to pytest (instead of nose) for testing |
|
30 | 31 | --------------------------------------------------------- |
|
31 | 32 | |
|
32 | 33 | Most of the work between 7.5 and 7.6 was to prepare the migration from our |
|
33 | 34 | testing framework to pytest. Most of the test suite should now work by simply |
|
34 | 35 | issuing ``pytest`` from the root of the repository. |
|
35 | 36 | |
|
36 | 37 | The migration to pytest is just at its beginning. Many of our test still rely |
|
37 | 38 | on IPython-specific plugins for nose using pytest (doctest using IPython syntax |
|
38 | 39 | is one example of this where test appear as "passing", while no code has been |
|
39 | 40 | ran). Many test also need to be updated like ``yield-test`` to be properly |
|
40 | 41 | parametrized tests. |
|
41 | 42 | |
|
42 | 43 | Migration to pytest allowed me to discover a number of issues in our test |
|
43 | 44 | suite; which was hiding a number of subtle issues βΒ or not actually running |
|
44 | 45 | some of the tests in our test suite β I have thus corrected many of those; like |
|
45 | 46 | improperly closed resources; or used of deprecated features. I also made use of |
|
46 | 47 | the ``pytest --durations=...`` to find some of our slowest test and speed them |
|
47 | 48 | up (our test suite can now be up to 10% faster). Pytest as also a variety of |
|
48 | 49 | plugins and flags which will make the code quality of IPython and the testing |
|
49 | 50 | experience better. |
|
50 | 51 | |
|
51 | 52 | Misc |
|
52 | 53 | ---- |
|
53 | 54 | |
|
55 | We skipped the release of 7.6 at the end of May, but will attempt to get back | |
|
56 | on schedule. We are starting to think about making introducing backward | |
|
57 | incompatible change and start the 8.0 series. | |
|
58 | ||
|
54 | 59 | Special Thanks to Gabriel (@gpotter2 on GitHub), who among other took care many |
|
55 | 60 | of the remaining task for 7.4 and 7.5, like updating the website. |
|
56 | 61 | |
|
57 | 62 | .. _whatsnew750: |
|
58 | 63 | |
|
59 | 64 | IPython 7.5.0 |
|
60 | 65 | ============= |
|
61 | 66 | |
|
62 | 67 | IPython 7.5.0 consist mostly of bug-fixes, and documentation updates, with one |
|
63 | 68 | minor new feature. The `Audio` display element can now be assigned an element |
|
64 | 69 | id when displayed in browser. See :ghpull:`11670` |
|
65 | 70 | |
|
66 | 71 | The major outstanding bug fix correct a change of behavior that was introduce |
|
67 | 72 | in 7.4.0 where some cell magics would not be able to access or modify global |
|
68 | 73 | scope when using the ``@needs_local_scope`` decorator. This was typically |
|
69 | 74 | encountered with the ``%%time`` and ``%%timeit`` magics. See :ghissue:`11659` |
|
70 | 75 | and :ghpull:`11698`. |
|
71 | 76 | |
|
72 | 77 | .. _whatsnew740: |
|
73 | 78 | |
|
74 | 79 | IPython 7.4.0 |
|
75 | 80 | ============= |
|
76 | 81 | |
|
77 | 82 | Unicode name completions |
|
78 | 83 | ------------------------ |
|
79 | 84 | |
|
80 | 85 | Previously, we provided completion for a unicode name with its relative symbol. |
|
81 | 86 | With this, now IPython provides complete suggestions to unicode name symbols. |
|
82 | 87 | |
|
83 | 88 | As on the PR, if user types ``\LAT<tab>``, IPython provides a list of |
|
84 | 89 | possible completions. In this case, it would be something like:: |
|
85 | 90 | |
|
86 | 91 | 'LATIN CAPITAL LETTER A', |
|
87 | 92 | 'LATIN CAPITAL LETTER B', |
|
88 | 93 | 'LATIN CAPITAL LETTER C', |
|
89 | 94 | 'LATIN CAPITAL LETTER D', |
|
90 | 95 | .... |
|
91 | 96 | |
|
92 | 97 | This help to type unicode character that do not have short latex aliases, and |
|
93 | 98 | have long unicode names. for example ``Ν°``, ``\GREEK CAPITAL LETTER HETA``. |
|
94 | 99 | |
|
95 | 100 | This feature was contributed by Luciana Marques :ghpull:`11583`. |
|
96 | 101 | |
|
97 | 102 | Make audio normalization optional |
|
98 | 103 | --------------------------------- |
|
99 | 104 | |
|
100 | 105 | Added 'normalize' argument to `IPython.display.Audio`. This argument applies |
|
101 | 106 | when audio data is given as an array of samples. The default of `normalize=True` |
|
102 | 107 | preserves prior behavior of normalizing the audio to the maximum possible range. |
|
103 | 108 | Setting to `False` disables normalization. |
|
104 | 109 | |
|
105 | 110 | |
|
106 | 111 | Miscelanious |
|
107 | 112 | ------------ |
|
108 | 113 | |
|
109 | 114 | - Fix improper acceptation of ``return`` outside of functions. :ghpull:`11641`. |
|
110 | 115 | - Fixed PyQt 5.11 backwards incompatibility causing sip import failure. |
|
111 | 116 | :ghpull:`11613`. |
|
112 | 117 | - Fix Bug where ``type?`` would crash IPython. :ghpull:`1608`. |
|
113 | 118 | - Allow to apply ``@needs_local_scope`` to cell magics for convenience. |
|
114 | 119 | :ghpull:`11542`. |
|
115 | 120 | |
|
116 | 121 | .. _whatsnew730: |
|
117 | 122 | |
|
118 | 123 | IPython 7.3.0 |
|
119 | 124 | ============= |
|
120 | 125 | |
|
121 | 126 | .. _whatsnew720: |
|
122 | 127 | |
|
123 | 128 | IPython 7.3.0 bring several bug fixes and small improvements that you will |
|
124 | 129 | described bellow. |
|
125 | 130 | |
|
126 | 131 | The biggest change to this release is the implementation of the ``%conda`` and |
|
127 | 132 | ``%pip`` magics, that will attempt to install packages in the **current |
|
128 | 133 | environment**. You may still need to restart your interpreter or kernel for the |
|
129 | 134 | change to be taken into account, but it should simplify installation of packages |
|
130 | 135 | into remote environment. Installing using pip/conda from the command line is |
|
131 | 136 | still the prefer method. |
|
132 | 137 | |
|
133 | 138 | The ``%pip`` magic was already present, but was only printing a warning; now it |
|
134 | 139 | will actually forward commands to pip. |
|
135 | 140 | |
|
136 | 141 | Misc bug fixes and improvements: |
|
137 | 142 | |
|
138 | 143 | - Compatibility with Python 3.8. |
|
139 | 144 | - Do not expand shell variable in execution magics, and added the |
|
140 | 145 | ``no_var_expand`` decorator for magic requiring a similar functionality |
|
141 | 146 | :ghpull:`11516` |
|
142 | 147 | - Add ``%pip`` and ``%conda`` magic :ghpull:`11524` |
|
143 | 148 | - Re-initialize posix aliases after a ``%reset`` :ghpull:`11528` |
|
144 | 149 | - Allow the IPython command line to run ``*.ipynb`` files :ghpull:`11529` |
|
145 | 150 | |
|
146 | 151 | IPython 7.2.0 |
|
147 | 152 | ============= |
|
148 | 153 | |
|
149 | 154 | IPython 7.2.0 brings minor bugfixes, improvements, and new configuration options: |
|
150 | 155 | |
|
151 | 156 | - Fix a bug preventing PySide2 GUI integration from working :ghpull:`11464` |
|
152 | 157 | - Run CI on Mac OS ! :ghpull:`11471` |
|
153 | 158 | - Fix IPython "Demo" mode. :ghpull:`11498` |
|
154 | 159 | - Fix ``%run`` magic with path in name :ghpull:`11499` |
|
155 | 160 | - Fix: add CWD to sys.path *after* stdlib :ghpull:`11502` |
|
156 | 161 | - Better rendering of signatures, especially long ones. :ghpull:`11505` |
|
157 | 162 | - Re-enable jedi by default if it's installed :ghpull:`11506` |
|
158 | 163 | - Add New ``minimal`` exception reporting mode (useful for educational purpose). See :ghpull:`11509` |
|
159 | 164 | |
|
160 | 165 | |
|
161 | 166 | Added ability to show subclasses when using pinfo and other utilities |
|
162 | 167 | --------------------------------------------------------------------- |
|
163 | 168 | |
|
164 | 169 | When using ``?``/``??`` on a class, IPython will now list the first 10 subclasses. |
|
165 | 170 | |
|
166 | 171 | Special Thanks to Chris Mentzel of the Moore Foundation for this feature. Chris |
|
167 | 172 | is one of the people who played a critical role in IPython/Jupyter getting |
|
168 | 173 | funding. |
|
169 | 174 | |
|
170 | 175 | We are grateful for all the help Chris has given us over the years, |
|
171 | 176 | and we're now proud to have code contributed by Chris in IPython. |
|
172 | 177 | |
|
173 | 178 | OSMagics.cd_force_quiet configuration option |
|
174 | 179 | -------------------------------------------- |
|
175 | 180 | |
|
176 | 181 | You can set this option to force the %cd magic to behave as if ``-q`` was passed: |
|
177 | 182 | :: |
|
178 | 183 | |
|
179 | 184 | In [1]: cd / |
|
180 | 185 | / |
|
181 | 186 | |
|
182 | 187 | In [2]: %config OSMagics.cd_force_quiet = True |
|
183 | 188 | |
|
184 | 189 | In [3]: cd /tmp |
|
185 | 190 | |
|
186 | 191 | In [4]: |
|
187 | 192 | |
|
188 | 193 | See :ghpull:`11491` |
|
189 | 194 | |
|
190 | 195 | In vi editing mode, whether the prompt includes the current vi mode can now be configured |
|
191 | 196 | ----------------------------------------------------------------------------------------- |
|
192 | 197 | |
|
193 | 198 | Set the ``TerminalInteractiveShell.prompt_includes_vi_mode`` to a boolean value |
|
194 | 199 | (default: True) to control this feature. See :ghpull:`11492` |
|
195 | 200 | |
|
196 | 201 | .. _whatsnew710: |
|
197 | 202 | |
|
198 | 203 | IPython 7.1.0 |
|
199 | 204 | ============= |
|
200 | 205 | |
|
201 | 206 | IPython 7.1.0 is the first minor release after 7.0.0 and mostly brings fixes to |
|
202 | 207 | new features, internal refactoring, and fixes for regressions that happened during the 6.x->7.x |
|
203 | 208 | transition. It also brings **Compatibility with Python 3.7.1**, as we're |
|
204 | 209 | unwillingly relying on a bug in CPython. |
|
205 | 210 | |
|
206 | 211 | New Core Dev: |
|
207 | 212 | |
|
208 | 213 | - We welcome Jonathan Slenders to the commiters. Jonathan has done a fantastic |
|
209 | 214 | work on prompt_toolkit, and we'd like to recognise his impact by giving him |
|
210 | 215 | commit rights. :ghissue:`11397` |
|
211 | 216 | |
|
212 | 217 | Notable Changes |
|
213 | 218 | |
|
214 | 219 | - Major update of "latex to unicode" tab completion map (see below) |
|
215 | 220 | |
|
216 | 221 | Notable New Features: |
|
217 | 222 | |
|
218 | 223 | - Restore functionality and documentation of the **sphinx directive**, which |
|
219 | 224 | is now stricter (fail on error by daefault), has new configuration options, |
|
220 | 225 | has a brand new documentation page :ref:`ipython_directive` (which needs |
|
221 | 226 | some cleanup). It is also now *tested* so we hope to have less regressions. |
|
222 | 227 | :ghpull:`11402` |
|
223 | 228 | |
|
224 | 229 | - ``IPython.display.Video`` now supports ``width`` and ``height`` arguments, |
|
225 | 230 | allowing a custom width and height to be set instead of using the video's |
|
226 | 231 | width and height. :ghpull:`11353` |
|
227 | 232 | |
|
228 | 233 | - Warn when using ``HTML('<iframe>')`` instead of ``IFrame`` :ghpull:`11350` |
|
229 | 234 | |
|
230 | 235 | - Allow Dynamic switching of editing mode between vi/emacs and show |
|
231 | 236 | normal/input mode in prompt when using vi. :ghpull:`11390`. Use ``%config |
|
232 | 237 | TerminalInteractiveShell.editing_mode = 'vi'`` or ``%config |
|
233 | 238 | TerminalInteractiveShell.editing_mode = 'emacs'`` to dynamically switch |
|
234 | 239 | between modes. |
|
235 | 240 | |
|
236 | 241 | |
|
237 | 242 | Notable Fixes: |
|
238 | 243 | |
|
239 | 244 | - Fix entering of **multi-line blocks in terminal** IPython, and various |
|
240 | 245 | crashes in the new input transformation machinery :ghpull:`11354`, |
|
241 | 246 | :ghpull:`11356`, :ghpull:`11358`. These also fix a **Compatibility bug |
|
242 | 247 | with Python 3.7.1**. |
|
243 | 248 | |
|
244 | 249 | - Fix moving through generator stack in ipdb :ghpull:`11266` |
|
245 | 250 | |
|
246 | 251 | - %Magic command arguments now support quoting. :ghpull:`11330` |
|
247 | 252 | |
|
248 | 253 | - Re-add ``rprint`` and ``rprinte`` aliases. :ghpull:`11331` |
|
249 | 254 | |
|
250 | 255 | - Remove implicit dependency on ``ipython_genutils`` :ghpull:`11317` |
|
251 | 256 | |
|
252 | 257 | - Make ``nonlocal`` raise ``SyntaxError`` instead of silently failing in async |
|
253 | 258 | mode. :ghpull:`11382` |
|
254 | 259 | |
|
255 | 260 | - Fix mishandling of magics and ``= !`` assignment just after a dedent in |
|
256 | 261 | nested code blocks :ghpull:`11418` |
|
257 | 262 | |
|
258 | 263 | - Fix instructions for custom shortcuts :ghpull:`11426` |
|
259 | 264 | |
|
260 | 265 | |
|
261 | 266 | Notable Internals improvements: |
|
262 | 267 | |
|
263 | 268 | - Use of ``os.scandir`` (Python 3 only) to speed up some file system operations. |
|
264 | 269 | :ghpull:`11365` |
|
265 | 270 | |
|
266 | 271 | - use ``perf_counter`` instead of ``clock`` for more precise |
|
267 | 272 | timing results with ``%time`` :ghpull:`11376` |
|
268 | 273 | |
|
269 | 274 | Many thanks to all the contributors and in particular to ``bartskowron`` and |
|
270 | 275 | ``tonyfast`` who handled some pretty complicated bugs in the input machinery. We |
|
271 | 276 | had a number of first time contributors and maybe hacktoberfest participants that |
|
272 | 277 | made significant contributions and helped us free some time to focus on more |
|
273 | 278 | complicated bugs. |
|
274 | 279 | |
|
275 | 280 | You |
|
276 | 281 | can see all the closed issues and Merged PR, new features and fixes `here |
|
277 | 282 | <https://github.com/ipython/ipython/issues?utf8=%E2%9C%93&q=+is%3Aclosed+milestone%3A7.1+>`_. |
|
278 | 283 | |
|
279 | 284 | Unicode Completion update |
|
280 | 285 | ------------------------- |
|
281 | 286 | |
|
282 | 287 | In IPython 7.1 the Unicode completion map has been updated and synchronized with |
|
283 | 288 | the Julia language. |
|
284 | 289 | |
|
285 | 290 | Added and removed character characters: |
|
286 | 291 | |
|
287 | 292 | ``\jmath`` (``Θ·``), ``\\underleftrightarrow`` (U+034D, combining) have been |
|
288 | 293 | added, while ``\\textasciicaron`` have been removed |
|
289 | 294 | |
|
290 | 295 | Some sequences have seen their prefix removed: |
|
291 | 296 | |
|
292 | 297 | - 6 characters ``\text...<tab>`` should now be inputed with ``\...<tab>`` directly, |
|
293 | 298 | - 45 characters ``\Elz...<tab>`` should now be inputed with ``\...<tab>`` directly, |
|
294 | 299 | - 65 characters ``\B...<tab>`` should now be inputed with ``\...<tab>`` directly, |
|
295 | 300 | - 450 characters ``\m...<tab>`` should now be inputed with ``\...<tab>`` directly, |
|
296 | 301 | |
|
297 | 302 | Some sequences have seen their prefix shortened: |
|
298 | 303 | |
|
299 | 304 | - 5 characters ``\mitBbb...<tab>`` should now be inputed with ``\bbi...<tab>`` directly, |
|
300 | 305 | - 52 characters ``\mit...<tab>`` should now be inputed with ``\i...<tab>`` directly, |
|
301 | 306 | - 216 characters ``\mbfit...<tab>`` should now be inputed with ``\bi...<tab>`` directly, |
|
302 | 307 | - 222 characters ``\mbf...<tab>`` should now be inputed with ``\b...<tab>`` directly, |
|
303 | 308 | |
|
304 | 309 | A couple of characters had their sequence simplified: |
|
305 | 310 | |
|
306 | 311 | - ``Γ°``, type ``\dh<tab>``, instead of ``\eth<tab>`` |
|
307 | 312 | - ``Δ§``, type ``\hbar<tab>``, instead of ``\Elzxh<tab>`` |
|
308 | 313 | - ``ΙΈ``, type ``\ltphi<tab>``, instead of ``\textphi<tab>`` |
|
309 | 314 | - ``Ο΄``, type ``\varTheta<tab>``, instead of ``\textTheta<tab>`` |
|
310 | 315 | - ``β``, type ``\eulermascheroni<tab>``, instead of ``\Eulerconst<tab>`` |
|
311 | 316 | - ``β``, type ``\planck<tab>``, instead of ``\Planckconst<tab>`` |
|
312 | 317 | |
|
313 | 318 | - U+0336 (COMBINING LONG STROKE OVERLAY), type ``\strike<tab>``, instead of ``\Elzbar<tab>``. |
|
314 | 319 | |
|
315 | 320 | A couple of sequences have been updated: |
|
316 | 321 | |
|
317 | 322 | - ``\varepsilon`` now gives ``Ι`` (GREEK SMALL LETTER EPSILON) instead of ``Ξ΅`` (GREEK LUNATE EPSILON SYMBOL), |
|
318 | 323 | - ``\underbar`` now gives U+0331 (COMBINING MACRON BELOW) instead of U+0332 (COMBINING LOW LINE). |
|
319 | 324 | |
|
320 | 325 | |
|
321 | 326 | .. _whatsnew700: |
|
322 | 327 | |
|
323 | 328 | IPython 7.0.0 |
|
324 | 329 | ============= |
|
325 | 330 | |
|
326 | 331 | Released Thursday September 27th, 2018 |
|
327 | 332 | |
|
328 | 333 | IPython 7 includes major feature improvements. |
|
329 | 334 | This is also the second major version of IPython to support only |
|
330 | 335 | Python 3 βΒ starting at Python 3.4. Python 2 is still community-supported |
|
331 | 336 | on the bugfix only 5.x branch, but we remind you that Python 2 "end of life" |
|
332 | 337 | is on Jan 1st 2020. |
|
333 | 338 | |
|
334 | 339 | We were able to backport bug fixes to the 5.x branch thanks to our backport bot which |
|
335 | 340 | backported more than `70 Pull-Requests |
|
336 | 341 | <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>`_ |
|
337 | 342 | |
|
338 | 343 | The IPython 6.x branch will likely not see any further release unless critical |
|
339 | 344 | bugs are found. |
|
340 | 345 | |
|
341 | 346 | Make sure you have pip > 9.0 before upgrading. You should be able to update by running: |
|
342 | 347 | |
|
343 | 348 | .. code:: |
|
344 | 349 | |
|
345 | 350 | pip install ipython --upgrade |
|
346 | 351 | |
|
347 | 352 | .. only:: ipydev |
|
348 | 353 | |
|
349 | 354 | If you are trying to install or update an ``alpha``, ``beta``, or ``rc`` |
|
350 | 355 | version, use pip ``--pre`` flag. |
|
351 | 356 | |
|
352 | 357 | .. code:: |
|
353 | 358 | |
|
354 | 359 | pip install ipython --upgrade --pre |
|
355 | 360 | |
|
356 | 361 | |
|
357 | 362 | Or, if you have conda installed: |
|
358 | 363 | |
|
359 | 364 | .. code:: |
|
360 | 365 | |
|
361 | 366 | conda install ipython |
|
362 | 367 | |
|
363 | 368 | |
|
364 | 369 | |
|
365 | 370 | Prompt Toolkit 2.0 |
|
366 | 371 | ------------------ |
|
367 | 372 | |
|
368 | 373 | IPython 7.0+ now uses ``prompt_toolkit 2.0``. If you still need to use an earlier |
|
369 | 374 | ``prompt_toolkit`` version, you may need to pin IPython to ``<7.0``. |
|
370 | 375 | |
|
371 | 376 | Autowait: Asynchronous REPL |
|
372 | 377 | --------------------------- |
|
373 | 378 | |
|
374 | 379 | Staring with IPython 7.0 on Python 3.6+, IPython can automatically ``await`` |
|
375 | 380 | top level code. You should not need to access an event loop or runner |
|
376 | 381 | yourself. To learn more, read the :ref:`autoawait` section of our docs, see |
|
377 | 382 | :ghpull:`11265`, or try the following code:: |
|
378 | 383 | |
|
379 | 384 | Python 3.6.0 |
|
380 | 385 | Type 'copyright', 'credits' or 'license' for more information |
|
381 | 386 | IPython 7.0.0 -- An enhanced Interactive Python. Type '?' for help. |
|
382 | 387 | |
|
383 | 388 | In [1]: import aiohttp |
|
384 | 389 | ...: result = aiohttp.get('https://api.github.com') |
|
385 | 390 | |
|
386 | 391 | In [2]: response = await result |
|
387 | 392 | <pause for a few 100s ms> |
|
388 | 393 | |
|
389 | 394 | In [3]: await response.json() |
|
390 | 395 | Out[3]: |
|
391 | 396 | {'authorizations_url': 'https://api.github.com/authorizations', |
|
392 | 397 | 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}', |
|
393 | 398 | ... |
|
394 | 399 | } |
|
395 | 400 | |
|
396 | 401 | .. note:: |
|
397 | 402 | |
|
398 | 403 | Async integration is experimental code, behavior may change or be removed |
|
399 | 404 | between Python and IPython versions without warnings. |
|
400 | 405 | |
|
401 | 406 | Integration is by default with `asyncio`, but other libraries can be configured -- |
|
402 | 407 | like ``curio`` or ``trio`` -- to improve concurrency in the REPL:: |
|
403 | 408 | |
|
404 | 409 | In [1]: %autoawait trio |
|
405 | 410 | |
|
406 | 411 | In [2]: import trio |
|
407 | 412 | |
|
408 | 413 | In [3]: async def child(i): |
|
409 | 414 | ...: print(" child %s goes to sleep"%i) |
|
410 | 415 | ...: await trio.sleep(2) |
|
411 | 416 | ...: print(" child %s wakes up"%i) |
|
412 | 417 | |
|
413 | 418 | In [4]: print('parent start') |
|
414 | 419 | ...: async with trio.open_nursery() as n: |
|
415 | 420 | ...: for i in range(3): |
|
416 | 421 | ...: n.spawn(child, i) |
|
417 | 422 | ...: print('parent end') |
|
418 | 423 | parent start |
|
419 | 424 | child 2 goes to sleep |
|
420 | 425 | child 0 goes to sleep |
|
421 | 426 | child 1 goes to sleep |
|
422 | 427 | <about 2 seconds pause> |
|
423 | 428 | child 2 wakes up |
|
424 | 429 | child 1 wakes up |
|
425 | 430 | child 0 wakes up |
|
426 | 431 | parent end |
|
427 | 432 | |
|
428 | 433 | See :ref:`autoawait` for more information. |
|
429 | 434 | |
|
430 | 435 | |
|
431 | 436 | Asynchronous code in a Notebook interface or any other frontend using the |
|
432 | 437 | Jupyter Protocol will require further updates to the IPykernel package. |
|
433 | 438 | |
|
434 | 439 | Non-Asynchronous code |
|
435 | 440 | ~~~~~~~~~~~~~~~~~~~~~ |
|
436 | 441 | |
|
437 | 442 | As the internal API of IPython is now asynchronous, IPython needs to run under |
|
438 | 443 | an event loop. In order to allow many workflows, (like using the :magic:`%run` |
|
439 | 444 | magic, or copy-pasting code that explicitly starts/stop event loop), when |
|
440 | 445 | top-level code is detected as not being asynchronous, IPython code is advanced |
|
441 | 446 | via a pseudo-synchronous runner, and may not advance pending tasks. |
|
442 | 447 | |
|
443 | 448 | Change to Nested Embed |
|
444 | 449 | ~~~~~~~~~~~~~~~~~~~~~~ |
|
445 | 450 | |
|
446 | 451 | The introduction of the ability to run async code had some effect on the |
|
447 | 452 | ``IPython.embed()`` API. By default, embed will not allow you to run asynchronous |
|
448 | 453 | code unless an event loop is specified. |
|
449 | 454 | |
|
450 | 455 | Effects on Magics |
|
451 | 456 | ~~~~~~~~~~~~~~~~~ |
|
452 | 457 | |
|
453 | 458 | Some magics will not work with async until they're updated. |
|
454 | 459 | Contributions welcome. |
|
455 | 460 | |
|
456 | 461 | Expected Future changes |
|
457 | 462 | ~~~~~~~~~~~~~~~~~~~~~~~ |
|
458 | 463 | |
|
459 | 464 | We expect more internal but public IPython functions to become ``async``, and |
|
460 | 465 | will likely end up having a persistent event loop while IPython is running. |
|
461 | 466 | |
|
462 | 467 | Thanks |
|
463 | 468 | ~~~~~~ |
|
464 | 469 | |
|
465 | 470 | This release took more than a year in the making. |
|
466 | 471 | The code was rebased a number of |
|
467 | 472 | times; leading to commit authorship that may have been lost in the final |
|
468 | 473 | Pull-Request. Huge thanks to many people for contribution, discussion, code, |
|
469 | 474 | documentation, use-cases: dalejung, danielballan, ellisonbg, fperez, gnestor, |
|
470 | 475 | minrk, njsmith, pganssle, tacaswell, takluyver , vidartf ... And many others. |
|
471 | 476 | |
|
472 | 477 | |
|
473 | 478 | Autoreload Improvement |
|
474 | 479 | ---------------------- |
|
475 | 480 | |
|
476 | 481 | The magic :magic:`%autoreload 2 <autoreload>` now captures new methods added to |
|
477 | 482 | classes. Earlier, only methods existing as of the initial import were being |
|
478 | 483 | tracked and updated. |
|
479 | 484 | |
|
480 | 485 | This new feature helps dual environment development - Jupyter+IDE - where the |
|
481 | 486 | code gradually moves from notebook cells to package files as it gets |
|
482 | 487 | structured. |
|
483 | 488 | |
|
484 | 489 | **Example**: An instance of the class ``MyClass`` will be able to access the |
|
485 | 490 | method ``cube()`` after it is uncommented and the file ``file1.py`` is saved on |
|
486 | 491 | disk. |
|
487 | 492 | |
|
488 | 493 | |
|
489 | 494 | .. code:: |
|
490 | 495 | |
|
491 | 496 | # notebook |
|
492 | 497 | |
|
493 | 498 | from mymodule import MyClass |
|
494 | 499 | first = MyClass(5) |
|
495 | 500 | |
|
496 | 501 | .. code:: |
|
497 | 502 | |
|
498 | 503 | # mymodule/file1.py |
|
499 | 504 | |
|
500 | 505 | class MyClass: |
|
501 | 506 | |
|
502 | 507 | def __init__(self, a=10): |
|
503 | 508 | self.a = a |
|
504 | 509 | |
|
505 | 510 | def square(self): |
|
506 | 511 | print('compute square') |
|
507 | 512 | return self.a*self.a |
|
508 | 513 | |
|
509 | 514 | # def cube(self): |
|
510 | 515 | # print('compute cube') |
|
511 | 516 | # return self.a*self.a*self.a |
|
512 | 517 | |
|
513 | 518 | |
|
514 | 519 | |
|
515 | 520 | |
|
516 | 521 | Misc |
|
517 | 522 | ---- |
|
518 | 523 | |
|
519 | 524 | The autoindent feature that was deprecated in 5.x was re-enabled and |
|
520 | 525 | un-deprecated in :ghpull:`11257` |
|
521 | 526 | |
|
522 | 527 | Make :magic:`%run -n -i ... <run>` work correctly. Earlier, if :magic:`%run` was |
|
523 | 528 | passed both arguments, ``-n`` would be silently ignored. See :ghpull:`10308` |
|
524 | 529 | |
|
525 | 530 | |
|
526 | 531 | The :cellmagic:`%%script` (as well as :cellmagic:`%%bash`, |
|
527 | 532 | :cellmagic:`%%ruby`... ) cell magics now raise by default if the return code of |
|
528 | 533 | the given code is non-zero (thus halting execution of further cells in a |
|
529 | 534 | notebook). The behavior can be disable by passing the ``--no-raise-error`` flag. |
|
530 | 535 | |
|
531 | 536 | |
|
532 | 537 | Deprecations |
|
533 | 538 | ------------ |
|
534 | 539 | |
|
535 | 540 | A couple of unused functions and methods have been deprecated and will be removed |
|
536 | 541 | in future versions: |
|
537 | 542 | |
|
538 | 543 | - ``IPython.utils.io.raw_print_err`` |
|
539 | 544 | - ``IPython.utils.io.raw_print`` |
|
540 | 545 | |
|
541 | 546 | |
|
542 | 547 | Backwards incompatible changes |
|
543 | 548 | ------------------------------ |
|
544 | 549 | |
|
545 | 550 | * The API for transforming input before it is parsed as Python code has been |
|
546 | 551 | completely redesigned: any custom input transformations will need to be |
|
547 | 552 | 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