Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typing with mypy #791

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -3,6 +3,16 @@ v2.0.0 - 2023-xx-xx

- **BREAKING** Drop support for Python 2.7, Python 3.5 and Python 3.6
Minimum tested version is Python 3.7
- **BREAKING** connect_srv changed it signature to take an additional bind_port parameter.
This is a breaking change, but in previous version connect_srv was broken anyway.
Closes #493.
- Add types to Client class, which caused few change which should be compatible.
Known risk of breaking changes:
- Use enum for returned error code (like MQTT_ERR_SUCCESS). It use an IntEnum
which should be a drop-in replacement. Excepted if someone is doing "rc is 0" instead of "rc == 0".
- reason in on_connect callback when using MQTTv5 is now always a ReasonCode object. It used to possibly be
an integer with the value 132.
- MQTTMessage field "dup" and "retain" used to be integer with value 0 and 1. They are now boolean.
- Add on_pre_connect() callback, which is called immediately before a
connection attempt is made.

9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -67,6 +67,15 @@ include = [
"src/paho",
]

[tool.mypy]

[[tool.mypy.overrides]]
module = "paho.mqtt.client"
# check_untyped_defs = true
# disallow_untyped_calls = true
# disallow_incomplete_defs = true
disallow_untyped_defs = true

[tool.pytest.ini_options]
addopts = ["-r", "xs"]
testpaths = "tests src"
Loading