FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Bring back readline capability? · Issue #10364 · ipython/ipython · GitHub

Repository navigation

Bring back readline capability? #10364

Closed
Closed

Description

Even if it's not what is used by default, I've experienced and heard about enough other people experiencing pains with the prompt_toolkit-based input breaking people's workflows, that I think we should seriously consider bringing that code back in.

I think it was a mistake to remove it altogether, and change the default at the same time.

Activity

  1. ivanov commented on Mar 1, 2017

    MemberAuthor

    I'm willing to do the work to get this back in time for 6.0, so I'll tag #10329 here.

  2. ivanov commented on Mar 1, 2017

    MemberAuthor

    I think this is a particularly important issue because long time users and advocates of IPython are finding themselves frustrated by or even unwilling to use IPython 5 as it is right now.

  3. Carreau commented on Mar 1, 2017

    Member

    I'm happy to add that back as an option, though most of the code has been removed and that will likely be a lot of efforts to reintegrate readline.

  4. added this to the 6.0 milestone on Mar 1, 2017
  5. Carreau commented on Mar 1, 2017

    Member

    If we can figure out how to make that optional (so that it can evolve faster than than core to re-fix potential bug that were introduced by the revival, that would be great.

  6. Carreau commented on Mar 1, 2017

    Member

    We might want to delay #10356 if we bring RL back.

  7. Carreau commented on Mar 1, 2017

    Member

    See #9260 as well.

  8. Carreau commented on Mar 1, 2017

    Member

    And #9399 is the bulk of the removal.

  9. takluyver commented on Mar 2, 2017

    Member

    I am strongly -1 on this. We were able to drop a lot of code and complexity when we ditched readline, (and we're working on dropping still more), while dramatically improving the user experience for most users. If we bring back a readline option, we have all the complexity of both interfaces to maintain ~forever. We always knew a change this big would break some workflows, but I'm confident that it's a net improvement, and I do not want us to be in the business of maintaining two alternative terminal interfaces.

    I would rather we:

    1. Continue to work on anything we can improve both in IPython and in prompt_toolkit to remove obstacles to switching. Jonathan has generally been impressively responsive and helpful whenever we've pinged him about issues relating to PTK, so I think we have a good chance of getting any changes we need accepted. This includes things like better documenting how to set custom shortcuts, and maybe experimenting with reading .inputrc (though I'd rather that was an off-by-default option, for reasons I've explained elsewhere). If we give people an easy option to go back to readline, these improvements are not going to happen.
    2. If there are still people who really insist on using readline, spin out a separate package like rlipython which provides the terminal interface, but make it very clear that it's community maintained, not something we are officially supporting.
  10. pfmoore commented on Mar 2, 2017

    Contributor

    Given that there were always a number of problems with pyreadline on Windows (not least of it, the fact that it globally affected the standard Python REPL as well as IPython) I'd prefer that not requiring (py)readline remain the default, at least on Windows. If a user prefers to install pyreadline manually and enable it, that's fine, but IPython should work without pyreadline present, and not include it as a dependency of a normal install.

  11. Carreau commented on Mar 2, 2017

    Member

    If there are still people who really insist on using readline, spin out a separate package like rlipython which provides the terminal interface, but make it very clear that it's community maintained, not something we are officially supporting.

    I think that is reasonable, though I believe have some integration (like a flag and/or an env variable) with IPython that restore previous behavior is reasonable. The goal would be to have already well spread scripts and recipes that do rely on IPython readline still working with a simple switch.

    My guess is that a simple config in IPythonApp, that make the TerminalInteractiveShell class use a traitlet, plus a --readline flag that have a preset value to a known external package would be enough.

    The ipython as a separate package will also allow to not block IPython 6, and get a fast iteration cycle if necessary.

    If we give people an easy option to go back to readline, these improvements are not going to happen.

    I doubt that is completely true. The multiline, highlighting, and now completion are still a large advantage of the PTK interface. And user that are pinning to 4.x because they can't even use bothe RL/PTK in parallel have no incentive send patch to IPython / PTK to smooth the behavior.

  12. takluyver commented on Mar 2, 2017

    Member

    I wouldn't integrate it with a switch, because that makes it look like a supported option, and people will file bugs about it here. rlipython is less typing than ipython --readline anyway, and if people are keen to use it as ipython, they can alias it.

  13. rgbkrk commented on Mar 2, 2017

    Member

    Just a note on the current experience of ctrl-r:

    In Bash, when you hit ctrl-r then hit escape, it will exit you out.

    In this one it does nothing when it should close the search area.

  14. Carreau commented on Mar 2, 2017

    Member

    Just a note on the current experience of ctrl-r:
    In Bash, when you hit ctrl-r then hit escape, it will exit you out.
    In this one it does nothing when it should close the search area.

    This one is easy to fix, but not totally:

     ~/dev/ipython master [1]"!!" $ git diff
    diff --git a/IPython/terminal/shortcuts.py b/IPython/terminal/shortcuts.py
    index 22ad111..89713cd 100644
    --- a/IPython/terminal/shortcuts.py
    +++ b/IPython/terminal/shortcuts.py
    @@ -54,6 +54,10 @@ def register_ipython_shortcuts(registry, shell):
         registry.add_binding(Keys.ControlC, filter=HasFocus(DEFAULT_BUFFER)
                             )(reset_buffer)
    
    +
    +    registry.add_binding(Keys.Escape, filter=HasFocus(SEARCH_BUFFER)
    +                        )(reset_search_buffer)
    +
         registry.add_binding(Keys.ControlC, filter=HasFocus(SEARCH_BUFFER)
                             )(reset_search_buffer)

    That will work, but the I-search-backward: will still be visible until you press a new key. This new key will behave has if the backward search was dismissed, but it feels extremely weird.

  15. 13 remaining items

  16. fperez commented on Mar 22, 2017

    Member

    I actually think we should host this on the main IPython org, and put it on pypi. We can also send a slightly more welcoming message to the community, along the lines of:

    this is something that we offer in support of historical compatibility and certain specific use cases where our main interface (prompt-toolkit) isn't optimal. But we do not envision any significant development beyond fixing critical bugs. We only have the resources to offer this as a best-effort solution. If you are interested in doing any significant development on this tool, please let us know via an issue, and we can explore transferring maintainership of the package to you."

    If @ivanov has a few cycles to put in this direction that would be great, but if not I'm willing to do it over the next couple of weeks. I think it's an important part of engaging with all corners of our user community.

    Thanks @Carreau for pushing the work this far!

  17. ivanov commented on Apr 10, 2017

    MemberAuthor

    Thanks everyone, especially @Carreau for getting rlipython up. I've started working on it and whipping it into shape. In case anyone missed it, it now lives under ipython/rlipython. I'll try to get a release out in the next two weeks as I start working with it, but for now I can say it works! There's one known issue right now - In/Out prompts not being colored, which I am tracking in ipython/rlipython#3, but other than that, it seems great.

  18. modified the milestones: 5.4, 6.0 on Apr 18, 2017
  19. fperez commented on Apr 21, 2017

    Member

    @ivanov, ping me on that if you'd like a hand... I'd offered above but I was more than a bit naïve about my time availability these last few weeks. Nonetheless I want to help this reach a solid solution for all cmd line users, so I'm still willing to pitch in if you need a hand (and would enjoy doing so :)

  20. Carreau commented on May 10, 2017

    Member

    Closed by #10373 and backported as #10463

  21. heroxbd commented on May 11, 2017

    Hi, with this issue closed, is there any way to disable prompt_toolkit completely?

  22. Carreau commented on May 11, 2017

    Member

    Hi, with this issue closed, is there any way to disable prompt_toolkit completely?

    yes, if you set the TerminalIPythonApp.interactive_shell_class to rlipython in your config file, then prompt_toolkit should not even be imported. The readme of rlipython give more info on how to do this.

  23. ivanov commented on May 17, 2017

    MemberAuthor

    For anyone still subscribed on this issue: I just released rlipython version 0.1.0, you can now pip install rlipython and get the old readline working by default in IPython after you import rlipython; rlipython.install().

  24. dimpase commented on Oct 8, 2017

    Late to the party, but let me reiterate that RT at present is a no-no is to projects that have modules not designed for multithreaded initialisation, see Sage's ticket 22766. (And this is the primary reason we need to do something about it in Sage).

    As well, a comment on a general problem with the present RT: it triggers multi-threaded importing of Python modules while doing tab-completion. We very much doubt that it is safe.

    Last but not the least - given that IPython tab completion causes segfaults, how about a means for non-interactive testing of it?

  25. takluyver commented on Oct 9, 2017

    Member

    @jonathanslenders have you run across any issues with completion running in a separate thread? Is there an option to make it run synchronously?

  26. jonathanslenders commented on Oct 21, 2017

    Contributor

    Hi @takluyver,

    Excuse me for the late reply. I got married last month, and so I've been offline for a while. ;)

    I'm working on prompt_toolkit 2.0 which already supports both synchronous (in the main thread) and asynchronous (in other thread) completion. I've been working on 2.0 for almost a year and hope to release that in a couple of months.

    For synchronous completion, you have to keep in mind that if the completer is not super fast, that this will introduce a delay after every key stroke (if you have complete-while-typing on). I believe that Jedi for instance is not super fast.

    I know that certain libraries have some issues with asynchronous completion. I think we should encourage the authors of these libraries to make sure that importing them in the first place can be done from any thread. In the future, I'd make it an option to run the completions sync or async, but still prefer to have async completion by default. It makes the user experience so much nicer.

  27. dimpase commented on Oct 21, 2017

  28. takluyver commented on Oct 23, 2017

    Member

    Congratulations! Of course there's no need to apologise - we get your awesome library for free, so any support has to be as and when it's convenient for you. Best wishes to you and your partner.

    I think we'll likely switch to synchronous completions when they're available. We don't use complete-as-you-type, because we enable the history search feature which is mutually exclusive with that.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL