skillfed

tb-paho-mqtt-client

MQTT version 5.0/3.1.1 client class

tb-paho-mqtt-client v2.1.2 118.4K downloads/30d#12,118 on PyPI
Copyleft license EPL-2.0 OR BSD-3-Clause AGING released

What it is and what it does

This is the Eclipse Paho MQTT Python client, a library for connecting applications to MQTT brokers to send and receive messages over a lightweight publish-subscribe protocol. It supports MQTT versions 5.0, 3.1.1, and 3.1, making it suitable for IoT and machine-to-machine communication where bandwidth and code footprint matter. The library provides a full Client class for fine-grained control, plus helper functions for simple one-off publish or subscribe operations.

The client offers multiple network loop modes: a threaded loop (loop_start/loop_stop) for non-blocking operation, a blocking loop (loop_forever) that handles reconnection automatically, and a manual loop for custom event integration. Callbacks allow your application to react to connection, message receipt, and publish acknowledgment events. Known limitations include in-memory-only session storage (sessions are lost on restart) and potential message loss for unacknowledged QoS 1 and QoS 2 messages.

Use it for:

  • Build IoT applications that publish sensor readings or receive commands from a central broker.
  • Implement lightweight remote monitoring where network bandwidth is constrained.
  • Create publish-subscribe messaging systems for real-time data distribution across devices.
  • Integrate MQTT communication into Python applications with automatic reconnection handling.
  • Subscribe to multiple topics and process incoming messages via callbacks.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides an MQTT client library implementing protocol versions 5.0, 3.1.1, and 3.1 for publishing and subscribing to message topics on an MQTT broker.

Yes, with conditions. The package is stable and well-maintained by Eclipse Foundation, with no known vulnerabilities and low install friction. However, the 494-day gap since last release warrants checking whether your use case can tolerate the known limitations: in-memory session storage (no persistence across restarts) and potential QoS 2 message duplication under certain reconnection scenarios. If those constraints are acceptable, it is a solid choice for MQTT connectivity.

Install

tb-paho-mqtt-client on PyPI

pip

pip install tb-paho-mqtt-client

uv

uv add tb-paho-mqtt-client

poetry

poetry add tb-paho-mqtt-client

Installing tb-paho-mqtt-client

Before you install

Low install friction with no runtime dependencies. Maintenance status is aging (494 days since last release), though the package remains supported for current Python versions (3.7+).

License in practice

Dual-licensed under EPL-2.0 or BSD-3-Clause with copyleft treatment. Users may choose either license; EPL-2.0 requires source disclosure for modifications, while BSD-3-Clause is more permissive.

Quickstart

pip install tb-paho-mqtt-client

import paho.mqtt.client as mqtt

mqttc = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
mqttc.connect("mqtt.eclipseprojects.io", 1883, 60)
mqttc.subscribe("topic/name")
mqttc.loop_forever()

Requires Python 3.7 or later. Release 2.0+ contains breaking API changes; migration guide available in release notes.

Verify before relying

  • Whether the 494-day gap since last release reflects stable maturity or abandonment risk
  • Current state of the known session persistence limitation (in-memory only, not persisted across restarts)
  • Whether QoS 2 double-delivery behavior under clean_session=True is acceptable for your use case

Package facts

License EPL-2.0 OR BSD-3-Clause (copyleft)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 494 days since the last release
First released
Downloads 118,441/month — #12,118 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: tb_paho_mqtt_client-2.1.2-py3-none-any.whl

Keywords: paho

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI ApprovedNatural Language :: EnglishOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: CommunicationsTopic :: Internet

Tags

mqtt client librarypublish subscribe messagingiot connectivity protocolmqtt broker connectionlightweight message transportmachine to machine communicationmqtt python client
mqttiotmessaging

More Internet packages