msg343334 - (view) |
Author: Yury Selivanov (yselivanov) *  |
Date: 2019-05-23 22:57 |
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 |
|
|
msg343615 - (view) |
Author: Yury Selivanov (yselivanov) *  |
Date: 2019-05-27 11:42 |
New changeset 16cefb0bc7b05c08caf08525398ff178c35dece4 by Yury Selivanov in branch 'master': bpo-37028: asyncio REPL; activated via 'python -m asyncio'. (GH-13472) https://github.com/python/cpython/commit/16cefb0bc7b05c08caf08525398ff178c35dece4 |
|
|
msg343616 - (view) |
Author: Yury Selivanov (yselivanov) *  |
Date: 2019-05-27 11:46 |
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. |
|
|
msg343630 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2019-05-27 14:30 |
"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...". |
|
|
msg343637 - (view) |
Author: Yury Selivanov (yselivanov) *  |
Date: 2019-05-27 15:08 |
> 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) |
|
|
msg370118 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2020-05-27 18:36 |
Compared to the vanilla REPL, this doesn’t include readline setup for tab completion and history file. Was it on purpose? |
|
|
msg370132 - (view) |
Author: Matthias Bussonnier (mbussonn) * |
Date: 2020-05-27 20:44 |
> Compared to the vanilla REPL, this doesn’t include readline setup for tab completion and history file. Was it on purpose? 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. |
|
|
msg370157 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2020-05-28 00:18 |
This issue is now closed. If someone wants to enhane the asyncio REPL, please open a new issue. |
|
|