[IPython-dev] ipython embedded in twisted, no threads

Stefan Rank list-ener at strank.info
Mon Apr 16 02:31:27 EDT 2007

[apologies if this arrives twice, posting via gmane didn't work - yet.]

attached is an ugly first attempt at embedding IPython in a twisted
application without using threads.

twisted.internet.stdio and a LineReceiver implementation are responsible
for getting input events.
I had to subclass the IPython shell and rearrange code to
create a non-blocking callback interface (splitting on the main,
blocking, raw_input call).

It's far from perfect: readline functionality is missing (no commandline
navigation, history navigation, completion), and sometimes continuation
lines eat the input counter (In[2] ... In[4]).

Would IPython developers be interested in patches that allow a less ugly
version of such a callback-friendly subclass? ;-)
The basic idea: refactor the main loop (InteractiveShell.interact) to::

    while ...:

(I think it might also be interesting for the frontend to the IPython
parallel computing effort, which uses twisted.)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: twistedipython.py
Type: text/x-python
Size: 13037 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20070416/abe920f2/attachment.py>

More information about the IPython-dev mailing list