Skip to content

Commit fbb2174

Browse files
authored
Merge branch 'main' into py_3_14
2 parents 15ac300 + ec78beb commit fbb2174

File tree

21 files changed

+954
-1866
lines changed

21 files changed

+954
-1866
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ jobs:
4040
runs-on: ubuntu-latest
4141
steps:
4242
- uses: actions/checkout@v5
43-
- name: Set up Python
44-
uses: actions/setup-python@v6
43+
- name: Set up uv
44+
uses: astral-sh/setup-uv@v7
4545
with:
4646
python-version: ${{ matrix.python-version }}
47-
- uses: snok/install-poetry@v1.4.1
48-
- name: Install Dependencies
49-
run: poetry install
50-
shell: bash
47+
activate-environment: true
48+
- run: uv pip install pip
5149
- name: Test with Pytest
52-
run: poetry run pytest --log-cli-level=DEBUG -vv -s
50+
run: uv run pytest --log-cli-level=DEBUG -vv -s
5351
shell: bash
5452
release:
5553
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
exclude: "CHANGELOG.md"
4-
default_stages: [ commit ]
4+
default_stages: [ pre-commit ]
55

66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -17,16 +17,17 @@ repos:
1717
- id: detect-private-key
1818
- id: end-of-file-fixer
1919
- id: trailing-whitespace
20-
- repo: https://github.com/python-poetry/poetry
21-
rev: 1.7.1
20+
- repo: https://github.com/astral-sh/uv-pre-commit
21+
rev: 0.9.1
2222
hooks:
23-
- id: poetry-check
23+
- id: uv-sync
24+
args: ["--locked", "--all-packages"]
2425
- repo: https://github.com/codespell-project/codespell
2526
rev: v2.2.6
2627
hooks:
2728
- id: codespell
2829
- repo: https://github.com/charliermarsh/ruff-pre-commit
29-
rev: v0.1.8
30+
rev: v0.13.2
3031
hooks:
3132
- id: ruff-format
3233
- id: ruff

poetry.lock

Lines changed: 0 additions & 1780 deletions
This file was deleted.

pyproject.toml

Lines changed: 51 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,74 @@
1-
[tool.poetry]
1+
[project]
22
name = "python-roborock"
33
version = "2.54.0"
44
description = "A package to control Roborock vacuums."
5-
authors = ["humbertogontijo <humbertogontijo@users.noreply.github.com>"]
6-
license = "GPL-3.0-only"
5+
authors = [{ name = "humbertogontijo", email = "humbertogontijo@users.noreply.github.com" }, {name="Lash-L"}, {name="allenporter"}]
6+
requires-python = ">=3.11, <4"
77
readme = "README.md"
8-
repository = "https://github.com/humbertogontijo/python-roborock"
9-
documentation = "https://python-roborock.readthedocs.io/"
8+
license = "GPL-3.0-only"
9+
keywords = [
10+
"roborock",
11+
"vacuum",
12+
"homeassistant",
13+
]
1014
classifiers = [
1115
"Development Status :: 5 - Production/Stable",
1216
"Intended Audience :: Developers",
1317
"Natural Language :: English",
1418
"Operating System :: OS Independent",
1519
"Topic :: Software Development :: Libraries",
1620
]
17-
packages = [{include = "roborock"}]
18-
keywords = ["roborock", "vacuum", "homeassistant"]
21+
dependencies = [
22+
"click>=8",
23+
"aiohttp>=3.8.2,<4",
24+
"pycryptodome~=3.18",
25+
"pycryptodomex~=3.18 ; sys_platform == 'darwin'",
26+
"paho-mqtt>=1.6.1,<3.0.0",
27+
"construct>=2.10.57,<3",
28+
"vacuum-map-parser-roborock",
29+
"pyrate-limiter>=3.7.0,<4",
30+
"aiomqtt>=2.3.2,<3",
31+
"click-shell~=2.1",
32+
]
33+
34+
[project.urls]
35+
Repository = "https://github.com/humbertogontijo/python-roborock"
36+
Documentation = "https://python-roborock.readthedocs.io/"
1937

20-
[tool.poetry.scripts]
38+
[project.scripts]
2139
roborock = "roborock.cli:main"
2240

23-
[tool.poetry.dependencies]
24-
python = "^3.11"
25-
click = ">=8"
26-
aiohttp = "^3.8.2"
27-
async-timeout = "*"
28-
pycryptodome = "^3.18"
29-
pycryptodomex = {version = "^3.18", markers = "sys_platform == 'darwin'"}
30-
paho-mqtt = ">=1.6.1,<3.0.0"
31-
construct = "^2.10.57"
32-
vacuum-map-parser-roborock = "*"
33-
pyrate-limiter = "^3.7.0"
34-
aiomqtt = "^2.3.2"
35-
click-shell = "^2.1"
41+
[dependency-groups]
42+
dev = [
43+
"pytest-asyncio>=1.1.0",
44+
"pytest",
45+
"pre-commit>=3.5,<5.0",
46+
"mypy",
47+
"ruff==0.13.2",
48+
"codespell",
49+
"pyshark>=0.6,<0.7",
50+
"aioresponses>=0.7.7,<0.8",
51+
"freezegun>=1.5.1,<2",
52+
"pytest-timeout>=2.3.1,<3",
53+
"syrupy>=4.9.1,<5",
54+
"pdoc>=15.0.4,<16",
55+
]
3656

