Show More
@@ -0,0 +1,38 b'' | |||||
|
1 | """ Simple TCP socket server that executes statements in IPython instance. | |||
|
2 | ||||
|
3 | Usage: | |||
|
4 | ||||
|
5 | import ipy_server | |||
|
6 | ipy_server.serve_thread(16455) | |||
|
7 | ||||
|
8 | Now, to execute the statements in this ipython instance, open a TCP socket | |||
|
9 | (port 16455), write out the statements, and close the socket. | |||
|
10 | You can use e.g. "telnet localhost 16455" or a script to do this. | |||
|
11 | ||||
|
12 | This is a bit like 'M-x server-start" or gnuserv in the emacs world. | |||
|
13 | ||||
|
14 | """ | |||
|
15 | ||||
|
16 | import IPython.ipapi | |||
|
17 | ip = IPython.ipapi.get() | |||
|
18 | ||||
|
19 | import SocketServer | |||
|
20 | ||||
|
21 | # user-accessible port | |||
|
22 | PORT = 8099 | |||
|
23 | ||||
|
24 | class IPythonRequestHandler(SocketServer.StreamRequestHandler): | |||
|
25 | def handle(self): | |||
|
26 | #print "connection from", self.client_address | |||
|
27 | inp = self.rfile.read().replace('\r\n','\n') | |||
|
28 | #print "Execute",inp | |||
|
29 | ip.runlines(inp) | |||
|
30 | ||||
|
31 | def serve(port = PORT): | |||
|
32 | server = SocketServer.TCPServer(("", port), IPythonRequestHandler) | |||
|
33 | print "ipy_server on TCP port", port | |||
|
34 | server.serve_forever() | |||
|
35 | ||||
|
36 | def serve_thread(port = PORT): | |||
|
37 | import thread | |||
|
38 | thread.start_new_thread(serve, (port,)) No newline at end of file |
@@ -64,10 +64,7 b' def getRootModules():' | |||||
64 | return [] |
|
64 | return [] | |
65 |
|
65 | |||
66 | modules += sys.builtin_module_names |
|
66 | modules += sys.builtin_module_names | |
67 |
|
67 | |||
68 | #special modules that don't appear normally |
|
|||
69 | modules.extend(['xml']) |
|
|||
70 |
|
||||
71 | modules = list(set(modules)) |
|
68 | modules = list(set(modules)) | |
72 | if '__init__' in modules: |
|
69 | if '__init__' in modules: | |
73 | modules.remove('__init__') |
|
70 | modules.remove('__init__') | |
@@ -88,7 +85,7 b' def moduleList(path):' | |||||
88 | folder_list = [] |
|
85 | folder_list = [] | |
89 | #folder_list = glob.glob(os.path.join(path,'*')) |
|
86 | #folder_list = glob.glob(os.path.join(path,'*')) | |
90 | folder_list = [p for p in folder_list \ |
|
87 | folder_list = [p for p in folder_list \ | |
91 | if os.path.exists(os.path.join(p,'__init__.py'))\ |
|
88 | if os.path.exists(os.path.join(path, p,'__init__.py'))\ | |
92 | or p[-3:] in ('.py','.so')\ |
|
89 | or p[-3:] in ('.py','.so')\ | |
93 | or p[-4:] in ('.pyc','.pyo')] |
|
90 | or p[-4:] in ('.pyc','.pyo')] | |
94 |
|
91 |
@@ -1,9 +1,19 b'' | |||||
|
1 | 2007-12-28 Ville Vainio <vivainio@gmail.com> | |||
|
2 | ||||
|
3 | * ipy_server.py: TCP socket server for "remote control" of an IPython | |||
|
4 | instance. | |||
|
5 | ||||
1 | 2007-12-28 Fernando Perez <Fernando.Perez@colorado.edu> |
|
6 | 2007-12-28 Fernando Perez <Fernando.Perez@colorado.edu> | |
2 |
|
7 | |||
3 | * IPython/dtutils.py: Add utilities for interactively running |
|
8 | * IPython/dtutils.py: Add utilities for interactively running | |
4 | doctests. Still needs work to more easily handle the namespace of |
|
9 | doctests. Still needs work to more easily handle the namespace of | |
5 | the package one may be working on, but the basics are in place. |
|
10 | the package one may be working on, but the basics are in place. | |
6 |
|
11 | |||
|
12 | 2007-12-27 Ville Vainio <vivainio@gmail.com> | |||
|
13 | ||||
|
14 | * ipy_completers.py: Applied arno's patch to get proper list of | |||
|
15 | packages in import completer. Closes #196. | |||
|
16 | ||||
7 | 2007-12-20 Ville Vainio <vivainio@gmail.com> |
|
17 | 2007-12-20 Ville Vainio <vivainio@gmail.com> | |
8 |
|
18 | |||
9 | * completer.py, generics.py(complete_object): Allow |
|
19 | * completer.py, generics.py(complete_object): Allow |
General Comments 0
You need to be logged in to leave comments.
Login now