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

Uploaded CPython 3.11+Windows ARM64

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

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

pyomq-0.19.1-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.1.tar.gz.

File metadata

  • Download URL: pyomq-0.19.1.tar.gz
  • Upload date:
  • Size: 585.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.1.tar.gz
Algorithm Hash digest
SHA256 bab595cbf7b02b76a7c0c8ca03902986f136b0efa735915cedfc0e6a082804c3
MD5 cf3e2edf7518356f5cf200eb04e84266
BLAKE2b-256 4f45d8d46939f8640c383ac525ec10987fab6e11606a4f755009bc7e7dc0f137

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyomq-0.19.1-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.1-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 50262578012bd2cbe4e67ed9702524a7aa24352de545b35d0b44a9b3163715d3
MD5 36fd531a8256a63f70e6e0e8ee1039f3
BLAKE2b-256 74ca891d4006996ca983d50359f1b4825da444ea9c9e6b981f67a626306ddd9c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyomq-0.19.1-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.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 18271e8d1da1f9b8aed60429f4877168e600ec831b16928414fd8d74ea406a5f
MD5 8cde18887f26628110aacb7b31506511
BLAKE2b-256 fb1a459538ea932ae6eadab75fb2b10187e44acacc121727c41937a6365b887b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.1-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8c7a6207eab417bf6e75c9ca090557e02ee5b2183f82ade92a5312065746aa0e
MD5 86b548449b03aecfdc0a4da58326c417
BLAKE2b-256 0134702496a194ffa5aedaa2716638fe7ed0e8d3361c6cd81bae97bd3420c89d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.1-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 08e4d3dc14edef05fdb3a508ba76c8075230e409efbf16830d096448037f112f
MD5 a354db37b53edbbb40f425b5dfaff873
BLAKE2b-256 126c1e55db5d3e0816dd33914e6d23ef75f9969c2438d9505899c7b27a600f60

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6992265d8157a98f8b825a862e2c5155ec81086020695df0b75dd00c082504a6
MD5 4d7c101beabf509e8907ee00a7e3ed11
BLAKE2b-256 852eb679dab65d5497b04de03611b5a168767b0d7b655c7cc5ddc9760a557761

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0ab26ca82f95c569a258b69ea1fb9010026e8a611e8cfdbf2218141a0e154b64
MD5 0414e1c21c1d15e9347964dec67e5000
BLAKE2b-256 43f0ec01db0b2d6d4595cbdf07c861837fbc4d3335d5cce0774c14e13a2519db

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 76b86312e6eb7ca8276fc781511e483f8c462a1807afd31d35127750f77a1545
MD5 6a4c3b4149dae0cd4a547242b7fe5468
BLAKE2b-256 075e06f452022e57e16c3732c59dd4ff1b6dc28de228918e793479651ea9df40

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.19.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e8634334d4ae0e456a3da98d3a767a59874e63a98635abb4ce979325fb4ffe54
MD5 cb28512b8268b184dbfe09cb23d9f8ea
BLAKE2b-256 cc1ff1947776cae664d216cfbde393f61bd19fc3d8acea892c404eb1f94834f6

See more details on using hashes here.

Provenance

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

This release

0.19.1 This release

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