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