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.16.tar.gz (686.1 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.16-cp38-abi3-win_amd64.whl (22.5 MB view details)

Uploaded CPython 3.8+Windows x86-64

mq_bridge_py-0.2.16-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (22.6 MB view details)

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

mq_bridge_py-0.2.16-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (21.4 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

mq_bridge_py-0.2.16-cp38-abi3-macosx_11_0_arm64.whl (20.2 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

mq_bridge_py-0.2.16-cp38-abi3-macosx_10_12_x86_64.whl (21.3 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: mq_bridge_py-0.2.16.tar.gz
  • Upload date:
  • Size: 686.1 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.16.tar.gz
Algorithm Hash digest
SHA256 178286d215c90ab4ed6558d39a15b12a65e49c31f5bb1ddaee8ebcf214501f18
MD5 4519848e76324ba2686fe0577efbb117
BLAKE2b-256 a892c8fa5236b52393f2cd6f4023acf36f67a932fa52b806c311381ef30cdab4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.16.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.16-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: mq_bridge_py-0.2.16-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 22.5 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.16-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4570ab4796cba6b690e8ada7b29200c1754dfa9c7f6113189218f5e8a5dbb142
MD5 2bfc578468ec496fbae518689781d8fb
BLAKE2b-256 7a297053cc17c1e56a2e139f012d9247e7aad2192da507f5697993d92aab8def

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.16-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.16-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mq_bridge_py-0.2.16-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49cb992cf9cfd6b949b6bbd2132acf7744d890bb13a034d10cfad8093f8afb07
MD5 ca5e1f2ad345fbd116eec9ea7a666511
BLAKE2b-256 2a01f7dd91f13253afb621c91471be70ec87f6be6b431ce88f8f72d65954c4a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.16-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.16-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mq_bridge_py-0.2.16-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 efe9bcab9ee9c6954a6fdb3238f4c1faecdaa6a9aad8f0f21a3a71a9815b3dde
MD5 4c3525c7170f345e59166f831c62f968
BLAKE2b-256 69397dfcea8ef0a0e8d271db20ebe253cde243c422077da008b1dcff283a1be5

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.16-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.16-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mq_bridge_py-0.2.16-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2e969c2ef431548dbae90806388526cf4c8bf5969ae9465f9c9bcaff88387c9
MD5 a6ee7c787a3e2cb9eb0313871b1ec8c4
BLAKE2b-256 f69eadb91a80a96bb21ce3efec03109f2b08173b5f3ee4d99f472ef1df6c6197

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.16-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.16-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for mq_bridge_py-0.2.16-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9d2472299a9c45467550d2575bfc0dcbb25d906f4020efd10257dc5b3c3e0f9a
MD5 fa1d3cba523c93f0430c02d972abb865
BLAKE2b-256 46aab8418c8726956dc2fa569c96bea538dd956c154637440e6288247480a634

See more details on using hashes here.

Provenance

The following attestation bundles were made for mq_bridge_py-0.2.16-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