From ad3b9bb87506dd968603b7fc9a6261d8a4830c83 Mon Sep 17 00:00:00 2001 From: Norman Fomferra Date: Wed, 8 Jul 2026 09:35:26 +0200 Subject: [PATCH 1/2] new tools "checks" and "format" --- .github/workflows/ci.yml | 9 +++------ remotestate-py/pyproject.toml | 19 ++++++++++++++++--- remotestate-py/tests/test_path.py | 4 ++-- remotestate-py/tests/test_protocol.py | 10 ++++------ remotestate-py/tests/test_serve.py | 3 +-- remotestate-py/tests/test_server.py | 6 +++--- remotestate-py/tests/test_service.py | 1 + 7 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2205929..7c41528 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,13 +20,10 @@ jobs: manifest-path: remotestate-py/pyproject.toml locked: true - - name: Lint - run: pixi run lint + - name: Checks + run: pixi run checks - - name: Typecheck - run: pixi run mypy - - - name: Test + - name: Tests run: pixi run tests typescript-library: diff --git a/remotestate-py/pyproject.toml b/remotestate-py/pyproject.toml index 0de3c23..f56f423 100644 --- a/remotestate-py/pyproject.toml +++ b/remotestate-py/pyproject.toml @@ -65,8 +65,21 @@ remotestate = { path = ".", editable = true } [tool.pixi.tasks] build = "python -m build" -format = "ruff format src" -isort = "isort src" -lint = "ruff check src" +isort = "isort src tests" +jl = "jupyter-lab" mypy = "mypy src" +ruff-check = "ruff check src tests" +ruff-format = "ruff format src tests" tests = "pytest tests" + +[tool.pixi.tasks.checks] +depends-on = [ + "ruff-check", + "mypy", +] + +[tool.pixi.tasks.format] +depends-on = [ + "isort", + "ruff-format", +] \ No newline at end of file diff --git a/remotestate-py/tests/test_path.py b/remotestate-py/tests/test_path.py index 5b9f845..2156e74 100644 --- a/remotestate-py/tests/test_path.py +++ b/remotestate-py/tests/test_path.py @@ -1,9 +1,9 @@ -import remotestate as rs import pytest +import remotestate as rs from remotestate.path import ( - from_jsonpath, format_path, + from_jsonpath, normalize_path, normalize_path_segment, parse_path, diff --git a/remotestate-py/tests/test_protocol.py b/remotestate-py/tests/test_protocol.py index 6d6e6b1..cec638d 100644 --- a/remotestate-py/tests/test_protocol.py +++ b/remotestate-py/tests/test_protocol.py @@ -4,12 +4,12 @@ from pydantic import TypeAdapter from remotestate.protocol import ( - IncomingMessage, + ActionMessage, GetMessage, + IncomingMessage, + OutgoingMessage, SetMessage, SetResultMessage, - OutgoingMessage, - ActionMessage, StateUpdate, ) @@ -40,9 +40,7 @@ def test_set_result(): "call_id": "x", "updates": [{"path": ["count"], "value": 7}], } - ) == SetResultMessage( - call_id="x", updates=[StateUpdate(path=("count",), value=7)] - ) + ) == SetResultMessage(call_id="x", updates=[StateUpdate(path=("count",), value=7)]) def test_rejects_legacy_string_path(): diff --git a/remotestate-py/tests/test_serve.py b/remotestate-py/tests/test_serve.py index 03fe5af..b413f50 100644 --- a/remotestate-py/tests/test_serve.py +++ b/remotestate-py/tests/test_serve.py @@ -2,8 +2,8 @@ import socket import threading import time -from urllib.parse import parse_qs, urlsplit from unittest.mock import MagicMock, patch +from urllib.parse import parse_qs, urlsplit import pytest @@ -17,7 +17,6 @@ _wait_for_port_free, ) - # --- ServeResult --- diff --git a/remotestate-py/tests/test_server.py b/remotestate-py/tests/test_server.py index f89398f..f9caf13 100644 --- a/remotestate-py/tests/test_server.py +++ b/remotestate-py/tests/test_server.py @@ -5,14 +5,14 @@ from remotestate.protocol import ( ActionMessage, + ActionResultMessage, ErrorMessage, GetMessage, GetResultMessage, - SetMessage, - SetResultMessage, - ActionResultMessage, QueryMessage, QueryResultMessage, + SetMessage, + SetResultMessage, StateUpdate, ) from remotestate.server import Server, WebSocketTransport diff --git a/remotestate-py/tests/test_service.py b/remotestate-py/tests/test_service.py index 09e95cb..8237a5c 100644 --- a/remotestate-py/tests/test_service.py +++ b/remotestate-py/tests/test_service.py @@ -141,6 +141,7 @@ async def set(self, count: int): def test_notify_method_name_is_reserved(): with pytest.raises(TypeError, match="conflicts with a reserved"): + class BadNotifyService(Service): @action async def notify(self): From 8525c165471d89c935067234c4de6f07864257f3 Mon Sep 17 00:00:00 2001 From: Norman Fomferra Date: Wed, 8 Jul 2026 09:38:52 +0200 Subject: [PATCH 2/2] Updated docs --- CONTRIBUTING.md | 6 ++---- remotestate-py/README.md | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index db88867..80fb860 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,16 +24,14 @@ you touch. ```bash cd remotestate-py pixi install -pixi run lint -pixi run mypy +pixi run checks pixi run tests ``` -Useful additional commands: +Useful additional command: ```bash pixi run format -pixi run isort ``` ### TypeScript library diff --git a/remotestate-py/README.md b/remotestate-py/README.md index cf940da..90a9621 100644 --- a/remotestate-py/README.md +++ b/remotestate-py/README.md @@ -30,11 +30,9 @@ pixi add remotestate - Python `>= 3.12` - from the package directory: `cd remotestate-py` - install dependencies with `pixi install` -- run tests with `pixi run tests` -- lint with `pixi run lint` - format with `pixi run format` -- reorder imports with `pixi run isort` -- type-check with `pixi run mypy` +- run checks with `pixi run checks` +- run tests with `pixi run tests` - build a wheel with `pixi run build` ## Quick Start