nats-py
NATS client for Python
Decision gist · record as of 2026-08-14
Yes. nats-py is actively maintained, has no external dependencies, and provides a straightforward asyncio interface to a mature messaging system. Install it if you need lightweight async messaging, pub-sub distribution, or persistent queues in a distributed architecture. The only prerequisite is access to a NATS server; for learning, the public demo server works, but production requires your own deployment.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a running NATS server to connect to; the example uses a public demo server but production use typically requires your own server instance.
- Low friction: pure Python wheel with no runtime dependencies.
- Actively maintained with a recent release (70 days ago) and steady commit activity.
License · maintenance · safety
Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and note any modifications.
last release 2026-06-05 (70 days) · last repo commit 2026-08-13 · 1,242 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 5,452,904 downloads/mo, #2,096 on PyPI
Alternatives
Verify before relying
pip install nats-py
import asyncio
import nats
async def main():
nc = await nats.connect("nats://demo.nats.io:4222")
await nc.publish("foo", b'Hello')
await nc.drain()
asyncio.run(main())- Performance characteristics (throughput, latency) under typical production loads.
- Clustering and failover behavior when connecting to multiple NATS servers.
- Memory footprint and resource usage for long-lived connections with high message volume.
What it is and what it does
nats-py is an asyncio-native Python client for NATS, a lightweight distributed messaging system. It provides a clean async/await interface for publishing and subscribing to messages across a network, supporting both simple pub-sub patterns and request-reply interactions. The client handles connection management, message routing, and error recovery automatically.
Beyond basic messaging, the package includes JetStream support for persistent message streams, allowing you to store and replay messages, create durable subscribers that survive restarts, and implement ordered consumption with flow control. It also supports TLS encryption, NKEYS authentication, and JWT credentials for secure deployments. With no external runtime dependencies, it installs cleanly into any Python 3.7+ environment.
Use it for
- Build microservices that communicate asynchronously via pub-sub topics without tight coupling.
- Implement request-reply patterns where one service asks another for data and waits for a response.
- Create persistent message queues using JetStream to ensure messages are not lost if subscribers are temporarily offline.
- Distribute work across multiple workers by publishing tasks to a queue group and letting subscribers process them in parallel.
- Monitor and log events from distributed systems by publishing events to a central NATS server.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
nats-py is actively maintained, has no external dependencies, and provides a straightforward asyncio interface to a mature messaging system. Install it if you need lightweight async messaging, pub-sub distribution, or persistent queues in a distributed architecture. The only prerequisite is access to a NATS server; for learning, the public demo server works, but production requires your own deployment.
Install
nats-py on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with a recent release (70 days ago) and steady commit activity. Supports Python 3.7 through 3.13.
Requires a running NATS server to connect to; the example uses a public demo server but production use typically requires your own server instance.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and note any modifications.
Quickstart
pip install nats-py
import asyncio
import nats
async def main():
nc = await nats.connect("nats://demo.nats.io:4222")
await nc.publish("foo", b'Hello')
await nc.drain()
asyncio.run(main())
Verify before relying
- Performance characteristics (throughput, latency) under typical production loads.
- Clustering and failover behavior when connecting to multiple NATS servers.
- Memory footprint and resource usage for long-lived connections with high message volume.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 70 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,452,904 / month, #2,096 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: nats_py-2.15.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “nats messaging client python”
- nats-pyAn asyncio Python client for connecting to and messaging through…
- nkeysGenerates, manages, and verifies Ed25519-based cryptographic key…
- nucliadb-telemetryAdds distributed tracing to FastAPI, gRPC, and NATS services,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Distributed Computing packages
gRPC Python is an HTTP/2-based RPC framework that enables you to define and call remote procedures across network boundaries using protocol buffers for serialization.
Install it if you need RPC communication in a distributed system or are integrating with existing gRPC services.
execnet lets you spawn and communicate with Python interpreters across local processes, remote hosts, and different platforms, using a simple API for task distribution and inter-process messaging.
However, the aging maintenance status (275 days since last release) means you should verify it meets your concurrency and performance needs before committing to a…
Cloudpickle extends Python's standard pickle module to serialize lambda functions, interactively-defined functions and classes, and other constructs that the default pickle cannot handle, making it suitable for cluster computing and remote code execution.
Install it if you need to serialize lambda functions, interactively-defined code, or non-standard Python constructs for cluster computing or distributed execution.
Provides a unified, open()-compatible Python API for streaming large files from remote storage (S3, GCS, Azure, HDFS, SFTP, HTTP) and local filesystems, with transparent compression support.
Install it if you work with large files on cloud storage or remote systems and want to avoid writing boilerplate around multiple SDKs.
Portalocker provides cross-platform file locking with support for exclusive and shared locks, plus Redis-based distributed locks and process-aware PID file locking.
Install it if you need file or process coordination; the optional extras (pywin32, redis) are only required for specific lock types.
Ray is a distributed computing framework that scales Python applications from a single machine to multi-node clusters, providing abstractions for parallel tasks, stateful actors, and shared objects.
See also gcloud-aio-pubsub · google-cloud-pubsub · slixmpp · faststream · solace-pubsubplus · zulip · nkeys · nucliadb-telemetry · google-cloud-pubsublite · azure-servicebus