[IPython-dev] embedding ipython

MinRK benjaminrk at gmail.com
Thu Jan 12 02:09:25 EST 2012

On Wed, Jan 11, 2012 at 22:09, Fernando Perez <fperez.net at gmail.com> wrote:

> Hey Satra,
> On Tue, Jan 10, 2012 at 12:56 PM, Satrajit Ghosh <satra at mit.edu> wrote:
> > i'm trying to look into the possibility of embedding ipython into the
> latest
> > version of 3d slicer (slicer.org). slicer is a PythonQt application and
> they
> > bundle their own python interpreter with it.
> >
> > any pointers in the right direction would be much appreciated.
> A starting point would be to look at Robert's hack:
> http://mail.scipy.org/pipermail/ipython-dev/2011-December/008456.html
> now, ideally we'd do this correctly, by refactoring the Qt console
> code so that it can use a KernelManager that could be either local or
> remote, and having a local manager for the in-process cases.  With
> this done, the terminal (or 'plain' ipython) and console (the new
> terminal-based two-process one)  clients could also then be cleaned up
> to use the exact same architecture.

I should note that the QtConsole (and any derivative of of ShellApp) has a
kernel_manager_class, and subclasses can simply change this value to use
different KernelManagers.  So as it stands currently, you should be able to

class MyKernelManager:
    # do whatever special things you need to do

class MyQtApp(QtConsoleApp):
    kernel_manager_class = MyKernelManager

And you should be done.

Unfortunately, code used to launch tabs other than the first was *not*
updated to use this, and has QtKernelManager hardcoded instead of using the
attribute.  I've opened the trivial
PR<https://github.com/ipython/ipython/pull/1257>required to fix this.

> That is the right way to do this and not too much work, but not a tiny
> amount of work either.  I don't know if right now you have the
> bandwidth to try to do it.  If you do, I'd be happy to give you a hand
> though, so let me know.
> Doing that refactoring is a really important step in finishing up the
> architectural clenaup we started with Brian's summer'09 work, so it
> would be awesome to tackle it.
> Cheers,
> f
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20120111/301de017/attachment.html>

More information about the IPython-dev mailing list