gmqtt
Client for MQTT protocol
What it is and what it does
gmqtt is a pure-Python async MQTT client library built on asyncio for connecting to MQTT brokers and exchanging messages. It implements both MQTT 5.0 (default) and 3.1.1 protocols, with automatic downgrade if a broker does not support version 5.0. The client handles subscriptions, message publishing with configurable QoS levels, authentication, and automatic reconnection with tunable retry behavior.
The library is callback-driven: you define handlers for connect, message receipt, disconnect, and subscribe events, then await the main connection loop. It supports MQTT 5.0 properties (session expiry, maximum packet size, user properties, content type, message expiry) and allows both synchronous and asynchronous message handlers. No external dependencies are required beyond Python's standard asyncio, making it lightweight and straightforward to integrate into async applications.
Use it for:
- Build IoT device clients that publish sensor data and subscribe to control commands over MQTT.
- Create real-time message brokers or gateways that relay MQTT traffic between multiple topics or brokers.
- Implement monitoring dashboards that subscribe to device telemetry and display live updates.
- Develop async Python services that need to communicate via MQTT without blocking the event loop.
- Test MQTT broker behavior and message flow by scripting client interactions in Python.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
gmqtt is an async Python MQTT client that connects to MQTT brokers, publishes and subscribes to topics, and handles message delivery with support for MQTT 5.0 and 3.1.1 protocols.
Yes. gmqtt is a solid, actively maintained MQTT client with zero dependencies, permissive licensing, and broad protocol support. Install it if you need async MQTT connectivity in Python and are comfortable with callback-based event handling. The 630 days since last release is not a concern given the active repository and recent commits; the library is stable rather than abandoned.
Install
gmqtt on PyPI
pip
pip install gmqttuv
uv add gmqttpoetry
poetry add gmqttInstalling gmqtt
Before you install
Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent commits and a stable release history since 2018.
License in practice
MIT license is permissive; you can use, modify, and distribute gmqtt freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install gmqtt
import asyncio
from gmqtt import Client as MQTTClient
async def main():
client = MQTTClient("client-id")
client.on_message = lambda c, t, p, q, pr: print(p)
await client.connect("mqtt.broker.host")
client.subscribe("topic/name")
await asyncio.sleep(10)
await client.disconnect()
asyncio.run(main())
Requires Python 3.5 or later and an accessible MQTT broker at connection time.
Verify before relying
- Whether uvloop integration (mentioned in docs) provides measurable performance gains for typical workloads.
- Behavior and compatibility with brokers that do not support MQTT 5.0 downgrade negotiation.
- Performance characteristics under high message throughput or with many concurrent subscriptions.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 630 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 159,368/month — #10,698 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gmqtt-0.7.0-py3-none-any.whl
Keywords: Gurtam, MQTT, client.
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
paho-mqttProvides an MQTT client library for connecting…
copyleft · top 5,000 on PyPI
aiomqttAn asyncio-native MQTT client that wraps…
permissive · top 5,000 on PyPI
tb-paho-mqtt-clientProvides an MQTT client library implementing…
copyleft · top 15,000 on PyPI
asyncio-mqttProvides an async/await interface to MQTT…
permissive · top 15,000 on PyPI
tb-mqtt-clientPython client SDK for ThingsBoard IoT platform,…
permissive · top 15,000 on PyPI
pymysensorsPython API for communicating with MySensors…
permissive · top 15,000 on PyPI
amqpPure-Python AMQP 0.9.1 client library for…
permissive · top 1,000 on PyPI
aiormqaiormq is a pure Python AMQP 0.9.1 client…
permissive · top 5,000 on PyPI
victron-mqttAn asynchronous Python library for…
permissive · top 15,000 on PyPI
yoto-apiAsync Python client for controlling Yoto player…
permissive · top 15,000 on PyPI