Zantedeschia is an experimental alternative integration between asyncio and ZeroMQ sockets.
I started trying to use aiozmq, but I objected to some of the design decisions. I borrowed ideas from that code, but did a few things differently:
aiozmq is built around asyncio’s protocol and transport APIs, which I find hard to use; even the simplest examples involve subclassing ZmqProtocol. Zantedeschia uses a single AsyncZMQSocket wrapper class, with simple semantics.
Zantedeschia does not include an RPC framework.
Zantedeschia expects the user to create and connect ZMQ sockets using PyZMQ, then wrap them in an AsyncZMQSocket object.
Zantedeschia is a genus of flowers. Asyncio itself was originally codenamed ‘tulip’, and a tradition developed of naming asyncio libraries after flowers.
Use this at your own risk. MinRK, the author of PyZMQ, told me that I definitely shouldn’t rely on the ZMQ file descriptors for an event loop, but I’m doing exactly that.
Ping server example:
import asyncio, zmq, zantedeschia
ctx = zmq.Context()
s = ctx.socket(zmq.REP)
s.bind('tcp://127.0.0.1:8123')
async_sock = zantedeschia.AsyncZMQSocket(s)
def pong():
while True:
msg_parts = yield from async_sock.recv_multipart()
yield from async_sock.send_multipart(msg_parts)
asyncio.get_event_loop().run_until_complete(pong())
Using the on_recv API instead:
import asyncio, zmq, zantedeschia
ctx = zmq.Context()
s = ctx.socket(zmq.REP)
s.bind('tcp://127.0.0.1:8123')
async_sock = zantedeschia.AsyncZMQSocket(s)
@async_sock.on_recv
def pong(msg_parts):
async_sock.send_multipart(msg_parts)
asyncio.get_event_loop().run_forever()
Metadata
Release files for Zantedeschia 0.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 | Provenance | Actions |
|---|---|---|---|---|
| Zantedeschia-0.1.tar.gz | 4.0 kB | Without provenance | Details for Zantedeschia-0.1.tar.gz |
Release files / Zantedeschia-0.1.tar.gz
| Download URL | Zantedeschia-0.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48104800c103189d4f45f8a18f353791a723ab797967a0be6afba3c75c1309d8
|
|
BLAKE2b-256 checksum How to use checksums |
ba3b7ce39b5a9ac82e3e441eff56bb1898479c29d7455d9d30c86ac98256b364
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for Zantedeschia 0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.