Skip to content

Commit 44bb9a4

Browse files
authored
Use basedpyright for type checking (#60)
* chore: use basedpyright for type checking * ci: run basedpyright in lint job
1 parent 5bcc758 commit 44bb9a4

5 files changed

Lines changed: 42 additions & 28 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
run: uv run ruff check .
2727
- name: ruff format
2828
run: uv run ruff format --check .
29-
- name: pyright
30-
run: uv run pyright
29+
- name: basedpyright
30+
run: uv run basedpyright
3131

3232
test:
3333
runs-on: ubuntu-latest
@@ -64,4 +64,3 @@ jobs:
6464
name: coverage-xml
6565
path: coverage.xml
6666
if-no-files-found: ignore
67-

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ repos:
1717
args: [--fix]
1818
- id: ruff-format
1919

20-
- repo: https://github.com/RobertCraigie/pyright-python
21-
rev: v1.1.391
20+
- repo: https://github.com/DetachHead/basedpyright-prek-mirror
21+
rev: v1.39.6
2222
hooks:
23-
- id: pyright
23+
- id: basedpyright
2424

2525
- repo: https://github.com/astral-sh/uv-pre-commit
2626
rev: 0.5.13

AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ uv run pytest tests/test_parsers.py # one file
1212
uv run pytest -k test_revert # one test by keyword
1313
uv run ruff check . && uv run ruff format --check . # lint + format check
1414
uv run ruff format . # auto-format
15-
uv run pyright # type-check (strict mode for src/)
15+
uv run basedpyright # type-check (strict mode for src/)
1616
RIPTIDE_DB_URL=... uv run alembic upgrade head # apply migrations
1717
RIPTIDE_DB_URL=... uv run alembic downgrade base # tear down
1818
podman-compose up # local dev: Postgres + migrations + app on :8000
@@ -44,9 +44,9 @@ If `docker ps` fails, ask the user to start OrbStack.
4444
- Single Python package, `riptide_collector` (flat top-level, not a namespace package). Future suite components (e.g. `riptide-api`, `riptide-dashboard`) get their own top-level package, e.g. `riptide_dashboard` — leave architectural room for them.
4545
- Webhook routers are factories that return an `APIRouter`. Bitbucket needs the config for automation detection (`make_router(config, session_factory, auth_dep)`); Pipeline, ArgoCD, and Noergler don't, so they take just `(session_factory, auth_dep)`. They're wired up in `src/riptide_collector/main.py::create_app`. Add the config only when a router actually needs `automation` rules or team metadata.
4646
- Pydantic schemas: **strict** for `/webhooks/pipeline` and `/webhooks/argocd` (we own the contract — invalid payloads must 422); **permissive raw-dict parsing** for Bitbucket (its payload shapes vary; we best-effort extract).
47-
- Use `_as_dict()` / `_as_list()` helpers in `routers/bitbucket.py` to coerce arbitrary JSON shapes — pyright strict won't accept chained `.get()` on `Optional[dict]`.
47+
- Use `_as_dict()` / `_as_list()` helpers in `routers/bitbucket.py` to coerce arbitrary JSON shapes — basedpyright strict won't accept chained `.get()` on `Optional[dict]`.
4848
- Tests use real Postgres via testcontainers, never SQLite. The `client` fixture in `tests/conftest.py` depends on `session_factory` which truncates tables per test.
49-
- `.pre-commit-config.yaml` runs ruff + pyright + uv-lock-check; expect CI to enforce the same.
49+
- `.pre-commit-config.yaml` runs ruff + basedpyright + uv-lock-check; expect CI to enforce the same.
5050

5151
## Logging & Splunk
5252

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dev = [
2525
"testcontainers[postgres]>=4.9",
2626
"httpx>=0.28",
2727
"ruff>=0.8",
28-
"pyright>=1.1.391",
28+
"basedpyright>=1.39.6",
2929
"pre-commit>=4.0",
3030
]
3131

@@ -49,7 +49,7 @@ ignore = ["E501"]
4949
"migrations/**" = ["E", "F", "I", "B", "UP", "SIM", "RUF"]
5050
"tests/**" = ["B"]
5151

52-
[tool.pyright]
52+
[tool.basedpyright]
5353
pythonVersion = "3.13"
5454
include = ["src", "tests", "migrations"]
5555
exclude = ["**/__pycache__", "**/.venv"]
@@ -61,12 +61,12 @@ reportUnknownMemberType = false
6161
reportUnknownVariableType = false
6262
reportUnknownArgumentType = false
6363

64-
[[tool.pyright.executionEnvironments]]
64+
[[tool.basedpyright.executionEnvironments]]
6565
root = "tests"
6666
reportPrivateUsage = false
6767
reportUnknownLambdaType = false
6868

69-
[[tool.pyright.executionEnvironments]]
69+
[[tool.basedpyright.executionEnvironments]]
7070
root = "migrations"
7171
reportPrivateUsage = false
7272

uv.lock

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

0 commit comments

Comments
 (0)