57+
[tool.hatch.build.targets.sdist]
58+
include = ["roborock"]
3759

38-
[build-system]
39-
requires = ["poetry-core==1.8.0"]
40-
build-backend = "poetry.core.masonry.api"
60+
[tool.hatch.build.targets.wheel]
61+
include = ["roborock"]
4162

42-
[tool.poetry.group.dev.dependencies]
43-
pytest-asyncio = ">=1.1.0"
44-
pytest = "*"
45-
pre-commit = ">=3.5,<5.0"
46-
mypy = "*"
47-
ruff = "*"
48-
codespell = "*"
49-
pyshark = "^0.6"
50-
aioresponses = "^0.7.7"
51-
freezegun = "^1.5.1"
52-
pytest-timeout = "^2.3.1"
53-
syrupy = "^4.9.1"
54-
pdoc = "^15.0.4"
63+
[build-system]
64+
requires = ["hatchling"]
65+
build-backend = "hatchling.build"
5566

5667
[tool.semantic_release]
5768
branch = "main"
5869
version_toml = ["pyproject.toml:tool.poetry.version"]
5970
build_command = "pip install poetry && poetry build"
71+
6072
[tool.semantic_release.commit_parser_options]
6173
allowed_tags = [
6274
"chore",
@@ -68,9 +80,9 @@ allowed_tags = [
6880
major_tags= ["refactor"]
6981

7082
[tool.ruff]
71-
ignore = ["F403", "E741"]
83+
lint.ignore = ["F403", "E741"]
7284
line-length = 120
73-
select=["E", "F", "UP", "I"]
85+
lint.select=["E", "F", "UP", "I"]
7486

7587
[tool.ruff.lint.per-file-ignores]
7688
"*/__init__.py" = ["F401"]

roborock/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def _wait_response(self, request_id: int, queue: RoborockFuture) -> Any:
8383
if response == "unknown_method":
8484
raise UnknownMethodError("Unknown method")
8585
return response
86-
except (asyncio.TimeoutError, asyncio.CancelledError):
86+
except (TimeoutError, asyncio.CancelledError):
8787
raise RoborockTimeout(f"id={request_id} Timeout after {self.queue_timeout} seconds") from None
8888
finally:
8989
self._waiting_queue.pop(request_id, None)

roborock/containers.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import re
66
import types
77
from dataclasses import asdict, dataclass, field
8-
from datetime import timezone
98
from enum import Enum
109
from functools import cached_property
1110
from typing import Any, NamedTuple, get_args, get_origin
@@ -717,11 +716,11 @@ def square_meter_area(self) -> float | None:
717716

718717
@property
719718
def begin_datetime(self) -> datetime.datetime | None:
720-
return datetime.datetime.fromtimestamp(self.begin).astimezone(timezone.utc) if self.begin else None
719+
return datetime.datetime.fromtimestamp(self.begin).astimezone(datetime.UTC) if self.begin else None
721720

722721
@property
723722
def end_datetime(self) -> datetime.datetime | None:
724-
return datetime.datetime.fromtimestamp(self.end).astimezone(timezone.utc) if self.end else None
723+
return datetime.datetime.fromtimestamp(self.end).astimezone(datetime.UTC) if self.end else None
725724

726725
def __repr__(self) -> str:
727726
return _attr_repr(self)

roborock/devices/a01_channel.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,14 @@
2929
async def send_decoded_command(
3030
mqtt_channel: MqttChannel,
3131
params: dict[RoborockDyadDataProtocol, Any],
32-
) -> dict[RoborockDyadDataProtocol, Any]:
33-
...
32+
) -> dict[RoborockDyadDataProtocol, Any]: ...
3433

3534

3635
@overload
3736
async def send_decoded_command(
3837
mqtt_channel: MqttChannel,
3938
params: dict[RoborockZeoProtocol, Any],
40-
) -> dict[RoborockZeoProtocol, Any]:
41-
...
39+
) -> dict[RoborockZeoProtocol, Any]: ...
4240

4341

4442
async def send_decoded_command(

roborock/devices/traits/traits_mixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(self, trait: Trait) -> None:
4242
"""
4343
for item in fields(self):
4444
trait_type = _get_trait_type(item)
45-
if trait_type == type(trait):
45+
if trait_type is type(trait):
4646
setattr(self, item.name, trait)
4747
break
4848

roborock/devices/traits/v1/map_content.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Trait for fetching the map content from Roborock devices."""
2+
23
import logging
34
from dataclasses import dataclass
45

roborock/devices/traits/v1/maps.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
with maps and rooms, such as map names and room names. These override the
55
base container datatypes to add additional fields.
66
"""
7+
78
import logging
89
from typing import Self
910

0 commit comments

Comments
 (0)