tomerfiliba at gmail.com tomerfiliba at gmail.com
Wed Feb 15 21:33:12 CET 2006

Remote Python Call (RPyC) 2.32

RPyC is a transparent, symmetrical python library for
distributed-computing. It began as an RPC library (hence the name), but
grew into something much more comprehensive with many use cases. It
basically works by giving you full control over a remote
slave-interpreter (a separate process), which can perform operations on
your behalf.

There's much more info on the site, but just to show how simple and
straight-forward RPyC is, here's a little code snippet:

# first run the forking or threaded server (in the Rpyc/Servers
directory) on the localhost.
# this is a demo of a client
from Rpyc.Factories import SocketConnection
from Rpyc.Utils import *

# c is the connection to the slave-server
c = SocketConnection("localhost")

# and the slave works like you would expect -- importing modules and
executing code
print c.modules.sys.path
print c.modules.sys.path[-1]

my_remote_list = c.modules.__builtin__.list("abcdef")
print dir(my_remote_list)

print c.modules.__builtin__.eval("5*3")

# but dont use eval. it's dirty. keep all the logics at the client
# and only have the slave perform work on your behalf

# another common case: working with files
f = c.modules.__builtin__.open("lala.txt", "wb")
f.write("nothing really")

So I hope this little snippet starts your appetite. There's a lot more
(like callbacks, async objects, threads, events, etc.), so have a look.

-tomer, king of the ganges

More information about the Python-announce-list mailing list