Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -eo pipefail

uv run task fix
uv run camas --under 2s
10 changes: 3 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ jobs:

- uses: astral-sh/setup-uv@v8.1.0

- run: uv run --python ${{ matrix.python-version }} task lint

- run: uv run --python ${{ matrix.python-version }} task typecheck

- run: uv run --python ${{ matrix.python-version }} task test
- run: uv run --python ${{ matrix.python-version }} camas

- run: uv build

Expand Down Expand Up @@ -130,7 +126,7 @@ jobs:

- uses: astral-sh/setup-uv@v8.1.0

- run: uv run task coverage
- run: uv run camas coverage

integration:
name: integration (native_sim + qemu)
Expand All @@ -147,7 +143,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y --no-install-recommends qemu-system-arm libc6:i386

- run: uv run task test-integration
- run: uv run camas test-integration

- name: Upload integration test logs
if: always()
Expand Down
14 changes: 14 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"mcpServers": {
"camas": {
"type": "stdio",
"command": "uv",
"args": [
"run",
"camas",
"mcp",
"--rich"
]
}
}
}
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ putting ~1.37× `buf_size` encoded bytes on the wire, across the buffer-size mat

> Assumes that you've already [setup your development environment](#development-environment-setup).

Tasks are defined in [`tasks.py`](tasks.py) and run with [camas](https://github.com/JPHutchins/camas) — the same definitions drive local development and CI, so running a task locally reproduces CI exactly. Run `uv run camas --list` to see every task.

1. run `uv sync` when pulling in new changes
2. run `uv run task fix` after making changes (fast)
3. run `uv run task all` after making changes (thorough)
2. run `uv run camas fix` after making changes (fast)
3. run `uv run camas all` after making changes (thorough)
4. add library dependencies with `uv`:
```
uv add <my_new_dependency>
Expand All @@ -152,7 +154,7 @@ putting ~1.37× `buf_size` encoded bytes on the wire, across the buffer-size mat
```
6. run tests for all supported python versions:
```
uv run task matrix
uv run camas matrix
```

## Development Environment Setup
Expand All @@ -170,7 +172,7 @@ uv sync
### Verify Your Setup

```
uv run task all
uv run camas all
```

### Enable the githooks
Expand Down
19 changes: 1 addition & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ dev = [
"pytest-cov>=7.0.0",
"pytest-asyncio>=0.23.2",
"ruff>=0.12.0",
"taskipy>=1",
"camas[mcp,check]==0.1.13",
]
doc = [
"mkdocstrings[python]>=0.26.1",
Expand All @@ -74,23 +74,6 @@ doc = [
"smp>=4.1.0",
]

[tool.taskipy.tasks]
format = "ruff format ."
lint = "ruff check . && pydoclint src/smpclient"
fix = "ruff check --fix . && ruff format ."
typecheck = "mypy ."
test = "pytest --maxfail=1 --ignore=tests/integration"
test-integration = "pytest tests/integration --log-file=integration-tests.log --log-file-level=DEBUG --log-cli-level=INFO -o log_cli=true"
coverage = "pytest --cov --cov-report=xml --cov-report=term-missing --ignore=tests/integration"
all = "task format && task lint && task typecheck && task test"
matrix = """
UV_PROJECT_ENVIRONMENT=.venv-3.10 uv run --python 3.10 task all &&
UV_PROJECT_ENVIRONMENT=.venv-3.11 uv run --python 3.11 task all &&
UV_PROJECT_ENVIRONMENT=.venv-3.12 uv run --python 3.12 task all &&
UV_PROJECT_ENVIRONMENT=.venv-3.13 uv run --python 3.13 task all &&
UV_PROJECT_ENVIRONMENT=.venv-3.14 uv run --python 3.14 task all
"""

[tool.ruff]
line-length = 100
extend-exclude = ["dutfirmware", ".claude"]
Expand Down
49 changes: 49 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""Project tasks for camas — the single definition shared by local dev and CI."""

from pathlib import Path

from camas import Config, Parallel, Sequential, Task

format = Task("ruff format .", mutates=True)

lint = Sequential(
Task("ruff check ."),
Task("pydoclint src/smpclient"),
)

fix = Sequential(
Task("ruff check --fix .", mutates=True),
Task("ruff format .", mutates=True),
)

typecheck = Task("mypy .")

test = Task("pytest --maxfail=1 --ignore=tests/integration")

test_integration = Task(
"pytest tests/integration --log-file=integration-tests.log "
"--log-file-level=DEBUG --log-cli-level=INFO -o log_cli=true"
)

coverage = Task(
"pytest --cov --cov-report=xml --cov-report=term-missing --ignore=tests/integration"
)

check = Parallel(lint, typecheck, test)

all = Sequential(format, check)

_PYTHONS = (Path(__file__).parent / ".python-version").read_text().split()

matrix = Sequential(
*(
Task(
f"uv run --python {v} camas all",
name=f"all-{v}",
env={"UV_PROJECT_ENVIRONMENT": f".venv-{v}"},
)
for v in _PYTHONS
)
)

_ = Config(default_task=all, github_task=check)
4 changes: 2 additions & 2 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

The servers are vendored prebuilt fixtures (`tests/fixtures/smp-server/`) launched
as subprocesses; see `tests.integration.servers`. These tests are Linux-only and
are excluded from the default `task test` run (they carry the `integration`
marker); run them with `task test-integration`.
are excluded from the default `camas test` run (they carry the `integration`
marker); run them with `camas test-integration`.
"""
Loading
Loading