You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having an asyncio enabled repr where a top-level "await" possible would be a huge productivity boost. Using asyncio.run() in a REPL is hard, and besides it spawns a new event loop on every call.
The big idea: we want users to be able to do this:
$ python -m asyncio
>>> await asyncio.sleep(10, return='hello')
# after 10 seconds
hello
The REPL has been merged to 3.8. It's not perfect though -- a ^C might break the asyncio event loop, sometimes ^C stops working altogether. We'll investigate all these issues in follow up PRs.
"asyncio REPL 3.8.0a4+ (heads/pep587_rename-dirty:ae29b4b186, May 27 2019, 16:10:31)"
I suggest "Python asyncio REPL 3.8.0a4+ (...)". I prefer to keep "Python" somewhere.
Is "exiting asyncio REPL..." message really helpful? If exit can block, would it possible to only display a message if something "hangs" (takes time)? I would expect something like "Waiting for xxx completion for 1 second...".
I suggest "Python asyncio REPL 3.8.0a4+ (...)". I prefer to keep "Python" somewhere.
Sure.
Is "exiting asyncio REPL..." message really helpful? If exit can block, would it possible to only display a message if something "hangs" (takes time)? I would expect something like "Waiting for xxx completion for 1 second...".
NP, I can drop the message. The waiting part isn't necessary, since we don't try to shutdown the loop properly anyways (yet)
Activity
1st1 commentedon May 23, 2019
Having an asyncio enabled repr where a top-level "await" possible would be a huge productivity boost. Using asyncio.run() in a REPL is hard, and besides it spawns a new event loop on every call.
The big idea: we want users to be able to do this:
>>> await asyncio.sleep(10, return='hello') # after 10 seconds hello1st1 commentedon May 27, 2019
New changeset 16cefb0 by Yury Selivanov in branch 'master':
bpo-37028: asyncio REPL; activated via 'python -m asyncio'. (GH-13472)
16cefb0
1st1 commentedon May 27, 2019
The REPL has been merged to 3.8. It's not perfect though -- a ^C might break the asyncio event loop, sometimes ^C stops working altogether. We'll investigate all these issues in follow up PRs.
vstinner commentedon May 27, 2019
"asyncio REPL 3.8.0a4+ (heads/pep587_rename-dirty:ae29b4b186, May 27 2019, 16:10:31)"
I suggest "Python asyncio REPL 3.8.0a4+ (...)". I prefer to keep "Python" somewhere.
Is "exiting asyncio REPL..." message really helpful? If exit can block, would it possible to only display a message if something "hangs" (takes time)? I would expect something like "Waiting for xxx completion for 1 second...".
1st1 commentedon May 27, 2019
Sure.
NP, I can drop the message. The waiting part isn't necessary, since we don't try to shutdown the loop properly anyways (yet)
merwok commentedon May 27, 2020
Compared to the vanilla REPL, this doesn’t include readline setup for tab completion and history file. Was it on purpose?
Carreau commentedon May 27, 2020
Not particularly, it was mostly to show it is possible. I'm guessing any improvement to make it more consistent with the normal REPL would be welcome.
If you want a fancier repl that also have these features it should work out of the box with IPython.
vstinner commentedon May 28, 2020
This issue is now closed. If someone wants to enhance the asyncio REPL, please open a new issue.
rinarakaki commentedon Oct 17, 2023
Is this feature related to pdb? I'm trying to use top-level await in pdb where I set breakpoint().
merwok commentedon Oct 17, 2023
It’s not