[IPython-user] [IPython-dev] A few notes on threading+GUI event loops in Ipython1

Fernando Perez fperez.net@gmail....
Thu Mar 20 04:25:32 CDT 2008


On Wed, Mar 19, 2008 at 9:33 PM, Barry Wark <barrywark@gmail.com> wrote:

>  >  >  I propose a two-option
>  >  >  solution that may allow us to isolate the threading/toolkit
>  >  >  integration issues to a smaller part of the code tree:
>  >  >
>  >  >  1. ipython1.core should be useable from the commandline/terminal, like
>  >  >  current ipython0, without GUI toolkit integration. If interactive
>  >  >  matplotlib is an absolute requirement, I suggest we use a two-process
>  >  >  solution ala ezplot.
>  >
>  >  I am not familiar with ezplot, but my initial feeling is that we will
>  >  need to handle this case using threads - mainly because of the need to
>  >  have the GUI and users threads share objects.  But, could you say more
>  >  about how ezplot handles this.
>
>  Well, I spoke too soon. ezplot was written by Bill Baxter to serve as
>  a matplotlib server for using matplotlib without blocking. It's a
>  really neat start and I've used it succesfully for several prototype
>  apps on OS X. But guess what: it uses Twisted. Strike that. I don't
>  know of a solution for using matplotlib via ipython1.core without
>  blocking and without having the threading issues that IPython0 is
>  dealing with. This will clearly take more thought from folks more savy
>  than I am... unless we're willing to say Twisted is required for
>  non-blocking matplotlib use.
>
>  >  >  2. IPython1 GUI toolkit integration is done via Twisted. As I said
>  >  >  above, any failings in Twisted's GUI reactors can then be tackled by
>  >  >  both projects, to everyone's benefit. There's currently a branch of
>  >  >  Twisted that adds support for setuptools. Since ipython1 is
>  >  >  distributed/built/installed via setuptools, it seems reasonable to add
>  >  >  GUI integration via twisted as an add-on.

I should mention that in my view it is *critical* that we maintain
twisted as an optional dependency for a pure-terminal system that can
talk to the gui toolkits the way ip0 does today.  There are many, many
users of ipython who make good use of the GUI toolkit support for whom
adding a twisted dependency would be a hassle I don't want to get
into.

That code is fragile, but it works in  many many cases, and we've had
recent improvements to  it.  I'm willing to put in time to going over
it again with a fine tooth comb, because the benefit is important
enough to warrant having the functionality without twisted.

I'm all for having a twisted {qt,wx,etc}reactor-based setup, but I
don't think we'll win many hearts if we tell our users that  ipython
will all of a sudden start needing Twisted for something that it's
done for years (if not 100% robustly, OK for many people).

Sorry to drop in in the middle without fully addressing the whole
conversation, I'm in the middle of a meeting but I wanted to at least
pitch in with this point before we lose the 'window of relevance' for
this conversation.

Cheers,

f


More information about the IPython-user mailing list