Skip to content

Implement asyncio repl #81209

Closed
Closed

Description

@1st1
BPO 37028
Nosy @vstinner, @merwok, @asvetlov, @1st1, @Carreau, @tirkarthi
PRs
  • bpo-37028: Implement asyncio REPL (activated via 'python -m asyncio') #13472
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-05-27.11:46:05.909>
    created_at = <Date 2019-05-23.22:57:13.335>
    labels = ['3.8', 'expert-asyncio']
    title = 'Implement asyncio repl'
    updated_at = <Date 2020-05-28.00:18:11.485>
    user = 'https://github.com/1st1'

    bugs.python.org fields:

    activity = <Date 2020-05-28.00:18:11.485>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-27.11:46:05.909>
    closer = 'yselivanov'
    components = ['asyncio']
    creation = <Date 2019-05-23.22:57:13.335>
    creator = 'yselivanov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37028
    keywords = ['patch']
    message_count = 8.0
    messages = ['343334', '343615', '343616', '343630', '343637', '370118', '370132', '370157']
    nosy_count = 6.0
    nosy_names = ['vstinner', 'eric.araujo', 'asvetlov', 'yselivanov', 'mbussonn', 'xtreak']
    pr_nums = ['13472']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue37028'
    versions = ['Python 3.8']

    Activity

    1. 1st1 commented on May 23, 2019

      @1st1
      MemberAuthor

      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
    2. 1st1 commented on May 27, 2019

      @1st1
      MemberAuthor

      New changeset 16cefb0 by Yury Selivanov in branch 'master':
      bpo-37028: asyncio REPL; activated via 'python -m asyncio'. (GH-13472)
      16cefb0

    3. 1st1 commented on May 27, 2019

      @1st1
      MemberAuthor

      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.

    4. vstinner commented on May 27, 2019

      @vstinner
      Member

      "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...".

    5. 1st1 commented on May 27, 2019

      @1st1
      MemberAuthor

      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)

    6. merwok commented on May 27, 2020

      @merwok
      Member

      Compared to the vanilla REPL, this doesn’t include readline setup for tab completion and history file. Was it on purpose?

    7. Carreau commented on May 27, 2020

      Carreaumannequin
      Mannequin

      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.

    8. vstinner commented on May 28, 2020

      @vstinner
      Member

      This issue is now closed. If someone wants to enhance the asyncio REPL, please open a new issue.

    9. transferred this issue fromon Apr 10, 2022
    10. rinarakaki commented on Oct 17, 2023

      @rinarakaki

      Is this feature related to pdb? I'm trying to use top-level await in pdb where I set breakpoint().

    11. merwok commented on Oct 17, 2023

      @merwok
      Member

      It’s not

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions