Skip to main content

Networking made simply using nng

Project description

This is pynng.

Ergonomic bindings for nanomsg next generation (nng), in Python. pynng provides a nice interface on top of the full power of nng. nng, and therefore pynng, make it easy to communicate between processes on a single computer or computers across a network.

Goals

Provide a Pythonic, works-out-of-the box library on Windows and Unix-y platforms. Like nng itself, the license is MIT, so it can be used without restriction.

Installation

On Windows and 64-bit Linux, the usual

pip install pynng

should suffice. Building from source is a little convoluted, due to some issues with the way the setup.py script is written. Nevertheless, it can be done:

git clone https://github.com/codypiersall/pynng
cd pynng
pip install .
python setup.py build
python setup.py build_ext --inplace
pytest

Installing on Mac

This project does not yet know how to build for Mac, because I don't have a Mac to test on. The tricky bit is letting cffi know the correct object file to link to, and ensuring whatever the Mac equivalent of -fPIC is set when compiling.

Using pynng

Using pynng is easy peasy:

from pynng import Pair0

s1 = Pair0()
s1.listen('tcp://127.0.0.1:54321')
s2 = Pair0()
s2.dial('tcp://127.0.0.1:54321')
s1.send(b'Well hello there')
print(s2.recv())
s1.close()
s2.close()

Since pynng sockets support setting most parameters in the socket's __init__ method and is a context manager, the above code can be written much shorter:

from pynng import Pair0

with Pair0(listen='tcp://127.0.0.1:54321') as s1, \
        Pair0(dial='tcp://127.0.0.1:54321') as s2:
    s1.send(b'Well hello there')
    print(s2.recv())

Many other protocols are available as well:

  • Pair0: one-to-one, bidirectional communication.
  • Pair1: one-to-one, bidirectional communication, but also supporting polyamorous sockets
  • Pub0, Sub0: publish/subscribe sockets.
  • Surveyor0, Respondent0: Broadcast a survey to respondents, e.g. to find out what services are available.
  • Req0, Rep0: request/response pattern.
  • Push0, Pull0: Aggregate messages from multiple sources and load balance among many destinations.

TODO

  • Support Mac
  • More docs

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

