zmq-anyio
Asynchronous API for ZMQ using AnyIO.
Usage
zmq_anyio.Socket is a subclass of zmq.Socket. Here is how it must be used:
- Create a
zmq_anyio.Socketfrom azmq.Socketor from azmq.Context:- Create a blocking ZMQ socket using a
zmq.Context, and pass it to an asynczmq_anyio.Socket:ctx = zmq.Context() sock = ctx.socket(zmq.PAIR) asock = zmq_anyio.Socket(sock)
- Or create an async
zmq_anyio.Socketusing azmq.Context:ctx = zmq.Context() asock = zmq_anyio.Socket(ctx)
- Create a blocking ZMQ socket using a
- Use the
zmq_anyio.Socketwith an async context manager. - Use
arecv()for the async API,recv()for the blocking API, etc.
import anyio
import zmq
import zmq_anyio
ctx = zmq.Context()
sock1 = ctx.socket(zmq.PAIR)
port = sock1.bind("tcp://127.0.0.1:1234")
sock2 = ctx.socket(zmq.PAIR)
sock2.connect("tcp://127.0.0.1:1234")
# wrap the `zmq.Socket` with `zmq_anyio.Socket`:
sock1 = zmq_anyio.Socket(sock1)
sock2 = zmq_anyio.Socket(sock2)
async def main():
async with sock1, sock2: # use an async context manager
await sock1.asend(b"Hello") # use `asend` instead of `send` and await it
sock1.asend(b", World!") # or don't await it, it's sent in the background
assert await sock2.arecv() == b"Hello" # use `arecv` instead of `recv`
future = sock2.arecv() # or get the future and await it later
assert await future == b", World!"
anyio.run(main)
Release files for zmq-anyio 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zmq_anyio-0.4.1.tar.gz | 12.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zmq_anyio-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:22.7 kB
Release files / zmq_anyio-0.4.1.tar.gz
| Download URL | zmq_anyio-0.4.1.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c11c2fe0657987d545380d500e82587c0b636c67c98490f2c2682b2dcc96196
|
|
BLAKE2b-256 checksum How to use checksums |
9a4ac35b1442613f686eb681a23f5a4528b8bc0391ae1b42ce835de075a18272
|
| 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 3, 2026.
Transparency logRelease files / zmq_anyio-0.4.1-py3-none-any.whl
| Download URL | zmq_anyio-0.4.1-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4800f8fb824802cebde7ea042056d026e51cc90204f04018773920114b47ef58
|
|
BLAKE2b-256 checksum How to use checksums |
2fdcbc4ce04180cc1a106e07862736c2a5d78f7ab8f2e7c5b0ffe38a43e73f8c
|
| 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 3, 2026.
Transparency log