Skip to content

Commit 5d1029f

Browse files
committed
ci: swap poetry to uv and update some pre-commit checks
1 parent 808b955 commit 5d1029f

9 files changed

Lines changed: 59 additions & 921 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,18 @@ jobs:
2929
python-version:
3030
- "3.12"
3131
- "3.13"
32-
poetry-version:
33-
- "2.2.1"
3432
steps:
3533
- uses: actions/checkout@v3
34+
- name: Install uv
35+
uses: astral-sh/setup-uv@v5
36+
with:
37+
enable-cache: true
3638
- name: Set up Python
3739
uses: actions/setup-python@v4
3840
with:
3941
python-version: ${{ matrix.python-version }}
40-
- name: Set up Poetry
41-
uses: abatilo/actions-poetry@v4.0.0
42-
with:
43-
poetry-version: ${{ matrix.poetry-version }}
4442
- name: Install Dependencies
45-
run: poetry install
43+
run: uv sync --all-extras
4644
shell: bash
4745
- uses: pre-commit/action@v3.0.0
4846

@@ -53,28 +51,26 @@ jobs:
5351
python-version:
5452
- "3.12"
5553
- "3.13"
56-
poetry-version:
57-
- "2.2.1"
5854
os:
5955
- ubuntu-latest
6056
- windows-latest
6157
- macOS-latest
6258
runs-on: ${{ matrix.os }}
6359
steps:
6460
- uses: actions/checkout@v3
61+
- name: Install uv
62+
uses: astral-sh/setup-uv@v5
63+
with:
64+
enable-cache: true
6565
- name: Set up Python
6666
uses: actions/setup-python@v4
6767
with:
6868
python-version: ${{ matrix.python-version }}
69-
- name: Set up Poetry
70-
uses: abatilo/actions-poetry@v4.0.0
71-
with:
72-
poetry-version: ${{ matrix.poetry-version }}
7369
- name: Install Dependencies
74-
run: poetry install
70+
run: uv sync --all-extras
7571
shell: bash
7672
- name: Test with Pytest
77-
run: poetry run pytest
73+
run: uv run pytest
7874
shell: bash
7975
release:
8076
runs-on: ubuntu-latest

.gitignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,9 @@ ipython_config.py
9494
# install all needed dependencies.
9595
#Pipfile.lock
9696

97-
# poetry
98-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102-
#poetry.lock
97+
# uv
98+
# uv.lock should be committed to version control for reproducibility
99+
# uv.lock
103100

104101
# pdm
105102
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.

.pre-commit-config.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,21 @@ 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: 2.2.1
20+
- repo: https://github.com/astral-sh/uv-pre-commit
21+
# uv version.
22+
rev: 0.9.5
2223
hooks:
23-
- id: poetry-check
24+
- id: uv-lock
25+
- repo: https://github.com/codespell-project/codespell
26+
rev: v2.4.1
27+
hooks:
28+
- id: codespell
29+
- repo: https://github.com/charliermarsh/ruff-pre-commit
30+
rev: v0.14.1
31+
hooks:
32+
- id: ruff-check
33+
args: [ --fix ]
34+
- id: ruff-format
2435
- repo: https://github.com/PyCQA/isort
2536
rev: 7.0.0
2637
hooks:
@@ -29,22 +40,11 @@ repos:
2940
rev: 25.9.0
3041
hooks:
3142
- id: black
32-
- repo: https://github.com/codespell-project/codespell
33-
rev: v2.4.1
34-
hooks:
35-
- id: codespell
36-
exclude: poetry.lock
37-
- repo: https://github.com/charliermarsh/ruff-pre-commit
38-
rev: v0.14.1
39-
hooks:
40-
- id: ruff
41-
args:
42-
- --fix
4343
- repo: local
4444
hooks:
4545
- id: pylint
4646
name: pylint
47-
entry: poetry run pylint
47+
entry: uv run pylint
4848
language: system
4949
types: [python]
5050
require_serial: true

poetry.lock

Lines changed: 0 additions & 856 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
class ColorLogicLight:
2-
32
pass

pyomnilogic_local/models/mspconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class MSPSchedule(OmniBase):
333333
| MSPColorLogicLight
334334
)
335335

336-
type MSPConfigType = (MSPSystem | MSPEquipmentType)
336+
type MSPConfigType = MSPSystem | MSPEquipmentType
337337

338338

339339
class MSPConfig(BaseModel):

pyomnilogic_local/models/telemetry.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any, SupportsInt, TypeVar, cast, overload
3+
from typing import Any, SupportsInt, cast, overload
44

