A tiny, pythonic SDK for the ZigMQ text protocol.
Project description
zigMQ Python SDK
zigmq is a tiny, pythonic SDK for the ZigMQ text protocol.
By default, the SDK connects to 127.0.0.1:8388.
The goal of this SDK is deliberately narrow:
- one small sync client for queue/admin commands
- one dedicated subscriber client for pub/sub delivery
- no dependency, no ORM-style abstraction, no magic reconnect layer
- protocol-compatible with the current ZigMQ server behavior
Install
pip install zigmq
Local development:
cd zigMQ-python-SDK
pip install -e .
python -m unittest -v
Quick Start
from zigmq import Client
with Client() as mq:
mq.send("jobs", "hello world")
print(mq.recv("jobs"))
Pub/Sub:
from zigmq import Client, Subscriber
with Subscriber() as sub:
sub.subscribe("news")
with Client() as mq:
delivered = mq.publish("news", "shipped")
print(delivered)
event = sub.get()
print(event.topic, event.message)
API
Client
ping() -> strinfo() -> Infosend(queue, message) -> Nonerecv(queue) -> strrecv_bytes(queue) -> bytespeek(queue) -> strpeek_bytes(queue) -> bytesqueue_length(queue) -> intcreate_queue(queue) -> Nonelist_queues() -> list[str]publish(topic, message) -> intlist_topics() -> dict[str, int]subscriber(*topics) -> Subscriber
Short protocol-style aliases are also available: mq, len, queues, pub, topics.
Subscriber
subscribe(*topics) -> Noneunsubscribe(*topics) -> Noneget(timeout=None) -> Event- iteration support:
for event in sub: ...
Design Notes
- This SDK is text-first, because ZigMQ itself is a line-based text protocol.
- The default connection target is
127.0.0.1:8388. - Queue/topic names cannot contain whitespace or line breaks.
- Message bodies can contain spaces, but cannot contain
\\ror\\n. queues,topics, andinfofollow the current ZigMQ server behavior and are parsed from multi-line responses.
Publish To PyPI
Update version in pyproject.toml, then:
cd zigMQ-python-SDK
python -m build
twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zigmq-0.1.0.tar.gz.
File metadata
- Download URL: zigmq-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bffa45c118e7209e57127067e18ce2444136b4c6fe8641e7045deea5652df9b8
|
|
| MD5 |
93bffab1d2ecebf374f86b19be2e7491
|
|
| BLAKE2b-256 |
028720000f763012d9507fdd2975dbe54ab7511beec8a6a29fe92c98f91b6340
|
File details
Details for the file zigmq-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zigmq-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc72be30af4df3d2b531e12a39e004dcf48910cc002c47d36592f9a572118ba0
|
|
| MD5 |
c315b819fe7224fdc8e159956def2096
|
|
| BLAKE2b-256 |
1fd89a1c7f2589827c13bf7963319f24c0dddd75394fd32dcb9921fb24ebc181
|