Skip to main content

Python bindings for mq-bridge (full: all brokers incl. Kafka)

Project description

mq-bridge Python bindings

Thin Python bindings for the Rust mq-bridge core.

Install

Pick exactly one distribution. Both install the same import path: mq_bridge.

Package Install Includes
Full pip install mq-bridge-py Basic set plus Kafka, AWS, gRPC, MongoDB, SQLx
Basic pip install mq-bridge-py-basic HTTP, NATS, MQTT, AMQP, WebSocket, ZeroMQ, middleware

Memory and file endpoints are always present in both packages. Use mq-bridge-py-basic when you want the lean all-platform wheel set. Use mq-bridge-py when you need Kafka or the heavier non-messaging backends.

The public API stays close to mq-bridge itself:

  • Route.from_yaml(path, name) loads one named route
  • Route.with_handler(...) attaches a raw Message handler, with lazy json()/text() readers and with_json()/with_payload() response helpers
  • Route.add_handler(kind, ...) uses mq-bridge's kind dispatch and delivers decoded JSON
  • RetryableError and NonRetryableError let Python handlers signal retry intent
  • Publisher.from_yaml(path, name) loads one named publisher
  • Publisher.send_json(...) and Publisher.request_json(...) serialize Python JSON values in Rust

The Python surface is synchronous and blocking. Tokio, broker I/O, routing, and batching all stay in Rust.

Local development

uv is a good fit here for the Python-side developer workflow, while maturin stays the build backend:

cd python/mq-bridge-py
uv sync --group dev --no-install-project
uv run maturin develop
uv run pytest -q

Performance smoke tests are skipped by default because they start routes and measure local throughput:

cd python/mq-bridge-py
MQ_BRIDGE_RUN_PERF_TESTS=1 uv run pytest -q -m performance

Examples

Raw message handler:

cd python/mq-bridge-py
uv run python examples/raw_route.py

Kind-based JSON handler:

cd python/mq-bridge-py
uv run python examples/json_route.py

Memory benchmark:

cd python/mq-bridge-py
uv run maturin develop --release
uv run python examples/bench_memory.py --messages 100000

Analysis

HTTP comparison benchmark, driven by a native load generator (wrk) so the client is never the bottleneck. It boots each server itself (mq-bridge in worker and direct executor modes, plus FastAPI, Starlette, Sanic, aiohttp, and FastStream when installed) and drives each with wrk:

cd python/mq-bridge-py
uv run maturin develop --release
uv sync --group bench   # optional Python HTTP peers
uv run python analysis/bench_http_native.py --connections 1,8,32 --duration 8

Requires wrk on PATH (brew install wrk). The FastStream target compares its ASGI custom-route path over Uvicorn; it is not a broker-backed subscriber/publisher benchmark. The examples use included sample configs or create temporary configs.

Project details


Download files

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

Source Distribution

mq_bridge_py-0.2.18.tar.gz (705.3 kB view details)

Uploaded Source

Built Distributions

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

mq_bridge_py-0.2.18-cp38-abi3-win_amd64.whl (23.6 MB view details)

Uploaded CPython 3.8+Windows x86-64

mq_bridge_py-0.2.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

mq_bridge_py-0.2.18-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (22.3 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

mq_bridge_py-0.2.18-cp38-abi3-macosx_11_0_arm64.whl (21.1 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

mq_bridge_py-0.2.18-cp38-abi3-macosx_10_12_x86_64.whl (22.2 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file mq_bridge_py-0.2.18.tar.gz.

File metadata

  • Download URL: mq_bridge_py-0.2.18.tar.gz
  • Upload date:
  • Size: 705.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mq_bridge_py-0.2.18.tar.gz
Algorithm Hash digest
SHA256 484f2488c1793e82b7a830d03b70a8709cdb8470a88374feb728931da25e2a93
MD5 7f8c067ad032d9907bab41c61180e262
BLAKE2b-256 d3ab9ffefb20c8a93a1241fac8b1bff3a37096d46e0210f21cacde2724d74174

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.18.tar.gz:

Publisher: publish-python.yml on marcomq/mq-bridge

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

File details

Details for the file mq_bridge_py-0.2.18-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: mq_bridge_py-0.2.18-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 23.6 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mq_bridge_py-0.2.18-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 03a20391c462bd01799dd3e4616860b0c60cfbc7af24c38bc55ad13d268f4929
MD5 7d9307f1f4bb6b796a5e43db21ac1cce
BLAKE2b-256 4d44ccce2f62f4e4b19878791980974e0b5cd603e05ff721a969247599813bb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.18-cp38-abi3-win_amd64.whl:

Publisher: publish-python.yml on marcomq/mq-bridge

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

File details

Details for the file mq_bridge_py-0.2.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mq_bridge_py-0.2.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b9fe334baf834da04a9d2211ddeb5302c1805464186d192d0723313a35772206
MD5 2ca8c2920d8b942d9aa816f3747c08f8
BLAKE2b-256 8c70451106ce9abed735a033f95ec774d0851a04cfde2e0080fdf6ef830a7c8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.18-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-python.yml on marcomq/mq-bridge

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

File details

Details for the file mq_bridge_py-0.2.18-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mq_bridge_py-0.2.18-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5173d69d44b277d47a18c81bdece1c2e38f832b8268d338b83b600e35d894465
MD5 000439a4fc632d11a47177959f6cbe7d
BLAKE2b-256 e95b4dda56270135ddf2f247da07878814a1e3d9c5fcc09f4f030c38c5be09d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.18-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish-python.yml on marcomq/mq-bridge

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

File details

Details for the file mq_bridge_py-0.2.18-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mq_bridge_py-0.2.18-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4260c368f5caeb3f2c04a38791803fb18f1dbcdc1b8281ce9267f0bf4eb9874
MD5 7137b429fd8935283be77c1173b26b43
BLAKE2b-256 9501aee569e24b41eb39750305b477001c639f9e9458c28d2ccf6c5bbf168c49

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.18-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: publish-python.yml on marcomq/mq-bridge

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

File details

Details for the file mq_bridge_py-0.2.18-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mq_bridge_py-0.2.18-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dba84f9c4bb448495a50ef3b09d1e8511b4b83d09625d228ef749de1ca1593d2
MD5 4f3f0c60c6ef8e915a16bdae495054ca
BLAKE2b-256 38c2563ecd5b438f4d4244e6c3c5a160f0c45be5517c6fd147f2b74314785ccf

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.18-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: publish-python.yml on marcomq/mq-bridge

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 Pingdom Monitoring Sentry Error logging StatusPage Status page