nanoservice is a small Python library for writing lightweight networked services using nanomsg
Project description
nanoservice is a small Python library for writing lightweight networked services using nanomsg
With nanoservice you can break up monolithic applications into small, specialized services which communicate with each other.
Install
Make sure you have the nanomsg library installed:
$ git clone git@github.com:nanomsg/nanomsg.git
$ ./configure
$ make
$ make check
$ sudo make install
For more details visit the official nanomsg repo
On OS X you can also do:
$ brew install nanomsg
Install nanoservice:
From project directory
$ make install
Or via pip
$ pip install nanoservice (it's broken)
Example Usage
The service:
from nanoservice import Responder
def echo(msg):
return msg
s = Responder('ipc:///tmp/service.sock')
s.register('echo', echo)
s.start()
$ python echo_service.py
The client:
from nanoservice import Requester
c = Requester('ipc:///tmp/service.sock')
res, err = c.call('echo', 'hello world’)
print('Result is {}'.format(res))
$ python my_client.py
$ Result is: hello world
Other
To run tests:
$ make test
To run benchmarks
$ make bench
Check out examples directory for more examples.
MIT Licensed
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file nanoservice-0.7.2.tar.gz
.
File metadata
- Download URL: nanoservice-0.7.2.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb0413df8040c96cfd3b0f5ffee1f4b48b03c00327bd561136f16aac4612f168 |
|
MD5 | 0a4b57e46f86de8ffdb0c05cd3bb9913 |
|
BLAKE2b-256 | a22557e57f3879192e9f46719cf9afeacd2ea306159b854e9e973ea46deb1bf2 |