nuropb-rmq
Async-native Python AMQP 0-9-1 client for RabbitMQ — built on asyncio, with
no pika (or other AMQP client) at runtime. It implements connection/channel
framing directly and layers nuropb-inspired JSON-RPC 2.0 mesh patterns (RPC,
events, service bind, claims) on that transport. Protocol and session behaviour
are backed by SpeC++ CheckSat and Lean proofs, not only tests.
Alpha: the public API may still change. See CHANGELOG.md.
Features
- Asyncio-first API (
awaitconnect, publish, consume, RPC) - Native AMQP transport: connect, channel, declare, publish, consume, ack
- Session RPC with exclusive reply queues and correlation tracking
- Event pub/sub (JSON-RPC notification shape) over topic/fanout
- Mesh service bind under a namespaced identity (
service.method) - Optional JWT claims on RPC (
[claims]extra) - TLS (
tls-verify-full), mTLS / SASLEXTERNAL, PEM + PKCS#12 + secrets hook - Named queue profiles (
durable-at-least-oncedefault) and heartbeat watchdog - Fail-fast reconnect (
CONNECTION_LOST); caller rebinds mesh consumers - Mandatory publish /
basic.return(PublishReturned) so misrouted RPC is an error - Optional mesh discovery registry (announce/viewer — never a bind authority)
- Runnable LangChain tool + LangGraph remote-node examples over the mesh
- Throughput harness vs pika (
[bench]extra)
Installation
Python 3.11+:
pip install nuropb-rmq
| Extra | Purpose |
|---|---|
| (none) | Core client |
claims |
JWT mesh claims (PyJWT) |
pkcs12 |
PKCS#12 TLS material (cryptography) |
bench |
pika comparison harness |
pip install "nuropb-rmq[claims]"
From a known Git tag (or before a version is on PyPI):
pip install "git+https://github.com/RileyBetts/nuropb-rmq.git@v0.5.0"
Pushing an annotated v* tag from main publishes to PyPI via
.github/workflows/publish.yml. Release checklist:
CHANGELOG.md.
Quick start
Needs a local RabbitMQ broker (default 127.0.0.1:5672, guest/guest).
import asyncio
from nuropb_rmq import AmqpConnection, ConnectionConfig
async def main() -> None:
conn = AmqpConnection(ConnectionConfig(host="127.0.0.1", port=5672))
await conn.connect()
ch = await conn.open_channel(1)
queue = await conn.queue_declare(ch, "nr.ex.hello", durable=True)
await conn.basic_consume(ch, queue)
await conn.basic_publish(
ch,
b"hello-nuropb-rmq",
routing_key=queue,
properties={"content_type": "text/plain", "delivery_mode": 2},
)
msg = await conn.receive(timeout=5)
print(msg.body)
await conn.basic_ack(ch, msg.delivery_tag)
await conn.close()
asyncio.run(main())
Prefer copy-paste demos? See Examples below. Stable imports:
from nuropb_rmq import Session, RpcClient, MeshService, … (api.py).
Examples
Transport
examples/vanilla_hello/— durable queue publish/consumeexamples/vanilla_topic/— topic exchange pub/sub
Mesh
examples/one_client_one_service/— mesh RPC, events, and registry discovery
Framework adapters (self-standing uv projects — LangChain/LangGraph deps stay
out of the root package)
examples/langchain_example/— LangChain agent calling a mesh service tool (orders.get_status); live agent needs an LLM key,--smokedoes notexamples/langgraph_example/— LangGraph remote invoice extract over mesh RPC; optionalreconnect_demo.pyforCONNECTION_LOST→ rebind → checkpoint replay
Smoke examples (with uv after uv sync --dev;
also uv sync in examples/langchain_example and examples/langgraph_example):
./scripts/smoke_examples.sh
Documentation
User guides (config, AMQPS, mesh, claims): docs/
- Architecture overview — diagrams
- Service mesh — what “mesh” means here
- JWT claims
- Cloud and enterprise AMQPS
- TLS profiles and material
- Broker permissions
Design notes for contributors: thinking/architecture.md.
Lean ↔ Python map: specs/lean/CORRESPONDENCE.md.
Release notes: CHANGELOG.md.
Formal verification
Correctness work is part of the project, not an afterthought:
- SpeC++ SMT CheckSat under
specs/specpp/(Protocol, Session, Pattern, Phase 2, Config) - Lean proofs under
specs/lean/(Protocol, Session, Pattern, Config, reconnect)
Contributor commands to run these gates are in CONTRIBUTING.md.
TLS, mesh, reconnect (summary)
- Prefer
tls-verify-full; never assume mTLS ⇒EXTERNAL. Full material sources and cloud runbooks:docs/guides/cloud-and-enterprise-amqps.md. - Mesh is JSON-RPC over RabbitMQ (not a sidecar mesh):
docs/concepts/service-mesh.md. - Reconnect is fail-fast (
CONNECTION_LOST); caller rebinds:docs/concepts/reconnect.md. - LangGraph / long-running clients: retry authority is application-owned —
docs/guides/langgraph.md. - Work queues default to
durable-at-least-once:docs/concepts/queue-profiles.md.
from nuropb_rmq import MeshRegistryViewer, MeshService, ServiceIdentity
mesh = MeshService(cfg, identity=ServiceIdentity("orders"), methods=["ping"], announce=True)
await mesh.start()
Throughput vs pika
uv sync --dev --extra bench
uv run python -m bench.compare --quick
Contributing
PRs target development. Use uv for the
maintainer environment (uv sync --dev). Branching, CI gates, SpeC++, and Lean
commands: CONTRIBUTING.md.
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nuropb_rmq-0.5.0.tar.gz.
File metadata
- Download URL: nuropb_rmq-0.5.0.tar.gz
- Upload date:
- Size: 53.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
595ebb731e0d6ef33769a89a37c5287c10eeda3b7e4d96031cc00fae4dc7f008
|
|
| MD5 |
0162f5eeb31d86be7e8d278292833db6
|
|
| BLAKE2b-256 |
9aec8c2c2e84c04b0d2660639298b4af23f1c994d0a82637716cea09f9d59d1e
|
Provenance
The following attestation bundles were made for nuropb_rmq-0.5.0.tar.gz:
Publisher:
publish.yml on RileyBetts/nuropb-rmq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nuropb_rmq-0.5.0.tar.gz -
Subject digest:
595ebb731e0d6ef33769a89a37c5287c10eeda3b7e4d96031cc00fae4dc7f008 - Sigstore transparency entry: 2480127673
- Sigstore integration time:
-
Permalink:
RileyBetts/nuropb-rmq@e4c8a3f2562986572ba8b98d250e9d481c3ad67d -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/RileyBetts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e4c8a3f2562986572ba8b98d250e9d481c3ad67d -
Trigger Event:
push
-
Statement type:
File details
Details for the file nuropb_rmq-0.5.0-py3-none-any.whl.
File metadata
- Download URL: nuropb_rmq-0.5.0-py3-none-any.whl
- Upload date:
- Size: 67.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65ab8b2adb947c9cf5adabb7b61938c3d68f3646af1900104c137656ec932043
|
|
| MD5 |
6848742227ccf2e359d4b4813843a1ed
|
|
| BLAKE2b-256 |
636ac0237f279da935411192a07a287fcccdd340aba8c7041a29eda42e8b3204
|
Provenance
The following attestation bundles were made for nuropb_rmq-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on RileyBetts/nuropb-rmq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nuropb_rmq-0.5.0-py3-none-any.whl -
Subject digest:
65ab8b2adb947c9cf5adabb7b61938c3d68f3646af1900104c137656ec932043 - Sigstore transparency entry: 2480128674
- Sigstore integration time:
-
Permalink:
RileyBetts/nuropb-rmq@e4c8a3f2562986572ba8b98d250e9d481c3ad67d -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/RileyBetts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e4c8a3f2562986572ba8b98d250e9d481c3ad67d -
Trigger Event:
push
-
Statement type: