jespern / puck
Stateful RPC in Python -- Not developing this anymore, check out RPyC instead: http://rpyc.wikidot.com/
Puck
Stateful RPC over TCP/JSON for Python
Puck is a small Python library for doing RPC, but keeping a persistent connection to the server, and maintaining a remote stack. This means that Puck is agnostic to the content, as all objects will stay on the servers stack, and only simple proxy objects will be available to the client.
These proxy objects will appear to be instances of the remote object, and will even retain __doc__ and __repr__, but any method invocation will happen on the server. It's not transparent, it's translucent.
Puck builds on Twisted, a very scalable framework for networking in Python.
Terminology
First thing you are going to need is a Hub. A Hub is basically a server, which defines the operations available for the client to call. All methods that are exported must be prefixed remote_. Your Hub must subclass puck.hub.Hub.
Protocol
Documented more thoroughly in Protocol. In short, it's all JSON, so you could hook it up to most languages, like Perl or even Javascript.
Simple example
The Hub (examplehub.py):
The client (client.py):
And finally the tac (examplehub.tac):
You can now run this with:
twistd -noy examplehub.tac
And you now have a working hub + client + twistd deployment server!
This revision is from 2008-08-29 21:17
