Skip to main content

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.

Build Status

Install

  1. 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
  1. Install nanoservice:

From project directory

$ make install

Or via pip

$ pip install nanoservice (it's broken)

Example Usage

The service:

from nanoservice import Service

def echo(msg):
    return msg

s = Service('ipc:///tmp/service.sock')
s.register('echo', echo)
s.start()
$ python echo_service.py

The client:

from nanoservice import Client

c = Client('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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nanoservice-0.5.0.tar.gz (9.1 kB view details)

Uploaded Source

File details

Details for the file nanoservice-0.5.0.tar.gz.

File metadata

  • Download URL: nanoservice-0.5.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for nanoservice-0.5.0.tar.gz
Algorithm Hash digest
SHA256 e0b1525dbe5eaa8963757ae981fa789ff7907d55662782c8ce9be6202524513f
MD5 a9cd0dfe65b324b787be8aee4c9b1e18
BLAKE2b-256 c6b769c0fc481c083081f2b485332c43b0ced0ff5c30b9469ffab1433480ecb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page