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

Brian Granger ellisonbg.net at gmail.com
Sat Dec 6 20:06:22 EST 2008


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:

BLOCKBEGIN
import math
a = 2.0*math.pi
BLOCKEND

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.

Cheers,

Brian



More information about the IPython-dev mailing list