classification
Title: Implement asyncio repl
Type: Stage: resolved
Components: asyncio Versions: Python 3.8
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, mbussonn, vstinner, xtreak, yselivanov
Priority: normal Keywords: patch

Created on 2019-05-23 22:57 by yselivanov, last changed 2019-05-27 15:08 by yselivanov. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13472 merged yselivanov, 2019-05-23 22:58
Messages (5)
msg343334 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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)
History
Date User Action Args
2019-05-27 15:08:30yselivanovsetmessages: + msg343637
2019-05-27 14:30:07vstinnersetnosy: + vstinner
messages: + msg343630
2019-05-27 11:46:05yselivanovsetstatus: open -> closed

messages: + msg343616
stage: patch review -> resolved
2019-05-27 11:42:45yselivanovsetmessages: + msg343615
2019-05-24 01:17:18xtreaksetnosy: + xtreak
2019-05-23 23:05:43mbussonnsetnosy: + mbussonn
2019-05-23 22:58:01yselivanovsetkeywords: + patch
stage: patch review
pull_requests: + pull_request13446
2019-05-23 22:57:13yselivanovcreate