55
from pydantic import BaseModel, ConfigDict, Field, ValidationError, computed_field
66
from xmltodict import parse as xml_parse
@@ -88,7 +88,8 @@ class TelemetryChlorinator(BaseModel):
8888
operating_mode: ChlorinatorOperatingMode | int = Field(alias="@operatingMode")
8989
enable: bool = Field(alias="@enable")
9090

91-
@computed_field
91+
@computed_field # type: ignore[prop-decorator]
92+
@property
9293
def status(self) -> list[str]:
9394
"""Decode status bitmask into a list of active status flag names.
9495
@@ -101,7 +102,8 @@ def status(self) -> list[str]:
101102
"""
102103
return [flag.name for flag in ChlorinatorStatus if self.status_raw & flag.value and flag.name is not None]
103104

104-
@computed_field
105+
@computed_field # type: ignore[prop-decorator]
106+
@property
105107
def alerts(self) -> list[str]:
106108
"""Decode chlrAlert bitmask into a list of active alert flag names.
107109
@@ -131,7 +133,8 @@ def alerts(self) -> list[str]:
131133

132134
return final_flags
133135

134-
@computed_field
136+
@computed_field # type: ignore[prop-decorator]
137+
@property
135138
def errors(self) -> list[str]:
136139
"""Decode chlrError bitmask into a list of active error flag names.
137140
@@ -161,7 +164,8 @@ def errors(self) -> list[str]:
161164

162165
return final_flags
163166

164-
@computed_field
167+
@computed_field # type: ignore[prop-decorator]
168+
@property
165169
def active(self) -> bool:
166170
"""Check if the chlorinator is actively generating chlorine.
167171
@@ -326,15 +330,10 @@ class Telemetry(BaseModel):
326330

327331
@staticmethod
328332
def load_xml(xml: str) -> Telemetry:
329-
TypeVar("KT")
330-
TypeVar("VT", SupportsInt, Any)
331-
332333
@overload
333334
def xml_postprocessor(path: Any, key: Any, value: SupportsInt) -> tuple[Any, SupportsInt]: ...
334-
335335
@overload
336336
def xml_postprocessor(path: Any, key: Any, value: Any) -> tuple[Any, Any]: ...
337-
338337
def xml_postprocessor(path: Any, key: Any, value: SupportsInt | Any) -> tuple[Any, SupportsInt | Any]:
339338
"""Post process XML to attempt to convert values to int.
340339

pyomnilogic_local/system.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33

44
class System(OmniEquipment):
5-
65
pass

pyproject.toml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,17 @@ dependencies = [
1919
[project.scripts]
2020
omnilogic = "pyomnilogic_local.cli.cli:entrypoint"
2121

22-
[tool.poetry]
23-
packages = [{include = "pyomnilogic_local"}]
24-
25-
[tool.poetry.group.dev.dependencies]
26-
pre-commit = "^4.0.0"
27-
mypy = "^1.18.2"
28-
pylint = "^4.0.0"
29-
pytest = "^8.0.0"
30-
pytest-cov = "^7.0.0"
31-
pytest-asyncio = "^1.2.0"
32-
33-
[tool.poetry.group.cli.dependencies]
34-
scapy = "^2.6.1"
22+
[project.optional-dependencies]
23+
cli = [
24+
"scapy>=2.6.1,<3.0.0",
25+
]
3526

3627
[build-system]
37-
requires = ["poetry-core>=2.0.0,<3.0.0"]
38-
build-backend = "poetry.core.masonry.api"
28+
requires = ["hatchling"]
29+
build-backend = "hatchling.build"
30+
31+
[tool.hatch.build.targets.wheel]
32+
packages = ["pyomnilogic_local"]
3933

4034
[tool.black]
4135
line-length=140
@@ -140,4 +134,14 @@ line-length = 140
140134
[tool.semantic_release]
141135
branch = "main"
142136
version_toml = "pyproject.toml:project.version"
143-
build_command = "pip install poetry && poetry build"
137+
build_command = "pip install hatch && hatch build"
138+
139+
[dependency-groups]
140+
dev = [
141+
"pre-commit>=4.0.0,<5.0.0",
142+
"mypy>=1.18.2,<2.0.0",
143+
"pylint>=4.0.0,<5.0.0",
144+
"pytest>=8.0.0,<9.0.0",
145+
"pytest-cov>=7.0.0,<8.0.0",
146+
"pytest-asyncio>=1.2.0,<2.0.0",
147+
]

0 commit comments

Comments
 (0)