Show More
@@ -1,72 +1,46 b'' | |||
|
1 | 1 | ===================== |
|
2 | 2 | Development version |
|
3 | 3 | ===================== |
|
4 | 4 | |
|
5 | 5 | This document describes in-flight development work. |
|
6 | 6 | |
|
7 | 7 | .. warning:: |
|
8 | 8 | |
|
9 | 9 | Please do not edit this file by hand (doing so will likely cause merge |
|
10 | 10 | conflicts for other Pull Requests). Instead, create a new file in the |
|
11 | 11 | `docs/source/whatsnew/pr` folder |
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 | Released .... ...., 2017 |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | Need to be updated: |
|
18 | 18 | |
|
19 | 19 | .. toctree:: |
|
20 | 20 | :maxdepth: 2 |
|
21 | 21 | :glob: |
|
22 | 22 | |
|
23 | 23 | pr/* |
|
24 | 24 | |
|
25 | 25 | IPython 6 feature a major improvement in the completion machinery which is now |
|
26 | 26 | capable of completing non-executed code. It is also the first version of IPython |
|
27 | 27 | to stop compatibility with Python 2, which is still supported on the bugfix only |
|
28 | 28 | 5.x branch. Read below to have a non-exhaustive list of new features. |
|
29 | 29 | |
|
30 | 30 | Make sure you have pip > 9.0 before upgrading. |
|
31 | 31 | You should be able to update by using: |
|
32 | 32 | |
|
33 | 33 | .. code:: |
|
34 | 34 | |
|
35 | 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 | 40 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT. |
|
67 | 41 | |
|
68 | 42 | |
|
69 | 43 | Backwards incompatible changes |
|
70 | 44 | ------------------------------ |
|
71 | 45 | |
|
72 | 46 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT. |
@@ -1,55 +1,69 b'' | |||
|
1 | Await REPL | |
|
2 | ---------- | |
|
1 | Autowait: Asynchronous REPL | |
|
2 | --------------------------- | |
|
3 | 3 | |
|
4 | :ghpull:`10390` introduced the ability to ``await`` Futures and | |
|
5 | Coroutines in the REPL. For example:: | |
|
4 | Staring with IPython 7.0 and on Python 3.6+, IPython can automatically await | |
|
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 | 9 | Python 3.6.0 |
|
8 | 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 | 13 | In [1]: import aiohttp |
|
12 | 14 | ...: result = aiohttp.get('https://api.github.com') |
|
13 | 15 | |
|
14 | 16 | In [2]: response = await result |
|
15 | 17 | <pause for a few 100s ms> |
|
16 | 18 | |
|
17 | 19 | In [3]: await response.json() |
|
18 | 20 | Out[3]: |
|
19 | 21 | {'authorizations_url': 'https://api.github.com/authorizations', |
|
20 | 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 | 27 | Integration is by default with `asyncio`, but other libraries can be configured, |
|
26 | 28 | like ``curio`` or ``trio``, to improve concurrency in the REPL:: |
|
27 | 29 | |
|
28 | 30 | In [1]: %autoawait trio |
|
29 | 31 | |
|
30 | 32 | In [2]: import trio |
|
31 | 33 | |
|
32 | 34 | In [3]: async def child(i): |
|
33 | 35 | ...: print(" child %s goes to sleep"%i) |
|
34 | 36 | ...: await trio.sleep(2) |
|
35 | 37 | ...: print(" child %s wakes up"%i) |
|
36 | 38 | |
|
37 | 39 | In [4]: print('parent start') |
|
38 | 40 | ...: async with trio.open_nursery() as n: |
|
39 | 41 | ...: for i in range(3): |
|
40 | 42 | ...: n.spawn(child, i) |
|
41 | 43 | ...: print('parent end') |
|
42 | 44 | parent start |
|
43 | 45 | child 2 goes to sleep |
|
44 | 46 | child 0 goes to sleep |
|
45 | 47 | child 1 goes to sleep |
|
46 | 48 | <about 2 seconds pause> |
|
47 | 49 | child 2 wakes up |
|
48 | 50 | child 1 wakes up |
|
49 | 51 | child 0 wakes up |
|
50 | 52 | parent end |
|
51 | 53 | |
|
52 | 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