pynng-0.1.2.tar.gz (451.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pynng-0.1.2-cp37-cp37m-win_amd64.whl (172.5 kB view details)

Uploaded CPython 3.7mWindows x86-64

pynng-0.1.2-cp37-cp37m-win32.whl (161.9 kB view details)

Uploaded CPython 3.7mWindows x86

pynng-0.1.2-cp37-cp37m-manylinux1_x86_64.whl (289.8 kB view details)

Uploaded CPython 3.7m

pynng-0.1.2-cp36-cp36m-win_amd64.whl (172.5 kB view details)

Uploaded CPython 3.6mWindows x86-64

pynng-0.1.2-cp36-cp36m-win32.whl (161.9 kB view details)

Uploaded CPython 3.6mWindows x86

pynng-0.1.2-cp36-cp36m-manylinux1_x86_64.whl (289.8 kB view details)

Uploaded CPython 3.6m

pynng-0.1.2-cp35-cp35m-win_amd64.whl (172.4 kB view details)

Uploaded CPython 3.5mWindows x86-64

pynng-0.1.2-cp35-cp35m-win32.whl (161.9 kB view details)

Uploaded CPython 3.5mWindows x86

pynng-0.1.2-cp35-cp35m-manylinux1_x86_64.whl (289.8 kB view details)

Uploaded CPython 3.5m

File details

Details for the file pynng-0.1.2.tar.gz.

File metadata

  • Download URL: pynng-0.1.2.tar.gz
  • Upload date:
  • Size: 451.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2.tar.gz
Algorithm Hash digest
SHA256 84786eadc2071c5e53a817e65babf74b701570279ad8da980ff636d2b3a3b32d
MD5 5a30590ea5e6723010be628c2fa002ec
BLAKE2b-256 435f2b31533f9d44fe568a49bb309ae36f3c8e32a62008826939191885b46b94

See more details on using hashes here.

File details

Details for the file pynng-0.1.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pynng-0.1.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 172.5 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 36d42ce7b343bd3731d3dd402779729bf406bf7051bddad91c366f0d7863446f
MD5 7829789c24952c2df4c89beec8ed480b
BLAKE2b-256 ece0b279a5f958d2e098239c44b1366dc509deb6043fd7795c65c072a610ed93

See more details on using hashes here.

File details

Details for the file pynng-0.1.2-cp37-cp37m-win32.whl.

File metadata

  • Download URL: pynng-0.1.2-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 161.9 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 a781351c47f09858d012d1c2adecf2491428774acd97510f2fad5d7198e5a065
MD5 72b0d501547753a73840dca78297d146
BLAKE2b-256 640662ec786bd3db9631c71df63c38b3fb4059cae929b0a7c59787a4a8958413

See more details on using hashes here.

File details

Details for the file pynng-0.1.2-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pynng-0.1.2-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 289.8 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b5a4c33082c084bac0dca9bf79d17e17e8b03608211de2cd704de23e82f604ee
MD5 ba54fecf67ea77b92838d35077ff3d1a
BLAKE2b-256 3f8884c1f7658a4982a1f4431d28375b6ac6c3ac4929be3c1910e60af29af58c

See more details on using hashes here.

File details

Details for the file pynng-0.1.2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pynng-0.1.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 172.5 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 78ffbea14f49a337a83e87be75010d034c980a71f5d1d716ba42459f1b859467
MD5 1d1f37bf10893ca4d217ccf97da87129
BLAKE2b-256 d3124d17e25cb89d72f33cb15977196199bea2c2a28b1a752369df132a327f53

See more details on using hashes here.

File details

Details for the file pynng-0.1.2-cp36-cp36m-win32.whl.

File metadata

  • Download URL: pynng-0.1.2-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 161.9 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 a5c0627842b6295579da1320f874534aa53dd78630a3a3b90bd8b24f9690f808
MD5 e3f525d4849e4edd6af25220fe446a58
BLAKE2b-256 1d253f4f1cc5499376f2c96d712219d0eb6d4121d491408baf28aae462686298

See more details on using hashes here.

File details

Details for the file pynng-0.1.2-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pynng-0.1.2-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 289.8 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dcd00acb2abaa15796228e677ec4b941d61b93e6314814bd3ce96b65ff343eba
MD5 ff4a26d3519c9394be50e506e47b5fc9
BLAKE2b-256 11c8fe289754fe04cea73aa61eab33fd22087eb1604cce040594a51e3279c566

See more details on using hashes here.

File details

Details for the file pynng-0.1.2-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: pynng-0.1.2-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 172.4 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 99f719a6c285ee310a515687c867741a619f81017f0c5c8257c9c27262c4d430
MD5 e3d900fd6ee6ec6ff6a28046a3ad15c0
BLAKE2b-256 7063105ef48302666bd9ab9b6e14f6961b2f08c582c9450325fd2460e7845955

See more details on using hashes here.

File details

Details for the file pynng-0.1.2-cp35-cp35m-win32.whl.

File metadata

  • Download URL: pynng-0.1.2-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 161.9 kB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 5eecbc29445f0c924f75bd83a8b363b08bae354ef605ce67fa3427badfb593df
MD5 a5b5b525d98d2bd2c93a27071b1c9c46
BLAKE2b-256 ebbe6fa505dcadd1f09c9dc1962d72505e03fdc4d3fe25756c8033e7f87322be

See more details on using hashes here.

File details

Details for the file pynng-0.1.2-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: pynng-0.1.2-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 289.8 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.5.2

File hashes

Hashes for pynng-0.1.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 46d126a4d3a4a9bb8b0eb69494e8cebd7ed488d7b5e3cc7494c9a2ade324e515
MD5 25e4ee60d52b14d9315853f8b420bb94
BLAKE2b-256 f42547bac418abf8fe2e922f30b50ceea4ce6a76e0125133edc37a5981fdc8c5

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