Skip to main content

pyomq

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

Highlights

  • Sync and asyncio APIs with all 20 ZMTP socket types.
  • Standard sockets: PAIR, PUB, SUB, REQ, REP, DEALER, ROUTER, PULL, PUSH, XPUB, XSUB, and STREAM.
  • Draft sockets: SERVER, CLIENT, RADIO, DISH, GATHER, SCATTER, PEER, and CHANNEL.
  • tcp://, ipc://, inproc://, and udp:// transports (RADIO/DISH only).
  • Optional plain, curve, lz4, and zstd features in the published wheel.
  • Built on omq-tokio; runtime work runs on a dedicated background thread and Python calls release the GIL across the runtime trip.
  • DISH groups use socket.join() / socket.leave() and multipart group messages.

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/.

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.93 M/s 1.57 M/s 1.87x
REQ/REP rt/s 7,817/s 4,348/s 1.80x

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

Uploaded CPython 3.11+Windows ARM64

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

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

pyomq-0.20.1-cp311-abi3-macosx_10_12_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: pyomq-0.20.1.tar.gz
  • Upload date:
  • Size: 649.9 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.1.tar.gz
Algorithm Hash digest
SHA256 2f42c4c48666fdc4b621e9e7c9d5c94082ef3c9147f35ceb5c3eb42e6ed23819
MD5 25a35ee8e8c7872583de69e92a85aac4
BLAKE2b-256 4bf880ab2fc7b7ecab59bcdd4ddcae72dbd819e708ae12109a7005b473510486

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyomq-0.20.1-cp311-abi3-win_arm64.whl
  • Upload date:
  • Size: 1.8 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.1-cp311-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 24361da804107a7431cfaba3c6bb49d89746441827f9532875d7c3b84725bd64
MD5 cb1560599eb2a1b4709d3029494652aa
BLAKE2b-256 b1616c5469e45eaa62325eaf1ca9c6258fe28534f5d763498dd5c58c5aa2e807

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyomq-0.20.1-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.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4aa0ad5b91adeb264739944c4ba505e73885db1a04ac2a7bf6d6956db14e6a9a
MD5 ae9c77001c219165929941b4c1adda55
BLAKE2b-256 e832217f446433516bcf168d4c262e31c30006fda30eabbe8cf3e259b7b0caed

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.1-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1c57a649272d11f162b4d8ca126b0096278a38fb27a51e3319f8e4e4dd744555
MD5 22c0a48e195be7beec39a4f712944028
BLAKE2b-256 c5c8aca1a3a033f4ca1f8359eae1cb5e458a9798181d43bfbf474b4ce6a357a1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.1-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 85f47fa8c6a66a9ee0cddc8c7ec940582e9bb80dcc555c1c1fae182c15764d42
MD5 a79d23a028c96186d6e39f5f3eba486b
BLAKE2b-256 d9dcc9e5c16b2925761dee05f0c430d68e4772b1347620a9b84111c51a8633e1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ebe3ea509a7de86be592763ce90af4c53065701bd4b9f58c99887df2d389a269
MD5 98e511cf88ea1e59a218e47cb1fc4905
BLAKE2b-256 c9d17d0baccf1eaa34e25efcffd4e750e198af1dd3a703a8abda1f0cf1ba1dc3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7362231d5e222f30ad43ee6e66572c98b665dde282fbcb94c0952282d873d0af
MD5 d123511d8c36d4019411ee8c45e485c8
BLAKE2b-256 02675b4a4c648f945ad3b8dc5ac1dac1495a89e22d62795a922bf1e5759e9210

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f737cabb6f3f6300c55236f2f6f4ded09a6a6d31b0e8f381965f9f4f16c436c
MD5 28283f82640422eb1c6778b1c03970d6
BLAKE2b-256 bad7a14d7176942a9bca468584c7147cf6e6eb86574102c7e1bc4dc7fadaffdf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyomq-0.20.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0b62acc91d0882889cba23aca60530062f6109bebc5b1c68a8aea29334f75b82
MD5 e6a17be82ff199f0cf5fdb588ccb6f1f
BLAKE2b-256 4cb5fd6a4a81754a5b5736f15f1a6215752f38e61cca41c7ff420de63a7448ae

See more details on using hashes here.

Provenance

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

This release

0.20.1 This release

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

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