Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions remotestate-py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions remotestate-py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
4 changes: 2 additions & 2 deletions remotestate-py/tests/test_path.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
10 changes: 4 additions & 6 deletions remotestate-py/tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from pydantic import TypeAdapter

from remotestate.protocol import (
IncomingMessage,
ActionMessage,
GetMessage,
IncomingMessage,
OutgoingMessage,
SetMessage,
SetResultMessage,
OutgoingMessage,
ActionMessage,
StateUpdate,
)

Expand Down Expand Up @@ -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():
Expand Down
3 changes: 1 addition & 2 deletions remotestate-py/tests/test_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -17,7 +17,6 @@
_wait_for_port_free,
)


# --- ServeResult ---


Expand Down
6 changes: 3 additions & 3 deletions remotestate-py/tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions remotestate-py/tests/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down