This release is a pre-release and may not be stable for production use.
MQTTium
MQTTium is a reliable, async-native MQTT client for modern Python.
It combines a synchronous protocol engine with an asyncio API, bounded
backpressure, durable inflight persistence, explicit delivery receipts, and
complete MQTT QoS state machines.
Status: alpha (
0.1.0a1). The implementation is extensively tested, but the public API may still change before the first stable release.
Features
- MQTT 3.1.1 and MQTT 5;
- QoS 0, 1 and 2 with one authoritative protocol state machine;
- TCP, TLS, WebSocket and Unix transports;
- reconnect and session replay;
- bounded callback and async-iterator delivery;
- manual acknowledgement;
- in-memory and SQLite inflight persistence;
- aggregate
publish_many()with bounded memory and measured throughput gains; - an additive Paho VERSION2 compatibility façade, isolated from the native API;
- inline type information for type checkers.
Python 3.11–3.14 is supported. MQTTium is licensed under Apache-2.0.
Installation
python -m pip install mqttium
To work on the unreleased development version:
git clone https://github.com/yoch/mqttium.git
cd mqttium
python -m pip install -e ".[dev,fuzz,release]"
Quick start
import asyncio
from mqttium.api import AsyncClient
async def main() -> None:
client = AsyncClient("demo-client")
await client.connect("127.0.0.1", 1883)
await client.subscribe("demo/#")
receipt = await client.publish("demo/hello", b"world", qos=1)
await receipt.wait()
await client.disconnect()
asyncio.run(main())
Batched publishing
publish_many() consumes iterables in bounded chunks and returns one aggregate
receipt rather than creating one task or event per message:
from mqttium.api import PublishMessage
batch = await client.publish_many(
PublishMessage("telemetry/device-1", payload, qos=1)
for payload in payloads
)
await batch.wait()
The retained paired A/B benchmark measured publisher-throughput geomean
improvements of 36.9% for QoS 0, 15.9% for QoS 1, and 7.0% for QoS 2
against equivalent individual publishing pipelines on the validated source
tree. Benchmark methodology and limitations are documented in
docs/BENCHMARKING.md.
Validation
The release gates include:
- more than 240 unit tests;
- Mosquitto integration tests on Python 3.11, 3.12, 3.13 and 3.14;
- deterministic and Hypothesis-based fuzzing;
- Ruff formatting and linting;
- mypy validation and a PEP 561
py.typedmarker; - an 80% coverage gate;
- wheel, source-distribution and isolated-install validation;
- delivery, persistence, TCP, TLS and WAN-profile benchmarks.
Documentation
docs/DESIGN.md— architecture and invariantsdocs/IMPLEMENTATION-GUIDE.md— protocol contractsdocs/COMPAT.md— Paho compatibility surfacedocs/MIGRATION.md— migration guidancedocs/BENCHMARKING.md— benchmark validity contractdocs/FUZZING.md— fuzzing strategydocs/ROADMAP.md— remaining stable-release workPROVENANCE.md— source history and licensing review
Contributing and security
See CONTRIBUTING.md. Report vulnerabilities through the
private process described in SECURITY.md.
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 mqttium-0.1.0a1.tar.gz.
File metadata
- Download URL: mqttium-0.1.0a1.tar.gz
- Upload date:
- Size: 128.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bb958db806b58f161ed1eb35d9f523120836ffa1383aeeb57d6084c26b4e11c
|
|
| MD5 |
1ea70de315df2575740d554d7cf9226a
|
|
| BLAKE2b-256 |
2480adee3c9958159f2e852d44260ac74f124cb0501fddcb391dbcb1ee1587b4
|
Provenance
The following attestation bundles were made for mqttium-0.1.0a1.tar.gz:
Publisher:
publish.yml on yoch/mqttium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mqttium-0.1.0a1.tar.gz -
Subject digest:
6bb958db806b58f161ed1eb35d9f523120836ffa1383aeeb57d6084c26b4e11c - Sigstore transparency entry: 2337216734
- Sigstore integration time:
-
Permalink:
yoch/mqttium@c67daeb132be877b6c911637aee03923d35e0a06 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/yoch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c67daeb132be877b6c911637aee03923d35e0a06 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mqttium-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: mqttium-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 71.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52bc3bc250b59751fcfa92c2ec5496e2d997e6983d4260fca9f30d37e28efcb8
|
|
| MD5 |
6a7cdac13e6d24424a92d12cb9dc7e4d
|
|
| BLAKE2b-256 |
261fd08a55e74f69eb73881898aeb8564f4acf834b93db57a5c696da488b6cd5
|
Provenance
The following attestation bundles were made for mqttium-0.1.0a1-py3-none-any.whl:
Publisher:
publish.yml on yoch/mqttium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mqttium-0.1.0a1-py3-none-any.whl -
Subject digest:
52bc3bc250b59751fcfa92c2ec5496e2d997e6983d4260fca9f30d37e28efcb8 - Sigstore transparency entry: 2337216776
- Sigstore integration time:
-
Permalink:
yoch/mqttium@c67daeb132be877b6c911637aee03923d35e0a06 -
Branch / Tag:
refs/tags/v0.1.0a1 - Owner: https://github.com/yoch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c67daeb132be877b6c911637aee03923d35e0a06 -
Trigger Event:
release
-
Statement type: