All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Implement
len(client.messages)
to return number of messages in queue (@empicano in #323)
- Update FastAPI docs to use dependency injection (@odie5533 in #321)
- Bump paho-mqtt to 2.1 (@empicano in #305)
- Migrate to paho-mqtt callback v2 (@empicano in #313)
- Fix
Client.messages
not being reusable (@ryan-summers in #312)
- Migrate to paho-mqtt 2.0 (@JonathanPlasse in #286)
- Configure
poetry-dynamic-versioning
to replace__version__
and__version_tuple__
variables (@vvanglro in #273) - Reset internal state when connection attempt in
__aenter__
times out (@empicano in #285)
- Test for Python 3.12 (@JonathanPlasse in #256)
- Add migration guide (@empicano in #262)
- Switch to client-wide queue (@empicano in #262)
- Switch from black to Ruff and update dev dependencies (@JonathanPlasse in #255)
- Rename
Client.id
attribute toidentifier
(@empicano in #262)
- Remove deprecated
connect
/disconnect
methods (@empicano in #262) - Remove deprecated
filtered_messages
andunfiltered_messages
methods (@empicano in #262) - Remove deprecated
message_retry_set
client argument (@empicano in #262)
- Release reusability correctly to allow consecutive calls to
__aexit__
(@spacemanspiff2007 in #263)
- Deprecate
connect
anddisconnect
in favor of direct calls to__aenter__
and__aexit__
. (@empicano in #247)
- Release lock in
__aexit__
only if acquired (@spacemanspiff2007 in #249)
- Drop support for Python 3.7. Contributed by Felix Böhm (@empicano) in #246
- Fix
__aenter__
failing to release lock when initial connection fails. Contributed by Peanut (@vvanglro) in #245
- Expose paho's
tls_insecure
argument. Contributed by Bob Steers (@steersbob) in #234 - Add reference section generated from docstrings to documentation. Contributed by Felix Böhm (@empicano) in #231
- Don't suppress exceptions in the client's
__aexit__
. Contributed by Robert Resch (@edenhaus) in #232 - Match
topic/subtopic
withtopic/subtopic/#
wildcard according to MQTT documentation. Contributed by Bob Steers (@steersbob) in #241
- Move documentation from
README
to Sphinx. Contributed by Felix Böhm (@empicano) in #159 - Add CI workflow to deploy documentation to GitHub Pages. Contributed by Felix Böhm (@empicano) in #159
- Add Flow Control options to the Client-Constructor. Contributed by Andreas Heine (@andreasheine) in #180
- Make
Client.pending_calls_threshold
public. Contributed by Jonathan Plasse (@JonathanPlasse) in #185 - Make Client a reusable (but not reentrant) context manager. Contributed by Peanut (@vvanglro) in #216
- Make default timeout configurable. Contributed by Scott P. (@skewty) in #192
- Switch from pip to poetry for dependency management. Contributed by Felix Böhm (@empicano) in #210
- Rename project from asyncio-mqtt to aiomqtt. Contributed by Felix Böhm (@empicano) in #210
- Rename
master
branch tomain
. Contributed by Jonathan Plasse (@JonathanPlasse)
- Consistently use a user-provided logger. Contributed by Roman Novatorov (@rnovatorov) in #176
Yanked. We recently renamed the project from asyncio-mqtt to aiomqtt. Problem is that the old aiomqtt (by mossblaser) was still in use. These users suddenly experienced a breaking change when they updated from v0.1.2 to v0.17.0. Our mitigation is to yank v0.17.0 and release a v1.0.0 in it's place. It was about time for a v1.0.0 release anyhow!
- Add properties in Message, the last release skipped this commit. Contributed by Jonathan Plasse (@JonathanPlasse)
- Add properties in Message. Contributed by Jonathan Plasse (@JonathanPlasse) in #166
- Update Ruff and fix new lint errors. Contributed by pre-commit-ci and Jonathan Plasse (@JonathanPlasse) in #161
- Update tooling. Contributed by pre-commit-ci and Jonathan Plasse (@JonathanPlasse) in #184
- Allow multiple message generators at the same time. Contributed by Felix Böhm (@empicano) in #147
- Simplify message filtering. Contributed by Felix Böhm (@empicano) in #147
- Switch from
flake8
toruff
for linting. Contributed by Jonathan Plasse (@JonathanPlasse) in #155
- Add pre-commit for continuous integration. Contributed by Jonathan Plasse (@JonathanPlasse) in #144
- Add tests and coverage for continuous integration. Contributed by Jonathan Plasse (@JonathanPlasse) in #145 and #149
- Add continuous deployment to PyPI. Contributed by Jonathan Plasse (@JonathanPlasse) in #151
- Reorder
README.md
sections in order of importance. Contributed by Felix Böhm (@empicano) in #140 - Change from
setup.py
topyproject.toml
. Contributed by Jonathan Plasse (@JonathanPlasse) in #151
- Drop Python 3.6 support. Contributed by Jonathan Plasse (@JonathanPlasse) in #146
- Fix lifespan example in
README.md
. Contributed by Jonathan Plasse (@JonathanPlasse) and Felix Böhm (@empicano) in #135
- Add
proxy
andtls_params
examples toREADME.md
. Contributed by Muhammad Sohaib Arshid (@Sohaib90) in #128 - Add
proxy
option. Contributed by Muhammad Sohaib Arshid (@Sohaib90) in #127 - Add
tls_params
option. Contributed by Muhammad Sohaib Arshid (@Sohaib90) in #126 - Add WebSocket connection options. Contributed by Dustin C. Hatch (@AdmiralNemo) in #115
- Add LICENSE to tarballs produced during build. Contributed by Stewart Haines (@stewarthaines) in #107
- Rework type hints of the entire project to make it compliant with mypy in strict mode. Contributed by Jonathan Plasse (@JonathanPlasse) in #133
- Rework related projects in
README.md
. Contributed by Felix Böhm (@empicano) in #132 - Increase LoC count from 600 to 700 in
README.md
.
- Fix autocomplete for
_outgoing_call
decorator. Contributed by Jonathan Plasse (@JonathanPlasse) in #134 - Fix missing ProtocolVersion import in
README.md
and format the entireREADME.md
. Contributed by Felix Böhm (@empicano) in #130 - Fix 'asyncio_mqtt' has no attribute 'TLSParameters' error. Contributed by Felix Böhm (@empicano) in #129
- Fix formatting in
README.md
. Contributed by Marcelo Trylesinski (@Kludex) in #128 - Fix race conditions that may cause
InvalidStateError
. Contributed by Andreas Hangauer (@aha79) in #123 - Fix thread safety in socket close callback. Contributed by Dustin C. Hatch (@AdmiralNemo) in #114
- Fix
TypeError
with the new_outgoing_call
decorator.
- Add backpressure mechanism to limit the number of concurrent outgoing calls. Contributed by Aaron Bach (@bachya) in #101
- Fix race condition in the "advanced example" in
README.md
. Contributed by Steve Palmer (@steverpalmer) in #93 - Make
password
keyword argument optional (as it always should have been). Contributed by @Shikoruma in #89 - Fix false positive type error from Pyright regarding
asynccontextmanager
. Contributed by Shawn Wilsher (@sdwilsh) in #87 - Fix type hints (mostly related to async_generator). Contributed by @laundmo in #86
- Add link to PyPI package with a badge in
README.md
. Contributed by Paul Barker (@pbrkr) in #72
- Convert reason codes into English error messages. Contributed by @CptSpaceToaster in #74
- Fix event loop block caused by paho's reconnection feature. Contributed by Martin Hjelmare (@MartinHjelmare) in #85
- Add new parameter
socket_options
toClient.__init__
. Contributed by @xydan83 in #71 - Add new parameter
message_retry_set
toClient.__init__
. Contributed by @xydan83 in #69 - Export
ProtocolVersion
from the main module. Contributed by André (@tropxy) in #65 (1/2) - Add documentation about publishers, client arguments, etc. Contributed by André (@tropxy) in #65 (2/2)
- Fix race condition that caused
InvalidStateError
inforce_disconnect()
. Contributed by @functionpointer in #67
- Fix handling of MQTTv5 reason codes. Contributed by Jakob Schlyter (@jschlyter) in #59
- Account for
-1
socket handles in the close callback. Contributed by @wrobell in #60
- Add type hints. Contributed by Ellis Percival (@flyte) in #37
- Add the
keepalive
,bind_address
,bind_port
,clean_start
,properties
arguments. Contributed by Marcin Jaworski (@yawor) in #56
- Fix Python 3.6 compatibility. Contributed by (@fipwmaqzufheoxq92ebc) in #57. Note that asyncio-mqtt officially targets Python 3.7. Compatibility with 3.6 is community-driven.
- Fix "Broken pipe" error. Contributed by Gilbert (@gilbertsmink) in #55
- Fix socket check when you select the WebSocket transport. Contributed by Robert Chmielowiec (@chmielowiec) in #54
- Fix
TypeError
on invalid username and password combination - Check that _misc_task is not None before trying to cancel it. Contributed by Ellis Percival (@flyte) in #41
- Fix exception in
on_socket_open
: Non-thread-safe operation invoked on an event loop other than the current one. Contributed by Ellis Percival (@flyte) in #40
- Fix
AttributeError
when you use WebSockets. Contributed by Robert Chmielowiec (@chmielowiec) in #36 - Fix
asyncio.InvalidStateError
in the_on_connect
callback. Contributed by Maxim Shmalovsky (@vitalalerter) in #31 - Fix "Future exception was never retrieved" on disconnect. Contributed by Martin Hjelmare (@martinhjelmare) in #25
- Fix
connect
so it no longer blocks the event loop. Contributed by Øystein Haug Olsen (@oholsen) in #23
- Add
transport
argument toClient
. Contributed by @opengs in #21 - Add
clean_session
argument toClient
. Contributed by @nadyka in #17
I've tested the library for production use at SBT Instruments. This uncovered a bunch of bugs and missing features that I've addressed in this release. We are approaching a 1.0.0 release. Let me know if you want something changed before that via the issue tracker on GitHub.
- Add support for MQTTv5.
- Add
will
keyword argument toClient
. - Add
MqttConnectError
with specific error messages for connection failures. - Add
Client.id
property that returns the client ID (orNone
if the client ID was not specified during construction).
- Fix unhandled exception error.
- Fix "Task was destroyed but it is pending" error.
- Fix compatibility with
asyncqt
's event loop. - Fix race condition in
Client.connect
that raised anAttributeError
. - Fix "[asyncio] Future exception was never retrieved" debug message.
- Fix support for python 3.6. Contributed by Derrick Lyndon Pallas (@pallas) in #12
- No longer logs exception in
Client.__aexit__
. It's perfectly valid to exit due to, e.g.,asyncio.CancelledError
so let's not treat it as an error.
- Add support for python 3.6. Contributed by Derrick Lyndon Pallas (@pallas) in #7 (1/2).
- Add
client_id
andtls_context
keyword arguments to theClient
constructor. Contributed by Derrick Lyndon Pallas (@pallas) in #7 (2/2). - Add
timeout
keyword argument to bothClient.connect
andClient.disconnect
. Default value of10
seconds (like the other functions).
- Propagate disconnection errors to subscribers. This enables user code to detect if a disconnect occurs. E.g., due to network errors.
-
BREAKING CHANGE: Forward the MQTTMessage class from paho-mqtt instead of just the
payload
. This applies to bothClient.filtered_messages
andClient.unfiltered_messages
.This way, user code not only gets the message
payload
but also thetopic
,qos
level,retain
flag, etc.Contributed by Matthew Bradbury (@MBradbury) in #3.
- Fix log message context for
Client.filtered_messages
.
- Fix regression with the
Client._wait_for
helper method introduced in the latest release.
-
BREAKING CHANGE: Replace all uses of
asyncio.TimeoutError
withMqttError
.Calls to
Client.subscribe
/unsubscribe
/publish
will no longer raiseasyncio.TimeoutError.
The new behaviour makes it easier to reason about, which exceptions the library throws:
- Wrong input parameters? Raise
ValueError
. - Network or protocol failures?
MqttError
. - Broken library state?
RuntimeError
.
- Wrong input parameters? Raise
- Fix how keyword arguments are forwarded in
Client.publish
andClient.subscribe
.
- Remove log call that was erroneously put in while debugging the latest release.
- Add missing parameters to
Client.publish
. - Fix error in
Client.publish
when paho-mqtt publishes immediately.
Initial release.