Repository navigation
Refactor inputhook to allow easy extension - #5666
Conversation
|
@vindolin, do you have time to have a look at this before I go ahead with details like tests and docs? |
|
Hi, sorry I was a bit occupied :( |
|
I rewrote all of the current GUIs to use this mechanism: https://github.com/takluyver/ipython/blob/inputhook-extensible/IPython/lib/inputhook.py#L278 The only difference is that they're in one module, but it should work just the same for code in another module. |
|
Ok great, I try to play around with this on Friday. |
|
https://github.com/vindolin/IPython-Clutter-GUI-Integration Finally I can poke around in the running GUI instance, that makes learning the framework so much easier :) |
5b055a7 to
e2e856e
Compare
|
I've rebased this and added an extension mechanism for event loops in the kernel, along with documentation of both systems. I don't see an easy way to add tests (and this is a part of our code that already only has some manual tests), so I've set it back to 'Needs review'. |
There was a problem hiding this comment.
Do you want a deprecation warning?
Also, update examples to not use these
There was a problem hiding this comment.
note about deprecated functions here or the new config/eventloops doc?
|
This is really nice. And great job on the thorough doc. What are your plans for testing? I see an unchecked task box. |
|
I added a whatsnew note about the deprecated functions. My plans for testing currently amount to: don't, because it's hard, and we've never had automated tests for this, as far as I know. I've verified that the examples in |
|
Fair enough, I just saw the unchecked task box and wanted to check in. Merging away, then. |
Refactor inputhook to allow easy extension
There was a problem hiding this comment.
@jhamrick says I broke the --gui=osx option. It looks like it was already doing nothing, and it just got lost in the refactor. So now ipython --gui=osx refuses to start instead of silently ignoring the option.
The option is used in @jhamrick's 'moderately popular' emacs config, so we may want to put it back with a deprecation warning for a release cycle.
There was a problem hiding this comment.
A deprecation is fine, if we can figure it out. Some further explanation: this key is only defined because enable_matplotlib('foo') implies enable_gui('foo'). Nothing needs to be done for OS X eventloop integration, but the key needs to be defined in order for enable_matplotlib('osx') to pass. If there's a better way to express 'this matplotlib backend doesn't actually need eventloop integration' beyond a null function in the dict, then that would be fine, too. But enable_matplotlib('osx') does need to work, and it doesn't, currently.
|
On both OS X and Linux with PyQt5, I have to revert out this commit. If I leave this commit in, control-c is borked. (control C pressed here) During handling of the above exception, another exception occurred: Traceback (most recent call last): If you suspect this is an IPython bug, please report it at: You can print a more detailed traceback right now with "%tb", or use "%debug" Extra-detailed tracebacks for bug-reporting purposes can be enabled via: Traceback (most recent call last): If you suspect this is an IPython bug, please report it at: You can print a more detailed traceback right now with "%tb", or use "%debug" Extra-detailed tracebacks for bug-reporting purposes can be enabled via: |
|
Thanks @erikhvatum . Can you make a new issue for that so it doesn't drop under the radar. |
|
@takluyver Issue for PyQt5 ctrl-c: #6804 |
Refactor inputhook to allow easy extension
Not ready for merge
Prompted by #5645, @minrk suggested that we should provide an extension mechanism for input hooks, so that that code (which we don't use, test or maintain very much) can be maintained outside IPython. This is a prototype of that.
To define a new GUI integration, you register a class like this:
It can also define a
disable()method, but only one of the 7 we include needs that. Once this code has run (e.g. by importing a module or using%load_ext), the user should be able to do%gui clutter.To do: