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