Open dlangille opened 8 months ago
To be expected; paho mqtt has broken most programs with their 2.0; quite sad. I don’t think we’ve yet added support for it.
core.py:
- mqttc = paho.Client(cf.clientid, clean_session=cf.cleansession, protocol=cf.protocol)
+ mqttc = paho.Client(paho.CallbackAPIVersion.VERSION1, cf.clientid, clean_session=cf.cleansession, protocol=cf.protocol)
Yes, Paho broke that very badly, and it affects hundreds of peoples' programs.
If you care to produce a PR we'll take it.
omg. Thanks for letting us know, and apologies for the late reply. We will take corresponding steps to remedy the problem in one way or another.
Paho™ MQTT Python v2.0.0, released on Feb 10 2024, includes breaking changes. See migration instructions for more details on how to upgrade. The release also introduces new documentation available online.
-- https://github.com/eclipse/paho.mqtt.python/releases/tag/v2.0.0
At least the dependency version pinning in project metadata is right. So, when package managers are taking them into account, nothing should break from one day to the other accidentally?
https://github.com/mqtt-tools/mqttwarn/blob/e09628982ce3aff2b8012c8be8c2e78da997a919/setup.py#L21
NB: I am just trying to assess the seriousness and impact of the issue. @dlangille: Did you upgrade py39-paho-mqtt
to the next major version deliberately, or did it happen automatically? Is it possible for BSD to have both versions at the same time, or are you currently destined to exclusively run the previous version of paho mqtt, because of this situation, while you actually would like to upgrade?
@dlangille: Relaying the error you reported....
ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see migrations.md for details
... it probably relates to the topmost item from the v2.0.0 release notes:
[!CAUTION] BREAKING: Added callback_api_version. This breaks ALL users of paho-mqtt's Client class.
See migrations.rst for details on how to upgrade. tl; dr; add
CallbackAPIVersion.VERSION1
to first argument ofClient()
.
Fixing this sounds easy.
AttributeError: ‘MQTTClient’ object has no attribute ‘_sock’
, see below.I've just submitted a patch to remedy the breaking change on the most prominent spot, based on learnings from https://github.com/mqtt-tools/pytest-mqtt/pull/18.
However, I don't think that patch will be accepted, as the authors seem to pretty strong about this detail?
Hi. It looks like my patch might get accepted, helping users in basic use case scenarios to upgrade to Paho MQTT client version 2 without a breaking change. Naturally, it will not work in more advanced cases, as outlined by @PierreF on the same discussion. Thanks!
It looks like paho-mqtt v2 is causing serious havoc throughout the community. That is natural with breaking changes, and apparently, much of what is behind is about the proper transitioning to support MQTTv5, which makes things different under the hood.
However, I did not dig deeper, and, in this spirit, I am not able to evaluate the situation better than submitting that humble patch, and hoping for the best outcomes in the long run. That such an event feels annoying, is perfectly reasonable. However, sometimes such changes must happen, and all we can take away from that is that all users of packages should apply version pinning properly, in order not to run into such situations. In this case, paho-mqtt<2
.
For mqttwarn, I think it is sensible to wait for any further changes happen on paho-mqtt. Because mqttwarn is correctly applying the version pinning, I guess there is not much else to do at this point in time? Please let us know if you think differently.
https://github.com/mqtt-tools/mqttwarn/blob/9d61fc59bca6cbee88d6b46f00de4076764cd0b0/setup.py#L21
Have you tried 2.1.0? I did, yesterday, no luck for me.
I've been unable to get
mqttwarn
to start today after updatingpy39-paho-mqtt
: 1.6.1 -> 2.0.0Reverting to 1.6.1 gets it running again.
Seem related to https://stackoverflow.com/questions/77984857/paho-mqtt-unsupported-callback-api-version-error?noredirect=1