Skip to content

Commit 1097a18

Browse files
authored
Merge pull request #791 from eclipse/add-typing
Add typing with mypy
2 parents 2eb5350 + 6f57ce9 commit 1097a18

9 files changed

Lines changed: 1136 additions & 584 deletions

File tree

ChangeLog.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ v2.0.0 - 2023-xx-xx
33

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

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ include = [
6767
"src/paho",
6868
]
6969

70+
[tool.mypy]
71+
72+
[[tool.mypy.overrides]]
73+
module = "paho.mqtt.client"
74+
# check_untyped_defs = true
75+
# disallow_untyped_calls = true
76+
# disallow_incomplete_defs = true
77+
disallow_untyped_defs = true
78+
7079
[tool.pytest.ini_options]
7180
addopts = ["-r", "xs"]
7281
testpaths = "tests src"

0 commit comments

Comments
 (0)