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, zstd. 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, zstd.

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 transparent compression transports on top of TCP: lz4+tcp:// and experimental zstd+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 the transport threshold are sent as-is when compression would not help.

Compression transports support static dictionaries and dictionary auto-training (off by default). Auto-training samples outbound messages, builds a 2 KiB dict, and ships it once per connection. Static dicts are set with compression_dict. zstd+tcp:// also accepts compression_level. Pure Rust (lz4rip / zrip), 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)
push.compression_level = 1  # zstd+tcp only

See BENCHMARKS_COMPRESSION.md for throughput charts and benchmark details. Wire formats: LZ4, Zstd.

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.19.0.tar.gz (579.6 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.19.0-cp311-abi3-win_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11+Windows ARM64

pyomq-0.19.0-cp311-abi3-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.11+Windows x86-64

pyomq-0.19.0-cp311-abi3-musllinux_1_2_x86_64.whl (2.0 MB view details)

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

pyomq-0.19.0-cp311-abi3-musllinux_1_2_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

pyomq-0.19.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

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

pyomq-0.19.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pyomq-0.19.0-cp311-abi3-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pyomq-0.19.0-cp311-abi3-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pyomq-0.19.0.tar.gz
Algorithm Hash digest
SHA256 3ee5d2b66bf045a86abdda2a55467d89feca5333ce5b1afc75cdeb4f8e21a7be
MD5 0dcc0353817fbddec6706e5f6d903e30
BLAKE2b-256 66f11b83ae9159cc5ba674616d430912354fef34e0fea6c693400876681360a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.19.0.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.19.0-cp311-abi3-win_arm64.whl.

File metadata

  • Download URL: pyomq-0.19.0-cp311-abi3-win_arm64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.11+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyomq-0.19.0-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 d1ca79e642e84daffd6d8d4b51e9dc199a317903bedcd81f609fb3db4d439220
MD5 7da4990b349ee1c9801519e36a3ae9fe
BLAKE2b-256 1d70da95e2a97ad1bc5db7e391ce5098634633d977026ec0992843e20b6052f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.19.0-cp311-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.19.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pyomq-0.19.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pyomq-0.19.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6edc94ae2dc8524cbfd69da35302c7a353bbc69203ad55d12870907292118b95
MD5 b69a0873b3ec78710bc9641bef0e0ef3
BLAKE2b-256 422e0069ad04128449b73e20d74f9fe0496a88d459b468a6e4040e1aea2269c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.19.0-cp311-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.19.0-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyomq-0.19.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c2fa62ab2ecd75c33b2d4a8e08dc34eb7f840ba418a2e4d39c6159dff8d95f42
MD5 89b2a9054783ba2377e16cae8d7dd44b
BLAKE2b-256 2d07d68819678b6c1551444214981e814d096857017144efc7033afa2725d72c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.19.0-cp311-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.19.0-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pyomq-0.19.0-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 7d985307db759f16d45a4956f42dd6e4ea71b69e842f2295c0dc3ae4f3c88d36
MD5 8fe5d923191962edcffbbe5ac92438cd
BLAKE2b-256 b45ac844a770e9f48f30d57386f8247967c4fda4d4596c3f8b5287f8892e2308

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.19.0-cp311-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.19.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyomq-0.19.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 879136553e5cdb2f614ab88585bf78110eb1b76ed902384f1dfe25df40866bc0
MD5 b524862d115f2fd75f33d019a4bb9e75
BLAKE2b-256 af1705b89702950495fb9ee2860889e65e17670e1f18584755a7522d366606d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.19.0-cp311-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.19.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyomq-0.19.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 71ddad5e96eddf54c60df593b07fb7dc7e3336ca84442d7c5ca26a782245d723
MD5 62d7b0f33f99750559818f27278614b6
BLAKE2b-256 311dc1df9eaa8e66f3685565215872e88742e0a3ebb9710a78cde43bdfc16419

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.19.0-cp311-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.19.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyomq-0.19.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69340f8c89d25242358f782b07fa60dcda6c8e59c30ecf5b2a9a8509e0c9dfe0
MD5 7452ddb0ccc42aca15b2926faa152631
BLAKE2b-256 df30d955c9ef084a62d5a05c818bb35374af69bd055266d8194f6649b70026f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.19.0-cp311-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.19.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyomq-0.19.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7987e71e7d2213fcdddf3bfb72947f8600b809ef8e660b8baea181fcda9f3fa3
MD5 2293f1c2705bd4a6473243b317f1fbe3
BLAKE2b-256 7ccdf55b245f8a359c165cfde121bb22591d88531f6192373edfc412a7a8aa31

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomq-0.19.0-cp311-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

This release

0.19.0 This release

9 files

0.18.3

9 files

0.18.2

9 files

0.18.1

9 files

0.18.0

9 files

0.17.1

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