pyomq
Python binding for omq.rs, a Rust libzmq port. Drop-in pyzmq replacement on the common path.
Highlights
- Sync and
asyncioAPIs 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://, andudp://transports (RADIO/DISH only).- Optional
plain,curve,lz4, andzstdfeatures 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.
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 | 8,161/s | 4,348/s | 1.88x |
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
Metadata
Release files for pyomq 0.20.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyomq-0.20.3.tar.gz | 654.4 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyomq-0.20.3-cp311-abi3-win_arm64.whl | CPython 3.11 | abi3 | Windows ARM64 | Details |
| pyomq-0.20.3-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details |
| pyomq-0.20.3-cp311-abi3-musllinux_1_2_x86_64.whl | CPython 3.11 | abi3 | Linux musl 1.2+ x86-64 | Details |
| pyomq-0.20.3-cp311-abi3-musllinux_1_2_aarch64.whl | CPython 3.11 | abi3 | Linux musl 1.2+ ARM64 | Details |
| pyomq-0.20.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| pyomq-0.20.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| pyomq-0.20.3-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details |
| pyomq-0.20.3-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 15.5 MB
Release files / pyomq-0.20.3.tar.gz
| Download URL | pyomq-0.20.3.tar.gz |
|---|---|
| Size | 654.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31e82c6e1e3c2b62ab8d6ab27245463f72066135e67e9add20f8a32513542ec9
|
|
BLAKE2b-256 checksum How to use checksums |
6cc83a38649d77adff13ce868633b818c46f55e6abb610eb797cb78ba75e2a71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / pyomq-0.20.3-cp311-abi3-win_arm64.whl
| Download URL | pyomq-0.20.3-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
5f7020fd1c42a58b6c905ab0d355644e856f856bf441316db3e1f501e2d6cf6d
|
|
BLAKE2b-256 checksum How to use checksums |
e620a566771aa07642a30588e79d746d6221802275ac7af31d7e0db9d2319143
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / pyomq-0.20.3-cp311-abi3-win_amd64.whl
| Download URL | pyomq-0.20.3-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5af92f37dd3f171983cc9b0264c84e2da7e9aeb74d3ee972162cff4f3e2f005e
|
|
BLAKE2b-256 checksum How to use checksums |
58a866570bdc726371dddcbff9e2574892649e3a9b2c462340a251aa531f6249
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / pyomq-0.20.3-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | pyomq-0.20.3-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e47bf406ee9027640a7c324c8eacaee77e8e3d959420f5e8c318bd7e4fd557e5
|
|
BLAKE2b-256 checksum How to use checksums |
297150afa538c4dbf745c4b56cc8fe432545e99ed7528fc9eab41fd0a30b1284
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / pyomq-0.20.3-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | pyomq-0.20.3-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
85d567920b88d2f7236bdfb470c38795648e7e04f5ead31be000a3c301c63473
|
|
BLAKE2b-256 checksum How to use checksums |
a113e5f1596a3fad20098d4805f328ac8512a8e2c356ec37f6528544a3bee1c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / pyomq-0.20.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyomq-0.20.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4354f1e7d8a0fad97d00899ecef0c439bd7f448c4ec9ffb7e1a0364115d5c0bf
|
|
BLAKE2b-256 checksum How to use checksums |
af08f57ceba35df08e981613b099d7cd93f2cc622bc2fd21d729e6f2ad9519c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / pyomq-0.20.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyomq-0.20.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8e43b2e24fbe3072b478c911bded6a8373c685a1cbb6a0a1a8ae8751419566d8
|
|
BLAKE2b-256 checksum How to use checksums |
6f027aa07503b0d799f9036202ad1d18dd46e338340dd60b7e754639947c0c90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / pyomq-0.20.3-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | pyomq-0.20.3-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6c9436be1237ce4dd9ddbffd7f0c25a09e67f2d7748f41c123a4c4949377cbe5
|
|
BLAKE2b-256 checksum How to use checksums |
600897b76fcb1d07621939bfbaa84049bdc52a3479cf5a03f00e73f379841377
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / pyomq-0.20.3-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | pyomq-0.20.3-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
68d24597473c0f1afb24c8d3490bb0310747a07394e0b8dd098f0094d911e3f3
|
|
BLAKE2b-256 checksum How to use checksums |
c9a064590eaec7d8c426efc5458db77e8576790d76e3539b184f17b1278c0abf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency log