Show More
@@ -1,72 +1,46 b'' | |||||
1 | ===================== |
|
1 | ===================== | |
2 | Development version |
|
2 | Development version | |
3 | ===================== |
|
3 | ===================== | |
4 |
|
4 | |||
5 | This document describes in-flight development work. |
|
5 | This document describes in-flight development work. | |
6 |
|
6 | |||
7 | .. warning:: |
|
7 | .. warning:: | |
8 |
|
8 | |||
9 | Please do not edit this file by hand (doing so will likely cause merge |
|
9 | Please do not edit this file by hand (doing so will likely cause merge | |
10 | conflicts for other Pull Requests). Instead, create a new file in the |
|
10 | conflicts for other Pull Requests). Instead, create a new file in the | |
11 | `docs/source/whatsnew/pr` folder |
|
11 | `docs/source/whatsnew/pr` folder | |
12 |
|
12 | |||
13 |
|
13 | |||
14 | Released .... ...., 2017 |
|
14 | Released .... ...., 2017 | |
15 |
|
15 | |||
16 |
|
16 | |||
17 | Need to be updated: |
|
17 | Need to be updated: | |
18 |
|
18 | |||
19 | .. toctree:: |
|
19 | .. toctree:: | |
20 | :maxdepth: 2 |
|
20 | :maxdepth: 2 | |
21 | :glob: |
|
21 | :glob: | |
22 |
|
22 | |||
23 | pr/* |
|
23 | pr/* | |
24 |
|
24 | |||
25 | IPython 6 feature a major improvement in the completion machinery which is now |
|
25 | IPython 6 feature a major improvement in the completion machinery which is now | |
26 | capable of completing non-executed code. It is also the first version of IPython |
|
26 | capable of completing non-executed code. It is also the first version of IPython | |
27 | to stop compatibility with Python 2, which is still supported on the bugfix only |
|
27 | to stop compatibility with Python 2, which is still supported on the bugfix only | |
28 | 5.x branch. Read below to have a non-exhaustive list of new features. |
|
28 | 5.x branch. Read below to have a non-exhaustive list of new features. | |
29 |
|
29 | |||
30 | Make sure you have pip > 9.0 before upgrading. |
|
30 | Make sure you have pip > 9.0 before upgrading. | |
31 | You should be able to update by using: |
|
31 | You should be able to update by using: | |
32 |
|
32 | |||
33 | .. code:: |
|
33 | .. code:: | |
34 |
|
34 | |||
35 | pip install ipython --upgrade |
|
35 | pip install ipython --upgrade | |
36 |
|
36 | |||
37 |
|
37 | |||
38 | Autowait: Asynchronous REPL |
|
|||
39 | =========================== |
|
|||
40 |
|
||||
41 | Staring with IPython 7.0 and on Python 3.6+, IPython can automatically await |
|
|||
42 | code at top level, you should not need to access an event loop or runner |
|
|||
43 | yourself. To know more read the `autoawait`_ section of our docs, or try the |
|
|||
44 | following code:: |
|
|||
45 |
|
||||
46 | In [6]: from asyncio import sleep |
|
|||
47 | ...: print('Going to sleep...') |
|
|||
48 | ...: await sleep(3) |
|
|||
49 | ...: print('Waking up') |
|
|||
50 | Going to sleep... |
|
|||
51 | Waking up |
|
|||
52 |
|
||||
53 | Asynchronous code in a Notebook interface or any other frontend using the |
|
|||
54 | Jupyter Protocol will need further updates of the IPykernel package. |
|
|||
55 |
|
||||
56 |
|
||||
57 | Change to Nested Embed |
|
|||
58 | ====================== |
|
|||
59 |
|
||||
60 | The introduction of the ability to run async code had ripple effect on the |
|
|||
61 | ability to use nested IPython. You may need to install the ``trio`` library |
|
|||
62 | (version 05 at the time of this writing) to |
|
|||
63 | have this feature working. |
|
|||
64 |
|
38 | |||
65 |
|
39 | |||
66 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT. |
|
40 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT. | |
67 |
|
41 | |||
68 |
|
42 | |||
69 | Backwards incompatible changes |
|
43 | Backwards incompatible changes | |
70 | ------------------------------ |
|
44 | ------------------------------ | |
71 |
|
45 | |||
72 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT. |
|
46 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT. |
@@ -1,55 +1,69 b'' | |||||
1 | Await REPL |
|
1 | Autowait: Asynchronous REPL | |
2 | ---------- |
|
2 | --------------------------- | |
3 |
|
3 | |||
4 | :ghpull:`10390` introduced the ability to ``await`` Futures and |
|
4 | Staring with IPython 7.0 and on Python 3.6+, IPython can automatically await | |
5 | Coroutines in the REPL. For example:: |
|
5 | code at top level, you should not need to access an event loop or runner | |
|
6 | yourself. To know more read the :ref:`autoawait` section of our docs, see | |||
|
7 | :ghpull:`11265` or try the following code:: | |||
6 |
|
8 | |||
7 | Python 3.6.0 |
|
9 | Python 3.6.0 | |
8 | Type 'copyright', 'credits' or 'license' for more information |
|
10 | Type 'copyright', 'credits' or 'license' for more information | |
9 |
IPython |
|
11 | IPython 7.0.0 -- An enhanced Interactive Python. Type '?' for help. | |
10 |
|
12 | |||
11 | In [1]: import aiohttp |
|
13 | In [1]: import aiohttp | |
12 | ...: result = aiohttp.get('https://api.github.com') |
|
14 | ...: result = aiohttp.get('https://api.github.com') | |
13 |
|
15 | |||
14 | In [2]: response = await result |
|
16 | In [2]: response = await result | |
15 | <pause for a few 100s ms> |
|
17 | <pause for a few 100s ms> | |
16 |
|
18 | |||
17 | In [3]: await response.json() |
|
19 | In [3]: await response.json() | |
18 | Out[3]: |
|
20 | Out[3]: | |
19 | {'authorizations_url': 'https://api.github.com/authorizations', |
|
21 | {'authorizations_url': 'https://api.github.com/authorizations', | |
20 | 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}', |
|
22 | 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}', | |
21 | ... |
|
23 | ... | |
22 | } |
|
24 | } | |
23 |
|
25 | |||
24 |
|
26 | |||
25 | Integration is by default with `asyncio`, but other libraries can be configured, |
|
27 | Integration is by default with `asyncio`, but other libraries can be configured, | |
26 | like ``curio`` or ``trio``, to improve concurrency in the REPL:: |
|
28 | like ``curio`` or ``trio``, to improve concurrency in the REPL:: | |
27 |
|
29 | |||
28 | In [1]: %autoawait trio |
|
30 | In [1]: %autoawait trio | |
29 |
|
31 | |||
30 | In [2]: import trio |
|
32 | In [2]: import trio | |
31 |
|
33 | |||
32 | In [3]: async def child(i): |
|
34 | In [3]: async def child(i): | |
33 | ...: print(" child %s goes to sleep"%i) |
|
35 | ...: print(" child %s goes to sleep"%i) | |
34 | ...: await trio.sleep(2) |
|
36 | ...: await trio.sleep(2) | |
35 | ...: print(" child %s wakes up"%i) |
|
37 | ...: print(" child %s wakes up"%i) | |
36 |
|
38 | |||
37 | In [4]: print('parent start') |
|
39 | In [4]: print('parent start') | |
38 | ...: async with trio.open_nursery() as n: |
|
40 | ...: async with trio.open_nursery() as n: | |
39 | ...: for i in range(3): |
|
41 | ...: for i in range(3): | |
40 | ...: n.spawn(child, i) |
|
42 | ...: n.spawn(child, i) | |
41 | ...: print('parent end') |
|
43 | ...: print('parent end') | |
42 | parent start |
|
44 | parent start | |
43 | child 2 goes to sleep |
|
45 | child 2 goes to sleep | |
44 | child 0 goes to sleep |
|
46 | child 0 goes to sleep | |
45 | child 1 goes to sleep |
|
47 | child 1 goes to sleep | |
46 | <about 2 seconds pause> |
|
48 | <about 2 seconds pause> | |
47 | child 2 wakes up |
|
49 | child 2 wakes up | |
48 | child 1 wakes up |
|
50 | child 1 wakes up | |
49 | child 0 wakes up |
|
51 | child 0 wakes up | |
50 | parent end |
|
52 | parent end | |
51 |
|
53 | |||
52 | See :ref:`autoawait` for more information. |
|
54 | See :ref:`autoawait` for more information. | |
53 |
|
55 | |||
54 |
|
56 | |||
|
57 | Asynchronous code in a Notebook interface or any other frontend using the | |||
|
58 | Jupyter Protocol will need further updates of the IPykernel package. | |||
|
59 | ||||
|
60 | ||||
|
61 | Change to Nested Embed | |||
|
62 | ---------------------- | |||
|
63 | ||||
|
64 | The introduction of the ability to run async code had ripple effect on the | |||
|
65 | ability to use nested IPython. You may need to install the ``trio`` library | |||
|
66 | (version 05 at the time of this writing) to | |||
|
67 | have this feature working. | |||
|
68 | ||||
55 |
|
69 |
General Comments 0
You need to be logged in to leave comments.
Login now