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