pynng
Networking made simply using nng
What it is and what it does
pynng wraps the nng C library to provide ergonomic Python bindings for inter-process and network communication. It supports multiple messaging patterns—Pair (bidirectional), Pub/Sub, Request/Response, Push/Pull, and Surveyor/Respondent—making it suitable for building distributed systems, service discovery, and message aggregation. The library works as a context manager and integrates with async frameworks including asyncio, trio, and curio, allowing both synchronous and asynchronous send/receive operations.
The package depends on cffi and sniffio for FFI bindings and async runtime detection. It is classified as Alpha development status but maintains an active repository with recent commits. Prebuilt wheels are available for modern Python versions on Windows, macOS, and Linux, though source builds on 32-bit systems or older macOS require CMake.
Use it for:
- Build request-response microservices where clients send queries and servers respond with results.
- Implement publish-subscribe systems to broadcast messages to multiple subscribers.
- Aggregate messages from multiple producers using Push/Pull sockets with load balancing.
- Perform service discovery by broadcasting surveys to respondents and collecting their replies.
- Create async inter-process communication pipelines using trio or asyncio for concurrent message handling.
- Replace ZeroMQ in applications requiring simpler, more ergonomic messaging APIs.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python bindings for nng (nanomsg next generation), enabling inter-process and network communication with support for multiple messaging patterns and async frameworks.
Yes, if you need inter-process or network messaging with multiple patterns and async support. The MIT license, active maintenance, and prebuilt wheels for common platforms make it low-friction. The Alpha status and medium install friction are acceptable trade-offs for projects that fit its messaging model. Not suitable if you require stable 1.0+ APIs or need support for platforms without prebuilt wheels.
Install
pynng on PyPI
pip
pip install pynnguv
uv add pynngpoetry
poetry add pynngInstalling pynng
Before you install
Medium install friction due to compiled dependencies; prebuilt wheels available for Python 3.10 and 3.11 on Windows, macOS, and Linux, but 32-bit Linux and macOS require CMake. Repository is active with recent commits and no archived status.
License in practice
MIT license (permissive) allows unrestricted use, modification, and distribution. No copyleft obligations or commercial restrictions.
Quickstart
pip install pynng
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'hello')
print(s2.recv())
CMake required for 32-bit Linux and macOS builds from source; prebuilt wheels available for common platforms.
Verify before relying
- Whether Python 3.6–3.9 support is actively maintained or only documented in classifiers
- Performance characteristics and latency guarantees compared to other messaging libraries
- Stability timeline from Alpha development status to Beta or stable release
Package facts
| License | The MIT License Copyright 2018-2019 Cody Piersall and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation… (full text in the JSON record) (permissive) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 2 — cffi, sniffio |
| Maintenance | actively maintained — 191 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 225,680/month — #9,215 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pynng-0.9.0-cp310-cp310-macosx_10_9_universal2.whl; pynng-0.9.0-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; pynng-0.9.0-cp310-cp310-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl; pynng-0.9.0-cp310-cp310-musllinux_1_2_aarch64.whl; pynng-0.9.0-cp310-cp310-musllinux_1_2_x86_64.whl; pynng-0.9.0-cp310-cp310-win32.whl; pynng-0.9.0-cp310-cp310-win_amd64.whl; pynng-0.9.0-cp310-cp310-win_arm64.whl; pynng-0.9.0-cp311-cp311-macosx_10_9_universal2.whl; pynng-0.9.0-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; pynng-0.9.0-cp311-cp311-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl; pynng-0.9.0-cp311-cp311-musllinux_1_2_aarch64.whl; pynng-0.9.0-cp311-cp311-musllinux_1_2_x86_64.whl; pynng-0.9.0-cp311-cp311-win32.whl; pynng-0.9.0-cp311-cp311-win_amd64.whl; pynng-0.9.0-cp311-cp311-win_arm64.whl; pynng-0.9.0-cp312-cp312-macosx_10_13_universal2.whl; pynng-0.9.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; pynng-0.9.0-cp312-cp312-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl; pynng-0.9.0-cp312-cp312-musllinux_1_2_aarch64.whl
Keywords: networking, nng, nanomsg, zmq, messaging, message, trio, asyncio
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
pyzmqPyZMQ provides Python bindings for ZeroMQ…
permissive · top 1,000 on PyPI
zmqThis package is a redirect to pyzmq, the…
permissive · top 15,000 on PyPI
python-nmapPython wrapper for the nmap port scanner that…
copyleft · top 15,000 on PyPI
lcmLCM provides publish/subscribe message passing…
unclear · top 15,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
pubnubPubNub Python SDK provides real-time…
unclear · top 15,000 on PyPI
nats-pyAn asyncio Python client for connecting to and…
permissive · top 5,000 on PyPI
async-modbusAsync ModBus provides an asynchronous Python…
unclear · top 15,000 on PyPI
firebase-messagingReceives push notifications sent via Firebase…
permissive · top 15,000 on PyPI
wslinkwslink provides bi-directional websocket…
permissive · top 5,000 on PyPI