Skip to main content

pyomq

Python binding for omq.rs, a Rust libzmq port. Drop-in pyzmq replacement on the common path.

Install

uv pip install pyomq
uv pip install 'pyomq[test]'   # adds pytest, pyzmq for the interop suite

The published wheel includes optional features: plain, curve, lz4. Use pyomq.has("curve") at runtime to check availability.

Published wheels currently target Linux. Other platforms can build from sdist when the local Rust/Python toolchain supports them. Windows pyomq support is not complete on main yet.

Usage

import pyomq as zmq  # drop-in for `import zmq` from pyzmq

ctx = zmq.Context()
push = ctx.socket(zmq.PUSH)
push.connect("tcp://127.0.0.1:5555")
push.send(b"hello")
push.close()
ctx.term()

For asynchronous code:

import pyomq
import pyomq.asyncio as zmq_async

ctx = zmq_async.Context()
sock = ctx.socket(pyomq.PUSH)
await sock.connect("tcp://127.0.0.1:5555")
await sock.send(b"hello")
await sock.close()

Status

Sync and asyncio APIs both ship in this release. All 20 ZMTP socket types are wired:

  • Standard (RFC 28 + 47): PAIR, PUB, SUB, REQ, REP, DEALER, ROUTER, PULL, PUSH, XPUB, XSUB, STREAM.
  • Draft: SERVER, CLIENT (RFC 41), RADIO, DISH (RFC 48), GATHER, SCATTER (RFC 49), PEER, CHANNEL (RFC 51).

Transports: tcp://, ipc://, inproc://, and udp:// (RADIO/DISH only). Optional features built into the wheel: plain, curve, lz4.

DISH groups: use socket.join(b"group") / socket.leave(b"group") to manage subscriptions; messages are sent as multipart [group, body].

Backend

pyomq is built on omq-tokio (multi-threaded tokio runtime). The runtime runs on a dedicated background thread; every Python call releases the GIL across the runtime trip.

Performance

See COMPARISONS.md for full tables.

pyomq vs pyzmq performance

2-process loopback throughput and latency vs pyzmq, measured on Linux 6.12 (Debian 13), Intel i7-8700B 3.2 GHz, Rust 1.95.0.

zmq.proxy() forwarding (128 B, TCP)

pyomq pyzmq ratio
PUSH/PULL msg/s 2.77 M/s 1.53 M/s 1.81×
REQ/REP rt/s 8,360/s 4,511/s 1.85×

pyomq's proxy() forwards directly between sockets on the tokio runtime, no Python per-message overhead. pyzmq's zmq.proxy() calls libzmq's C-level zmq_proxy. PUSH/PULL forwarding is throughput-bound and pyomq is ~1.8x faster. REQ/REP proxy is latency-bound (4 TCP hops per round-trip); pyomq is ~1.9x faster thanks to direct socket forwarding.

Run scripts/update_perf.py (after maturin develop --release) to re-measure, regenerate the chart, and update the proxy table.

Compression transports

OMQ.rs adds a transparent LZ4 compression transport on top of TCP: lz4+tcp://. Swap the scheme in your endpoint string and everything else stays the same:

push = ctx.socket(zmq.PUSH)
push.bind("lz4+tcp://127.0.0.1:5555")

pull = ctx.socket(zmq.PULL)
pull.connect("lz4+tcp://127.0.0.1:5555")

Both peers must use a matching compression endpoint. Payloads below ~512 B are sent as-is (the codec detects that compression would expand them).

lz4+tcp:// supports dictionary auto-training (off by default). When enabled, it samples the first 100 outbound messages, builds a 2 KiB dict, and ships it to the peer once. After that the compression threshold drops from 512 B to 128 B, so small structured messages start compressing too. Pure Rust (lz4rip), no C compiler required.

Enable it on sockets that send compressible traffic before bind()/connect():

