[IPython-dev] Generic design for an IPython servers that talks to editors (TextMate, vi, emacs)

Matt Foster matt.p.foster at gmail.com
Tue Dec 9 06:25:14 EST 2008

On Sun, Dec 7, 2008 at 1:06 AM, Brian Granger <ellisonbg.net at gmail.com> wrote:
> Hi,
> (yes, I put TextMate first in that list ;-) )
> I am in the process of designing a simple IPC mechanism that will
> allow various editors to talk to IPython.  This has been done before,
> but I was to clean all this up and provide a single solution that all
> editors can use.  So, here is the idea:
> * Create a UNIX socket at the location:
> ~/.ipython/IPY-SERVER-{time}
> Where {time} will be some simple time stamp.
> * Create a server that listens on this socket using Twisted.  The
> protocol on this socket will be the following:
> import math
> a = 2.0*math.pi
> That is, it will be line based, and the client will have to send
> BLOCKBEGIN/BLOCKEND to mark the beginning and end of a block of code.
> When the client sends BLOCKEND, IPython will execute the code.
> One question, what should we use to mark the end of lines (what does
> IPython use) \n or \r\n?
> * We should have a command line switch that activates this server upon
> starting IPython (--server)
> * All editors should then use this to talk to IPython.  All other
> approaches will be phased out.
> * The new design will make it very easy to add new capabilities to the server.


This sounds really good. Do you think a twisted-based client library
would be a good idea too?

Also, as something of an aside, will it be possible to add executed
lines/files to IPython's history?
I've got a feeling this would involve modifying ipapi.runlines but
I've no idea where to start.



Matt Foster | http://hackerific.net

More information about the IPython-dev mailing list