[IPython-dev] Embedding IPython+zmq
Fernando Perez
fperez.net at gmail.com
Mon Apr 23 00:26:23 EDT 2012
Hi Ray,
On Thu, Apr 12, 2012 at 9:44 AM, Ray Osborn <ROsborn at anl.gov> wrote:
> I didn't want to hijack the other thread so I thought I would create a new one. I just read the page that Jason Grout references about making the two-process iPython standard. I have, I think successfully, adapted Robert Kern's method of creating a kernel that fakes zmq messages within a single process, so that I can embed the iPython shell in a Qt GUI. I need this because I want to display items in the iPython shell namespace in a separate widget and need to trigger Qt signals when certain items in the namespace are changed. As Robert admits, this requires hacking into the zmq code and is probably not as elegant as it could be.
>
> Are there plans to refactor the two-process code to enable a single-process mode easily? Or perhaps zmq messaging could be used to facilitate communication to external GUI widgets, such as providing a way of mapping messages to signals? This is not my area of expertise, so let me know if I have not explained the problem clearly enough.
You have, and indeed I would *love* to have the time for a clean
refactoring of the various kernel/client classes to make it really
trivial to switch from in-process to out-of-process. In my mind, all
clients should have simply a .kernel attribute that could be either a
LocalKernel or a RemoteKernel, with otherwise identical APIs. Then,
changing the Qt console from using a remote to a local kernel would be
a trivial one-liner.
We've done bits and pieces of that, but nobody so far has had the
bandwidth to spend on doing this entire refactoring cleanly.
Ultimately that could even produce a notebook that runs without zeromq
(albeit opening only one .ipynb per http port)...
So in summary: yes, we want to do it. No, it's not on our immediate
work list due to lack of time/higher priorities.
If anyone is interested in doing this right, we'd be happy to review
relevant pull requests, though.
Until then, hacks like what you're using will be the solution, I'm afraid.
Cheers,
f
More information about the IPython-dev
mailing list