push.compression_auto_train = 1
# or: push.setsockopt(zmq.OMQ_COMPRESSION_AUTO_TRAIN, 1)

See BENCHMARKS_COMPRESSION.md for throughput charts and benchmark details. Wire format: LZ4 transport RFC.

CURVE authentication

CURVE encrypts traffic and authenticates the server to the client. To also authenticate clients to the server, call set_curve_auth() before bind()/connect():

server_pub, server_sec = zmq.curve_keypair()
client_pub, client_sec = zmq.curve_keypair()

pull = ctx.socket(zmq.PULL)
pull.curve_server = 1
pull.curve_publickey = server_pub
pull.curve_secretkey = server_sec

# Option 1: allow specific client keys (checked in Rust, no GIL overhead)
pull.set_curve_auth([client_pub])

# Option 2: custom callback. PeerInfo has .public_key (Z85) and
# .identity (bytes or None).
pull.set_curve_auth(lambda peer: peer.public_key in allowed_keys)

# Option 3: accept any valid CURVE client (the default)
pull.set_curve_auth(None)

No ZAP, no filesystem key management. The callback runs during the CURVE handshake; returning a falsy value rejects the client.

Develop

cd bindings/pyomq
uv venv && source .venv/bin/activate
uv pip install maturin pytest pyzmq
maturin develop --release
pytest -v

Download files

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

Source Distribution

pyomq-0.17.1.tar.gz (545.9 kB view details)

Uploaded Source

Built Distributions

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

pyomq-0.17.1-cp39-abi3-win_arm64.whl (1.5 MB view details)

Uploaded CPython 3.9+Windows ARM64

pyomq-0.17.1-cp39-abi3-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.9+Windows x86-64

pyomq-0.17.1-cp39-abi3-musllinux_1_2_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

pyomq-0.17.1-cp39-abi3-musllinux_1_2_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

pyomq-0.17.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

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

pyomq-0.17.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.5 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

pyomq-0.17.1-cp39-abi3-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

pyomq-0.17.1-cp39-abi3-macosx_10_12_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file pyomq-0.17.1.tar.gz.

File metadata

  • Download URL: pyomq-0.17.1.tar.gz
  • Upload date:
  • Size: 545.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyomq-0.17.1.tar.gz
Algorithm Hash digest
SHA256 6b2aecdd44c3ea6bddd7189d77344771ade0a20df6f74bfbde0eaf0c229258ef
MD5 67d5a0f0d392530200070ea0ea3ea2d0
BLAKE2b-256 621edb2700128c393a9079dd4fa0b2095a3fbd30f1ce80d62fbd9d670ce553c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.17.1.tar.gz:

Publisher: release-pyomq.yml on paddor/omq.rs

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

File details

Details for the file pyomq-0.17.1-cp39-abi3-win_arm64.whl.

File metadata

  • Download URL: pyomq-0.17.1-cp39-abi3-win_arm64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.9+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyomq-0.17.1-cp39-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 9678394f25f5520faa2b8688f900697b085b1c658867efc8cc7da6dc51ae96e9
MD5 7135b60c96dc3b35287df95c2af54c0d
BLAKE2b-256 7a6fbaedc16017ecda2c93c1bce8d0389325dbede1a2681b2fa6ad945855a28a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.17.1-cp39-abi3-win_arm64.whl:

Publisher: release-pyomq.yml on paddor/omq.rs

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

File details

Details for the file pyomq-0.17.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: pyomq-0.17.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyomq-0.17.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d65a891ffa579e87a838b416016993c7fd0022d38b34089829ab6bb4a20868ec
MD5 ad74c0d8b37d06a67c198675310192a0
BLAKE2b-256 730ab185fdb17721f3cc80deae3930bf0b19329d61287b716e519f05d1faba60

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.17.1-cp39-abi3-win_amd64.whl:

Publisher: release-pyomq.yml on paddor/omq.rs

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

File details

