docs+ci: document ruff format --check; format app.py

This commit is contained in:
2026-07-17 17:57:00 +08:00
parent 844220e013
commit a282231082
4 changed files with 17 additions and 9 deletions
+7 -4
View File
@@ -12,12 +12,15 @@ Plyngent is an LLM chat and agent toolkit (Python 3.14+, PDM-managed). Single-us
pdm install # first-time dependency setup
pdm sync # sync after pulling changes
pdm run basedpyright . # type checking (basedpyright, "recommended" strictness)
pdm run ruff check . # linting
pdm run ruff format . # formatting
pdm run pytest # tests (pytest-asyncio auto mode)
pdm run ruff check . # linting
pdm run ruff format . # apply formatting
pdm run ruff format --check . # CI: fail if unformatted (do not skip)
pdm run basedpyright . # type checking (basedpyright, "recommended" strictness)
pdm run pytest # tests (pytest-asyncio auto mode)
```
GitHub Actions runs `ruff check`, `ruff format --check`, `basedpyright`, then `pytest`. Format locally with `pdm run ruff format .` so CI does not fail after publish.
## Architecture
### Data modeling: `msgspec.Struct`
+5 -3
View File
@@ -62,15 +62,17 @@ pdm sync # after pull
pdm run plyngent --help
```
Dev checks:
Dev checks (same order as CI):
```bash
pdm run basedpyright .
pdm run ruff check .
pdm run ruff format .
pdm run ruff format --check . # or: pdm run ruff format . to apply
pdm run basedpyright .
pdm run pytest
```
CI fails if sources are not Ruff-formatted (`ruff format --check`). Run `pdm run ruff format .` before push.
## Basic usage
```bash
+4 -1
View File
@@ -45,7 +45,10 @@ Then for every projects, check the dev dependency group where you can find tools
Type checking: `pdm run basedpyright .`
Linting: `pdm run ruff check .`
Formating: `pdm run ruff format .`
Formatting (apply): `pdm run ruff format .`
Formatting (CI check): `pdm run ruff format --check .`
CI (`.github/workflows/ci.yml`) runs lint, **format check**, typecheck, then tests. Always run `pdm run ruff format .` before push so `ruff format --check` does not fail on `main` after a release tag has already published.
<!-- Contents in comments are for projects with long-period developments, but this is a new project.
+1 -1
View File
@@ -257,7 +257,7 @@ async def _run_chat( # noqa: C901, PLR0912, PLR0915 — chat orchestration
try:
if client_supports_models(client):
remote_ids = await fetch_remote_model_ids(client)
except (RuntimeError, TypeError, OSError, ValueError):
except RuntimeError, TypeError, OSError, ValueError:
remote_ids = None
choices = model_choices_for_provider(provider, remote_ids=remote_ids)
model_id = select_model(