wirepickle
Effortless python remote procedure calling with pickle over ZeroMQ. Allows you to expose a single class instance as an API server over every transport layer that ZeroMQ provides.
Quick Setup
Install wirepickle using your favorite package manager:
$ pip install wirepickle
Server
Next, on your server, annotate the methods you want to expose with the @expose decorator:
from wirepickle.server import expose, Server
class Foo:
@expose('bar')
def bar(self):
print('bar')
return 0
@expose('baz')
def baz(self, arg1, kwarg1='baz'):
print(kwarg1)
return self.bar() + arg1
Note that you can return anything that can be pickled as a return value, and that stdout will be mirrored to the client.
Then, pass an instance of the class to the Server constructor to create the server.
To start listening, call the Server#listen() method on the constructed server with
a bind URI:
if __name__ == '__main__':
instance = Foo()
Server(instance).listen('tcp://*:12345')
Client
Simply pass a URI to connect to and start using the methods.
from wirepickle.client import Client
foo = Client('tcp://127.0.0.1:12345')
foo.bar()
If desired, you can pass a timeout kwarg to the Client constructor:
foo = Client('tcp://127.0.0.1:12345', timeout=1_000) # milliseconds
Release files for wirepickle 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wirepickle-1.0.0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wirepickle-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / wirepickle-1.0.0.tar.gz
| Download URL | wirepickle-1.0.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcf953626b3826ddf0843b13699ebe7f9b210ea8ce6559e51635685ec26b483a
|
|
BLAKE2b-256 checksum How to use checksums |
19fe2c5164ef6251beedd2c4eeb3024d8721b89ecfaf726ac7891eab79affe38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.3
|
Release files / wirepickle-1.0.0-py3-none-any.whl
| Download URL | wirepickle-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc63c4e6e8f115bdb8bef49c37efb0f7bd083eb5b173deed841090406f338946
|
|
BLAKE2b-256 checksum How to use checksums |
a772d483959c3cd086ebe41f08dee412e8c9edc6bd888a98c1b30de20561570b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.3
|