Details for the file pyomq-0.17.1-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyomq-0.17.1-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0f76514d5f08af09951f32029e88d3dfcc4ef4cef6152a65c9b0e41087e7c99d
MD5 753d0654210260ea6c84b409df6f8ca9
BLAKE2b-256 6fd883498f076764d0ec63d2d8899a567be215617883cd3a87fa606f8b8e4901

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.17.1-cp39-abi3-musllinux_1_2_x86_64.whl:

Publisher: release-pyomq.yml on paddor/omq.rs

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

File details

Details for the file pyomq-0.17.1-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyomq-0.17.1-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b6ae271ef73fdf476e6bfa565aa527a3166778fa743569feca50dc5f568cf379
MD5 edc51808bebd7748a02a9bb4f1790c49
BLAKE2b-256 d4ae8838c67f9cda61d83b7462900bc0565718dd603da4685dcf0da47be64eb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.17.1-cp39-abi3-musllinux_1_2_aarch64.whl:

Publisher: release-pyomq.yml on paddor/omq.rs

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

File details

Details for the file pyomq-0.17.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyomq-0.17.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ccd3c7da6ce4104a3f9bac60fa7c97c463579d5405cfaad482aa718a2aa2145a
MD5 ae5ab0000f87dad50775627339ae0229
BLAKE2b-256 5bc018e3c855c2f36d6bc2f20f73c99a40d7605c70fd53c84c0bcfdaf1f54f73

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.17.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pyomq.yml on paddor/omq.rs

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

File details

Details for the file pyomq-0.17.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyomq-0.17.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 69e790ff6ff179bd3d393446e10efc940f2cae60ee04eb51947ad759d2ef1f12
MD5 ea4fe666b8140c3039eb8e07f21a0351
BLAKE2b-256 9ef969bf77cd3cc8895bf390efa9eb2c2db92bbcfe7de0fa09014d023eddd006

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.17.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-pyomq.yml on paddor/omq.rs

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

File details

Details for the file pyomq-0.17.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyomq-0.17.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5b8f156c3d0e58733cec5dca89b9a93002de25e20187aaecf1ae537c3437975
MD5 32df6458f4fbf15bc4d8e3c6f472493a
BLAKE2b-256 a93451f7343456218105e44e39043578a1d9687178dd4d5fc690b64cedea76df

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.17.1-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release-pyomq.yml on paddor/omq.rs

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

File details

Details for the file pyomq-0.17.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyomq-0.17.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3ed50181ea4cb18b1642ab0c4d2c557f8be1417e2ce5c912b7114e273e999507
MD5 9ce6020124ff5fa84daeed5890492748
BLAKE2b-256 05c4f3d932e0cdc63f66d1447514c3c3ad0e2648561df6ee94cf8d89c2ea9cbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.17.1-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release-pyomq.yml on paddor/omq.rs

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

Release history Release notifications | RSS feed

0.20.1

9 files

0.20.0

9 files

0.19.2

9 files

0.19.1

9 files

0.19.0

9 files

0.18.3

9 files

0.18.2

9 files

0.18.1

9 files

0.18.0

9 files

This release

0.17.1 This release

9 files

0.16.4

5 files

0.16.3

5 files

0.16.2

5 files

0.16.1

5 files

0.15.0

5 files

0.13.0

5 files

0.12.7

5 files

0.12.6

5 files

0.12.5

5 files

0.12.3

5 files

0.12.2

5 files

0.12.1

5 files

0.12.0

5 files

0.11.0

5 files

0.10.3

5 files

0.10.2

5 files

0.10.0

5 files

0.9.0

5 files

0.8.1

5 files

0.8.0

5 files

0.7.1

5 files

0.7.0

3 files

0.6.1

3 files

0.6.0

3 files

0.5.0

3 files

0.4.2

3 files

0.4.1

3 files

0.3.1

4 files

0.2.4

4 files

0.2.3

2 files

0.2.1

2 files

0.2.0

2 files

Supported by

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