skillfed

pynng

Networking made simply using nng

pynng v0.9.0 225.7K downloads/30d#9,215 on PyPI328
Permissive 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) Active released

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 pynng

uv

uv add pynng

poetry

poetry add pynng

Installing 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

Development Status :: 3 - AlphaFramework :: AsyncIOFramework :: TrioLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: System :: Networking

Tags

nng python bindingsinter-process messagingasync networking librarynanomsg next generationmessage passing patternsnetwork communicationpub-sub messagingrequest-response protocol
async-iomessage-passingdistributed-systems

More Libraries packages