sbtinstruments / aiomqtt

The idiomatic asyncio MQTT client, wrapped around paho-mqtt
https://sbtinstruments.github.io/aiomqtt
BSD 3-Clause "New" or "Revised" License
392 stars 71 forks source link

Make aiomqtt compatible with paho v2 #279

Closed JonathanPlasse closed 3 months ago

JonathanPlasse commented 4 months ago

We could use paho.mqtt.__version__ to determine at runtime whether to pass mqtt.CallbackAPIVersion.VERSION1 to the init call to the paho client.

if mqtt.__version__.startswith("2"):
    client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1)
else:
   client = mqtt.Client()
skewty commented 3 months ago

Is there a compelling reason to not couple "^2.0" and work with it as it is by default?

I did a quick look at the paho v2 asyncio examples and it doesn't look like much has changed / changes look minimal.

JonathanPlasse commented 3 months ago

I will do the PR tonight.

JonathanPlasse commented 3 months ago

This is not as trivial as I thought, the typing and mypy are getting in the way.

JonathanPlasse commented 3 months ago

Hey @empicano, @frederikaalund,

Managing typings for both paho-mqtt 1.6.1 and the newer 2.0 version adds many complexities. Given that 1.6.1 is significantly outdated now, I'm leaning towards fully embracing version 2.0 and discontinuing support for the older one.

This will allow us to leverage the latest features and improvements in 2.0. What are your thoughts on making this transition?

empicano commented 3 months ago

Sounds sensible to me 👍 The extra maintenance burden doesn't seem worth it 🙂

frederikaalund commented 3 months ago

I agree, it sounds very sensible to drop support for the v1.x line of paho.mqtt.

skewty commented 3 months ago

Did this work move into another fork / repo or did development stall? I am not seeing any changes in 5 days.

https://github.com/sbtinstruments/aiomqtt/commit/1862ead1f726893ea2b09051d75544c5fc69dc83

empicano commented 3 months ago

We do this in our free time and for fun, sometimes things take a a little while, and that's okay. If you want to speed things up, you can offer to help out, maybe Jonathan will take you up for it 🙂

skewty commented 3 months ago

Will this go out to pypi as v2.1?

Currently testing it out (no issues so far):

[tool.poetry.dependencies]
aiomqtt = { git = "https://github.com/sbtinstruments/aiomqtt.git", rev = "8321217" }  # until > v2.0.1 released
skewty commented 2 months ago

Is some issue holding up a new pypi release? If so, perhaps this issue should be re-opened with a link to that issue.