[Twisted-Python] IPython embedded in twisted (and Re: readline-like behavior inside Twisted)

Stefan Rank list-ener at strank.info
Thu Apr 12 02:45:35 MDT 2007


Hi,

on 08.04.2007 16:51 Jean-Paul Calderone said the following:
<snip>
> What would actually be really excellent is if both
> insults and pyreadline used the same underlying readline model code which
> was devoid of input/output code, then each could focus on the part it 
> should
> really care about (dealing with events or talking to a windows console or
> what have you) and improvements to the actually interesting behavior in the
> readline model could be shared between the two.
> 
> To some extend insults already has this (I've tried to factor as much of 
> the
> interesting behavior out away from the Twisted parts), and I see this is 
> also
> how at least some of pyreadline is structured (eg 
> lineeditor/history.py), so
> it might actually be feasible to merge the two backends into one shared
> thing.

That would be perfect.

on 09.04.2007 16:33 Michael Hudson said the following:
<snip>
> This isn't really a followup, but it seems worthwhile to mention that GNU
> readline itself has a callback interface (rl_callback_read_char) that would be
> suitable for using with Twisted.  You'd have to use ctypes or something to get
> to it, but it's there.

Seems even better. This interface, however, wants to consume the input 
itself, so a t.i.stdio-alike would need to poll/select for input events 
and then call rl_callback_read_char to actually consume them, right?


Attached is my ugly first attempt at embedding IPython in twisted 
without threads.
(no readline behaviour, only tried it on Windows)

Hopefully this catches the interest of someone with more 
time/knowledge... ;-)

Will also post on the IPython list to see if they would be willing to 
change their code to be more callback-friendly.

cheers,
stefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: testtwistedipython.py
Type: text/x-python
Size: 12974 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20070412/2d518160/attachment-0002.py>


More information about the Twisted-Python mailing list