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