Skip to main content

nuropb-rmq

CI License Python Status

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 (await connect, 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 / SASL EXTERNAL, PEM + PKCS#12 + secrets hook
  • Named queue profiles (durable-at-least-once default) and heartbeat watchdog
  • Fail-fast reconnect (CONNECTION_LOST); caller rebinds mesh consumers
  • 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.4.1"

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

Mesh

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, --smoke does not
  • examples/langgraph_example/ — LangGraph remote invoice extract over mesh RPC; optional reconnect_demo.py for CONNECTION_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/

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)

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

Apache License 2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nuropb_rmq-0.4.1.tar.gz (51.2 kB view details)

Uploaded Source

Built Distribution

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

nuropb_rmq-0.4.1-py3-none-any.whl (66.1 kB view details)

Uploaded Python 3

File details

Details for the file nuropb_rmq-0.4.1.tar.gz.

File metadata

  • Download URL: nuropb_rmq-0.4.1.tar.gz
  • Upload date:
  • Size: 51.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nuropb_rmq-0.4.1.tar.gz
Algorithm Hash digest
SHA256 639f53eadee3514d9cf74dca3f9ecc2e1d717ffdee6a90534f392af7b9a82675
MD5 81dec34d3b94ece995c1bdc4c5988d50
BLAKE2b-256 06a20fc18b4738e22b00ab9f5a6fba116ff22e8d1470737f803e5d52f050b42a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nuropb_rmq-0.4.1.tar.gz:

Publisher: publish.yml on RileyBetts/nuropb-rmq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nuropb_rmq-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: nuropb_rmq-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 66.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nuropb_rmq-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4639656b9caa8504b71e50bcd1c51475153a9d253080d7ebb88a7c6f10ed82b
MD5 5e62b58c6dc500a78f09dfc7cdd7501f
BLAKE2b-256 8f983675cf79e3308a81576b2129f2ebea21a1dededcef11c61b209f44ef547d

See more details on using hashes here.

Provenance

The following attestation bundles were made for nuropb_rmq-0.4.1-py3-none-any.whl:

Publisher: publish.yml on RileyBetts/nuropb-rmq

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page