##// END OF EJS Templates
att triio runner at top level now that 3.4 drop + docs
Matthias Bussonnier -
Show More
@@ -34,22 +34,15 b' def _curio_runner(coroutine):'
34 return curio.run(coroutine)
34 return curio.run(coroutine)
35
35
36
36
37 if sys.version_info > (3, 5):
37 def _trio_runner(function):
38 # nose refuses to avoid this file and async def is invalidsyntax
38 import trio
39 s = dedent(
39 async def loc(coro):
40 '''
40 """
41 def _trio_runner(function):
41 We need the dummy no-op async def to protect from
42 import trio
42 trio's internal. See https://github.com/python-trio/trio/issues/89
43 async def loc(coro):
43 """
44 """
44 return await coro
45 We need the dummy no-op async def to protect from
45 return trio.run(loc, function)
46 trio's internal. See https://github.com/python-trio/trio/issues/89
47 """
48 return await coro
49 return trio.run(loc, function)
50 '''
51 )
52 exec(s, globals(), locals())
53
46
54
47
55 def _asyncify(code: str) -> str:
48 def _asyncify(code: str) -> str:
@@ -12,9 +12,10 b' notebook interface or any other frontend using the Jupyter protocol will need to'
12 use a newer version of IPykernel. The details of how async code runs in
12 use a newer version of IPykernel. The details of how async code runs in
13 IPykernel will differ between IPython, IPykernel and their versions.
13 IPykernel will differ between IPython, IPykernel and their versions.
14
14
15 When a supported library is used, IPython will automatically `await` Futures
15 When a supported library is used, IPython will automatically `await` Futures and
16 and Coroutines in the REPL. This will happen if an :ref:`await <await>` is
16 Coroutines in the REPL. This will happen if an :ref:`await <await>` (or any
17 use at top level scope, or if any structure valid only in `async def
17 other async constructs like async-with, async-for) is use at top level scope, or
18 if any structure valid only in `async def
18 <https://docs.python.org/3/reference/compound_stmts.html#async-def>`_ function
19 <https://docs.python.org/3/reference/compound_stmts.html#async-def>`_ function
19 context are present. For example, the following being a syntax error in the
20 context are present. For example, the following being a syntax error in the
20 Python REPL::
21 Python REPL::
@@ -117,6 +118,15 b' started only when awaited for the first time. That is to say, in first example,'
117 no network request is done between ``In[1]`` and ``In[2]``.
118 no network request is done between ``In[1]`` and ``In[2]``.
118
119
119
120
121 Effects on IPython.embed()
122 ==========================
123
124 IPython core being synchronous, the use of ``IPython.embed()`` will now require
125 a loop to run. This affect the ability to nest ``IPython.embed()`` which may
126 require you to install alternate IO libraries like ``curio`` and ``trio``
127
128
129
120 Internals
130 Internals
121 =========
131 =========
122
132
@@ -63,7 +63,7 b' Change to Nested Embed'
63
63
64 The introduction of the ability to run async code had ripple effect on the
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
65 ability to use nested IPython. You may need to install the ``trio`` library
66 (version 05 at the time of this writing) to
66 (version 0.5 at the time of this writing) to
67 have this feature working.
67 have this feature working.
68
68
69
69
General Comments 0
You need to be logged in to leave comments. Login now