[IPython-dev] IPython proposal: getting rid of "ipython -pylab\-wthread\etc."

Brian Granger ellisonbg.net at gmail.com
Thu Jul 16 13:04:33 EDT 2009


Hello all,

[sent to mpl-dev, enthought-dev and ipython-dev]

This summer, we are doing some major refactoring of IPython's core.  One of
the things I am working on is changing how IPython's works with GUI
toolkits.  These changes will have a significant impact (hopefully for the
better) on your project, so I wanted to open a discussion about this issue.

Here is the current situation:  currently, IPython uses threads to allow GUI
event loops.  This code lives in IPython.Shell and is extremely subtle, hard
to maintain and fragile.  Fernando and John Hunter have done a fantastic job
in developing this code, but in the long run we need a more robust approach.

Here is the proposal:  Python has an obscure hook called PyOS_InputHook.  By
using this hook, GUI toolkits can interleave their event loop with a command
line program *without threads*.  Even though PyOS_InputHook is not well
known, this is how Python's built-in integration with Tk works.  The good
news is that other GUI toolkits are starting to support PyOS_InputHook:

* PyGTK 2.15.1 has this.
* The mpl MacOSX backend works this way
* Recent versions of PyQT 4 have this.
* I am working with Robin Dunn to implement this in wxPython 2.8 and 2.9

Bottom line: once people are using these recent/upcoming versions of the GUI
toolkits, IPython will no longer need to maintain the code in Shell.py and
IPython won't need to have -pylab/-wthread/etc options.

So, how does affect your project?

* People will be able to use your project interactive from the regular
python prompt.
* You will need to make small changes to your GUI toolkits initialization
code.
* All of us will need to coordinate version transitions to make sure that
there is a clean transition to this new approach.
* I need help testing the new approach (especially with wxPython) to make
sure that your project actually works with the new approach.

What needs to be done at this point?

* I would like to discuss how the transition should be made in terms of
versions.
* I need help testing this new approach in the various toolkits - especially
with wx.
* I want to see if there are other issues related to this that I am missing.

Cheers,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20090716/837080c2/attachment.html>


More information about the IPython-dev mailing list