Skip to content

Commit 43b7d46

Browse files
committed
Update dependencies, cleanup mypy, pylint, etc
1 parent f99b1a6 commit 43b7d46

9 files changed

Lines changed: 107 additions & 316 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ jobs:
2727
strategy:
2828
matrix:
2929
python-version:
30+
- "3.12"
3031
- "3.13"
32+
- "3.14"
3133
poetry-version:
32-
- "2.0.0"
34+
- "2.2.1"
3335
steps:
3436
- uses: actions/checkout@v3
3537
- name: Set up Python
@@ -50,9 +52,11 @@ jobs:
5052
fail-fast: false
5153
matrix:
5254
python-version:
55+
- "3.12"
5356
- "3.13"
57+
- "3.14"
5458
poetry-version:
55-
- "2.0.0"
59+
- "2.2.1"
5660
os:
5761
- ubuntu-latest
5862
- windows-latest

.pre-commit-config.yaml

Lines changed: 3 additions & 2 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
@@ -53,4 +53,5 @@ repos:
5353
hooks:
5454
- id: mypy
5555
exclude: cli.py
56-
additional_dependencies: [ "pydantic>=1.10.17" ]
56+
additional_dependencies: [ "pydantic>=1.10.17", "pytest>=8.0.0" ]
57+
args: [ "--config-file=./pyproject.toml", "--follow-imports=silent", "--strict", "--ignore-missing-imports", "--disallow-subclassing-any", "--no-warn-return-any" ]

poetry.lock

Lines changed: 83 additions & 295 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyomnilogic_local/models/filter_diagnostics.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class Config:
2323
orm_mode = True
2424

2525
def get_param_by_name(self, name: str) -> int:
26-
# pylint: disable=not-an-iterable
2726
return [param.value for param in self.parameters if param.name == name][0]
2827

2928
@staticmethod

pyomnilogic_local/models/mspconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class MSPBackyard(OmniBase):
225225
colorlogic_light: list[MSPColorLogicLight] | None = Field(alias="ColorLogic-Light")
226226

227227

228-
class MSPSchedule(OmniBase): # type: ignore[override]
228+
class MSPSchedule(OmniBase):
229229
omni_type: OmniType = OmniType.SCHEDULE
230230
system_id: int = Field(alias="schedule-system-id")
231231
bow_id: int = Field(alias="bow-system-id")

pyomnilogic_local/models/telemetry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def xml_postprocessor(path: Any, key: Any, value: SupportsInt | Any) -> tuple[An
210210
211211
Pydantic can coerce values natively, but the Omni API returns values as strings of numbers (I.E. "2", "5", etc) and we need them
212212
coerced into int enums. Pydantic only seems to be able to handle one coercion, so it could coerce an int into an Enum, but it
213-
cannot coerce a string into an int and then into the Enum. We help it out a little bit here by pre-emptively coercing any
213+
cannot coerce a string into an int and then into the Enum. We help it out a little bit here by preemptively coercing any
214214
string ints into an int, then pydantic handles the int to enum coercion if necessary.
215215
"""
216216
newvalue: SupportsInt | Any

pyomnilogic_local/models/util.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ def get(self, key: str, default: Any = None) -> Any:
2121

2222

2323
F = TypeVar("F", bound=Callable[..., Awaitable[str]])
24-
TPydanticTypes = Telemetry | MSPConfig | FilterDiagnostics
2524

2625

2726
def to_pydantic(
28-
pydantic_type: type[TPydanticTypes],
27+
pydantic_type: type[Telemetry | MSPConfig | FilterDiagnostics],
2928
) -> Callable[..., Any]:
3029
def inner(func: F, *args: Any, **kwargs: Any) -> F:
3130
"""Wrap an API function that returns XML and parse it into a Pydantic model"""
@@ -34,9 +33,9 @@ def inner(func: F, *args: Any, **kwargs: Any) -> F:
3433
async def wrapper(*args: Any, raw: Literal[True], **kwargs: Any) -> str: ...
3534

3635
@overload
37-
async def wrapper(*args: Any, raw: Literal[False], **kwargs: Any) -> TPydanticTypes: ...
36+
async def wrapper(*args: Any, raw: Literal[False], **kwargs: Any) -> Telemetry | MSPConfig | FilterDiagnostics: ...
3837

39-
async def wrapper(*args: Any, raw: bool = False, **kwargs: Any) -> TPydanticTypes | str:
38+
async def wrapper(*args: Any, raw: bool = False, **kwargs: Any) -> Telemetry | MSPConfig | FilterDiagnostics | str:
4039
resp_body = await func(*args, **kwargs)
4140
if raw:
4241
return resp_body

pyproject.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ authors = [
99
]
1010
license = {text = "Apache-2.0"}
1111
readme = "README.md"
12-
requires-python = ">=3.10,<3.14"
12+
requires-python = ">=3.12"
1313
dependencies = [
14-
"pydantic (>=1.10.17)",
15-
"xmltodict (>=0.13.0,<0.14.0)",
16-
"click (>=8.0.0,<8.1.0)",
14+
"pydantic >=1.10.17,<2.0.0",
15+
"xmltodict >=0.13.0,<2.0.0",
16+
"click >=8.0.0,<8.4.0",
1717
]
1818

1919
[project.scripts]
@@ -23,11 +23,11 @@ omnilogic = "pyomnilogic_local.cli.cli:entrypoint"
2323
packages = [{include = "pyomnilogic_local"}]
2424

2525
[tool.poetry.group.dev.dependencies]
26-
pre-commit = "^3.8.0"
27-
mypy = "^1.14.0"
28-
pylint = "^3.3.3"
26+
pre-commit = "^4.0.0"
27+
mypy = "^1.18.2"
28+
pylint = "^4.0.0"
2929
pytest = "^8.0.0"
30-
pytest-cov = "^4.1.0"
30+
pytest-cov = "^7.0.0"
3131
pytest-asyncio = "^1.2.0"
3232

3333
[build-system]
@@ -44,7 +44,7 @@ profile = "black"
4444
[tool.mypy]
4545
python_version = "3.13"
4646
plugins = [
47-
"pydantic.mypy",
47+
"pydantic.v1.mypy",
4848
]
4949
follow_imports = "silent"
5050
strict = true

tests/test_protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_datagram_received_queue_overflow(caplog: pytest.LogCaptureFixture) -> N
9090
assert any("Data queue is full" in r.message for r in caplog.records)
9191

9292

93-
@pytest.mark.asyncio # type: ignore[misc]
93+
@pytest.mark.asyncio
9494
async def test_ensure_sent_timeout_and_retry_logs(caplog: pytest.LogCaptureFixture) -> None:
9595
"""Test that _ensure_sent logs retries and raises on repeated timeout."""
9696
protocol = OmniLogicProtocol()

0 commit comments

Comments
 (0)