rpyc-stream
A simple (130 loc), one-file Python RPC System that is based on Streams allowing for cross-language/SSH usage.
This is a port of the nodejs RPC system by @dominictarr.
Examples using SSH
Local Code
Python (local.py
):
# -*- coding: utf-8 -*- from rpycstream import RPCfrom subprocess import Popen, PIPE, STDOUT # python worker = # nodejs # worker = Popen(['ssh', 're.mo.te.ip', 'node', 'remote.js'], stdout=PIPE, stdin=PIPE, stderr=STDOUT) # pipe into each other rpc = # remote call remote = # which is equivalent to if err: raise err print "msg:", msg if __name__ == '__main__':
NodeJs (local.js
):
var cp = ;var rpc = ; // nodejsvar worker = cp;// python// var worker = cp.exec('ssh re.mo.te.ip python remote.py'); var client = ;client;workerstdout; client;
Remote Code
Python (remote.py
):
# -*- coding: utf-8 -*- from rpycstream import RPC return '%s was bitten by a python' % name if __name__ == '__main__': rpc =
NodeJs (remote.js
):
// see https://github.com/dominictarr/rpc-streamvar rpc = ; var server = ; server;processstdin;
Development
- Source hosted at GitHub
- Report issues, questions, feature requests on GitHub Issues
Authors
Marcel R. (riga)