GithubHelp home page GithubHelp logo

Support pyreadline about qtconsole HOT 18 CLOSED

jupyter avatar jupyter commented on May 23, 2024
Support pyreadline

from qtconsole.

Comments (18)

wmvanvliet avatar wmvanvliet commented on May 23, 2024 1

Ctrl+Shift+K works for me, Ctrl+K does not work on my mac.

from qtconsole.

ccordoba12 avatar ccordoba12 commented on May 23, 2024 1

Ctrl+K works for me on Linux and Windows. @wmvanvliet, would you like to take a look at this one for Mac?

from qtconsole.

ccordoba12 avatar ccordoba12 commented on May 23, 2024

I think this is not possible because qtconsole uses Qt widgets and features to emulate the behavior of a real console (i.e. a tty one, where readline works), but it doesn't use any of its technologies.

from qtconsole.

thekafkaf avatar thekafkaf commented on May 23, 2024

Hi @ccordoba12, first of all - no such thing as "impossible" :)

Now, I get how the qtconsole works and that it doesn't really uses the readline - but we can hook the readline calls, for example - if as a first challenge readline uses raw_input which blocks the kernel - we can overwrite it and send a signal to the frontend and wait for a return, we can basically rewire our endpoints("complete_info", "execute" and the history saved by HistoryWidget) to emulate a use of readline.

What do you think?

from qtconsole.

thekafkaf avatar thekafkaf commented on May 23, 2024

Bumping, can we at least try to think of a way, it's possible, I'm just asking for some guidance for the best possible solution.

When the kernel is blocking in a While True, and querying the channel for an input from the frontend, we can query the other endpoints as well, am I missing something?

from qtconsole.

ccordoba12 avatar ccordoba12 commented on May 23, 2024

I think it would be a mess to try to support readline and it's not worth the effort.

Besides, I can't provide guidance because I don't have enough knowledge of the Jupyter internals to do so ;-)

from qtconsole.

minrk avatar minrk commented on May 23, 2024

I think we shouldn't use readline in the qtconsole. The kernel produces completions entirely without readline. Readline is just one way of putting those completions into a terminal UI. Since we don't use a terminal UI, readline doesn't offer much value in the qtconsole.

from qtconsole.

CRP avatar CRP commented on May 23, 2024

what features of readline do you need? if it is just a matter of getting history and completion in pdb, then probably forcing in readline isn't the corret route...

from qtconsole.

thekafkaf avatar thekafkaf commented on May 23, 2024

It's not about adding value, it's about supporting the current python libs.
QtConsole is a shell, and as such should keep compatibility with the console, right now libs that use readline are broken/half-usable, IMO this is awful.

To solve this, we could either patch it, so qtconsole would behave nicely with readline, or support multiple Consoles\Kernels in a single screen(which you said once, you will never support).
What do you think? Can we try to solve this?

from qtconsole.

ccordoba12 avatar ccordoba12 commented on May 23, 2024

it's about supporting the current python libs

Which libraries?

QtConsole is a shell

Nop, qtconsole just emulates several behaviors of a terminal but it has never tried to be a complete one. That's why, for example, running

!top

doesn't work on it.

To solve this, we could either patch it, so qtconsole would behave nicely with readline

Or even simpler: just simulate whatever readline features you want to have using Qt widgets and features.

from qtconsole.

thekafkaf avatar thekafkaf commented on May 23, 2024

ipdb as the obvious one, just search for cli language:python on github or readline languge:python, and you'll find a handful.

You're right, it's not a complete terminal, but it should strive to be a complete IPython terminal!
Which means, it should try it's best to be able to run python libs.

Sounds interesting, but how is that simpler? Can you give an example?

from qtconsole.

ccordoba12 avatar ccordoba12 commented on May 23, 2024

ipdb as the obvious one

ipdb doesn't work because of a limitation of the frontend/kernel architecture, not because qtconsole lacks readline support. I think the kernel blocks once you enter pdb, and that's why you can't have history browsing and all other nice features you have in terminal IPython.

it should strive to be a complete IPython terminal!

No need of it. As I said, trying to force qtconsole to be a real terminal would be a mess. If you want a real terminal, you can just open one :-)

Sounds interesting, but how is that simpler? Can you give an example?

Please take a look at how history browsing works in qtconsole. Or how Ctrl+K and similar shortcuts work.


Given that @minrk and me are -1 on this idea, I think you're on your own if you want to implement it, and even then it could not be merged. Sorry, but IMHO this is not something that deserves to be discussed further.

from qtconsole.

nikohansen avatar nikohansen commented on May 23, 2024

what features of readline do you need?

I am (desperately) missing control-k (kill text to end of line).

from qtconsole.

ccordoba12 avatar ccordoba12 commented on May 23, 2024

That works on qtconsole, I use it regularly :-)

from qtconsole.

nikohansen avatar nikohansen commented on May 23, 2024

I installed Anaconda a few days ago on MacOS (Sierra), and control-k doesn't work for me. Any hints how to make it work? Could it be left overs from previous installations?

EDIT: FTR, control-k is effective in the notebook and in the console, just not in the qtconsole.

Jupyter QtConsole 4.2.1
Python 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 17:43:17) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

from qtconsole.

nikohansen avatar nikohansen commented on May 23, 2024

Same here, it works with shift. That's pretty weird that the key is different only for qtconsole. I don't see how I will get used to this.

from qtconsole.

wmvanvliet avatar wmvanvliet commented on May 23, 2024

see #164

from qtconsole.

wmvanvliet avatar wmvanvliet commented on May 23, 2024

Closing this. The volunteers working on qtconsole will not add readline support anytime soon. Feel free to take a stab at it yourself if you feel up to it.

from qtconsole.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.