##// END OF EJS Templates
Moving extensions to either quarantine or deathrow....
Moving extensions to either quarantine or deathrow. When a module is moved to quarantine, it means that while we intend to keep it, it is currently broken or sufficiently untested that it can't be in the main IPython codebase. To be moved back into the main IPython codebase a module must: 1. Work fully. 2. Have a test suite. 3. Be a proper IPython extension and tie into the official APIs. 3. Have members of the IPython dev team who are willing to maintain it. When a module is moved to deathrow, it means that the code is either broken and not worth repairing, deprecated, replaced by newer functionality, or code that should be developed and maintained by a third party.

File last commit:

r2267:928c921b
r2267:928c921b
Show More
ipy_server.py
37 lines | 1.0 KiB | text/x-python | PythonLexer
""" Simple TCP socket server that executes statements in IPython instance.
Usage:
import ipy_server
ipy_server.serve_thread(16455)
Now, to execute the statements in this ipython instance, open a TCP socket
(port 16455), write out the statements, and close the socket.
You can use e.g. "telnet localhost 16455" or a script to do this.
This is a bit like 'M-x server-start" or gnuserv in the emacs world.
"""
from IPython.core import ipapi
ip = ipapi.get()
import SocketServer
# user-accessible port
PORT = 8099
class IPythonRequestHandler(SocketServer.StreamRequestHandler):
def handle(self):
#print "connection from", self.client_address
inp = self.rfile.read().replace('\r\n','\n')
#print "Execute",inp
ip.runlines(inp)
def serve(port = PORT):
server = SocketServer.TCPServer(("", port), IPythonRequestHandler)
print "ipy_server on TCP port", port
server.serve_forever()
def serve_thread(port = PORT):
import thread
thread.start_new_thread(serve, (port,))