X Tutup
Skip to content

Terminal interface using prompt_toolkit? #8489

@takluyver

Description

@takluyver

prompt_toolkit is a pure-Python terminal interface library aimed at creating interactive consoles. ptpython is a Python console built with it, including ptipython which uses IPython internally. Unlike most terminal interface things, it also works on Windows.

We are considering switching our primary terminal interface from readline to prompt_toolkit, because:

  • readline is now rather limiting: we can't do syntax highlighting or proper multiline editing; showing tab completions permanently adds them to the terminal scrollback buffer. We can provide a much better user experience with something like prompt_toolkit.
  • Depending on readline is a pain beyond Linux: we use pyreadline on Windows, but that's essentially unmaintained and is about to break with Python 3.5. Macs ship with libedit, which is theoretically equivalent but has bugs, so we rely on the third party gnureadline package.

We'll probably need to maintain a simpler fallback mode for situations where prompt_toolkit may not work (@fperez thought ssh-ing to old servers was a likely example).

@jonathanslenders : how much work do you think it would be to convert our existing readline + input() interface to prompt_toolkit? I know you've already made ptipython, and I've started having a look at that, but I'm not clear how much of that code we'd need and how much duplicates things we already do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup