[IPython-dev] Comments on IPython Qt widgets

Brian Granger ellisonbg at gmail.com
Mon Feb 7 23:30:04 EST 2011


On Mon, Feb 7, 2011 at 8:25 PM, Robert Kern <robert.kern at gmail.com> wrote:
> On 2011-02-07 22:15 , Brian Granger wrote:
>> Charlie,
>
>>> - Currently, the only IPython kernel available for use with the Qt widget
>>> runs the IPython interpreter in a separate process.  For QGIS, it would be
>>> very nice to have the option of running an IPython kernel inside the same
>>> process as the Qt widgets.  IPython would then have direct access to the
>>> QGIS interface and would be able to inspect and operatie on the PyQt4
>>> objects that compose the GUI providing a powerful tool for users performing
>>> spatial analysis and developers building plugins.
>>> Are there any plans to develop IPython kernels that do not run
>>> in separate processes?  I spent a few days trying to build one myself by
>>> wrapping an InteractiveShell, but I feel like I am flailing a little bit
>>> when it comes to creating a kernel_manager that will integrate with the Qt
>>> frontend.  If anyone has any design advice on how to implement an in-process
>>> kernel I would love to hear it.
>>
>> There is interest in having an in process IPython, but I honestly
>> think it will not work very well at all.  This is mostly because of
>> the GIL.
>
> I don't see why. The shell may block. This is not a big deal. This is what
> people expect of shells embedded in apps.

It is not the blocking of the shell that is the problem, it is the
blocking of the *entire* app that is the problem.

>> I would simply turn the model inside out.  If you run the
>> QGIS code that has all the PyQt widgets in the IPython kernel (start
>> the kernel with the pyqt event loop running using --pylab qt) your
>> ipython session will have all the access that it needs.  IOW, don't
>> embed IPython in your app, embed your app in IPython.
>
> This is not an option for most such apps.

I do realize that.

Brian

> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>  that is made terrible by our own mad attempt to interpret it as though it had
>  an underlying truth."
>   -- Umberto Eco
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com



More information about the IPython-dev mailing list