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()

Zguide-style runnable examples live in examples/zguide/.

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.88 M/s 1.53 M/s 1.88×
REQ/REP rt/s 8,049/s 4,511/s 1.78×

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

Uploaded CPython 3.11+Windows ARM64

pyomq-0.20.0-cp311-abi3-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

pyomq-0.20.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.20.0.tar.gz.

File metadata

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

File hashes

Hashes for pyomq-0.20.0.tar.gz
Algorithm Hash digest
SHA256 b419fb5e49f47ac0e70b1bdc4d64141a60e882d0533a97d097bb1b38215cc066
MD5 e19e4cf02fdca16dd273769b7a41505e
BLAKE2b-256 bc15d9c3f56dc953dc9fc96a9553cefe78969257271a71e0dbe38ea52bf947e2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyomq-0.20.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.20.0-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 91e2f4ee30c5b6952743b971d9016f03bd744138a81d564c078a6a18e6509cd3
MD5 1651491103dbff0eb9081d148978a53a
BLAKE2b-256 235aaabfcf89215be287f2e3e22b9ad6776c4a6cd11195be156c34739a8b0848

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyomq-0.20.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.9 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.20.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f6ef5ebda488b350d5a8c71ae854b3980c3850ef228e69ffa60be4468e23855f
MD5 13d5d0a6a6650e747b0596f3b3f13fda
BLAKE2b-256 de713e98e1676e286051ddd39139739e5a4e3d753a2545a9f1ae3979dd31e066

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.0-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 eed42bb96a383f2b4b02e42305af41c1c52faa7827392b58f94e59a3d8c8c2d5
MD5 cd69da418408c19fb87636a61f0022a8
BLAKE2b-256 bab91a89ed4375c8cb6dd6f17fc4b58638e862e3f867cfb650b8ff2775827323

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.0-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 6c476bff9d285f6a2ad3ef5050ab16b53f8c2dcad27aeaa034cb0b103f3a505b
MD5 eb6d7a580d0449a6410fcbc7ffead104
BLAKE2b-256 147927d975c0e78f00da53de00a589e9f8baf414c94a2897d39a44279adf3cca

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08e1bfff21010ab979c4370b51d7b98d7076ef10601ba7e624acab42bf75250b
MD5 35ad6763f84859e01c03c8ddf1da3787
BLAKE2b-256 a09ddae2e4f6902ce482346ca704152b7c47ab73534c3a21d8befada92868ed6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e0fc00da7c78a56a1aa1ce3f3ce6c6d5cdbf47e5b8615f1e0e26b00f3d7c56bc
MD5 14817a9c07585b2e68a97a2a31a144ef
BLAKE2b-256 1f2a6de53d1a169f4518f06b05ad4dbc7274a65987648a6d4331eb8e8e301d95

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ecb593bdb52042e87a223ca9f9c7c5c03808712a8762370c5b8a43b79a79445e
MD5 9c0960e45463c647d0064928e8575768
BLAKE2b-256 d8dfbf45fdfa92bfb2042b63e5bf429777b8a22b67c5834456b1edae8306c455

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0ae27f3038d22aceb394bbc4895005a2c9496cfc483950b0219fe89d817132a9
MD5 f36ac99565d8d8b75e358e5f1b54dfb2
BLAKE2b-256 176cc2c7d7bceb4d334ece13e88e9519188f5cabcc1a04b8f523512775a6d5b8

See more details on using hashes here.

Provenance

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

This release

0.20.0 This release

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

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