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

Uploaded CPython 3.11+Windows ARM64

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

Uploaded CPython 3.11+Windows x86-64

pyomq-0.19.2-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.2-cp311-abi3-musllinux_1_2_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

pyomq-0.19.2-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.2-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.2-cp311-abi3-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pyomq-0.19.2-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.2.tar.gz.

File metadata

  • Download URL: pyomq-0.19.2.tar.gz
  • Upload date:
  • Size: 597.1 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.2.tar.gz
Algorithm Hash digest
SHA256 d4d3b49ca58d3d407fa87b2ea7a936f83ccca951c696e5f99d2dc30119aa27d5
MD5 cba129286a65ee618ea104f01d9868cf
BLAKE2b-256 337a4d99630e8ce3eb7abfd8a3dddc2b2b6cd0dca99bac8c7e075507905e4ad3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyomq-0.19.2-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.2-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 fc6a50c99bd40f8dcd1049b6ce0e3734b0fa6f20ec57d73305a44a59a34c3131
MD5 7d425783809a052f5b10f15e36913b7b
BLAKE2b-256 e94984e30f91f2dd9b6b75692ef340c2d87ae10382ec933f17bef954a9af9dfa

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyomq-0.19.2-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.2-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 17894a639644fd77994c691b98420b6ed537bcc923a0eb4de3866319b6df74e4
MD5 beb1807ff59c32b1b2c7ed0c129b78ee
BLAKE2b-256 e315ed62e9f7bb07498aa6fbc4d95c9dd2bcbdc6bc981fa7d6abecde3998e2b6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.2-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 73eb581a00ef6f9630463a3fcb752589e808d05aed52b82729824562e5e4c424
MD5 f0b2b89976d3f9e47c062440010bd7e6
BLAKE2b-256 0a3f3a71fe03154003052a1b36596158837b31db5a6c3a3cf00ef7d70627eab4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.2-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 5c5cc6179be602d86341b33874d1dddceb34078f1c17df2cb244aed9ad032f30
MD5 ae3b087abd72f8bf19b5f52747b82534
BLAKE2b-256 3ef74dceb0282bcd784a02b9eb48692de0ebea954a0292ff2e2df67586dd97e5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e6f093c1789240eae526a10005fb0004b654a773559075c070bc1c608a06c2ef
MD5 95f87429bd830630ec6f50c81d34df31
BLAKE2b-256 1b29e7136614e4bd0c3c51bc7ce2d2eb5c65eac44fa062c48937268846f36341

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6b86feb0c7ed71b7012bb6b7708beacc36e1de66f643ec2facdbbee60fe3669d
MD5 da9e28782591ca8d9ae65447ac50d13c
BLAKE2b-256 0e1164d79af0c265ebd2609619d640f34188e099a237c54ad3d846f6eaf49fc0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.2-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cfb2c9accb48701db96724acac9b8e0e97ee1d66a4dc0a81011884cfeb681f46
MD5 87d21ebcac490e1da4cb76c81bde2ecb
BLAKE2b-256 88ff35c70e09ea5758b7dfec71a681eaab7ca8364c58eb3b50ca69b9049c88bb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.2-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a1998c2c98d3824471d12e5481fabab42df81fca1a5e46c364a97e161b759e3e
MD5 5976dc0ebf34a8b0c6f70b05e46392bb
BLAKE2b-256 769379dbbf00590068d1fc0613d1e9d9b6de043bdc0de4589812c55d39b5cf15

See more details on using hashes here.

Provenance

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

This release

0.19.2 This release

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

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