Skip to content

Commit 6f96706

Browse files
build: migrate from mypy to pyright
Replace mypy with pyright as the project's type checker, using strict mode. Changes: 1. **`pyproject.toml`** — Replace `mypy==2.3.0` with `pyright` in `[project.optional-dependencies] lint`. Remove `[tool.mypy]` section and add `[tool.pyright]` with `typeCheckingMode = "strict"` and equivalent excludes. 2. **`.pre-commit-config.yaml`** — Replace the `mirrors-mypy` hook with a pyright pre-commit hook (`RobertCraiworthy/mirrors-pyright` or run via `uv run pyright .`). 3. **`.github/CONTRIBUTING.md`** — Update the "Run type checking" command from `uv run mypy .` to `uv run pyright .`. 4. **`.gitignore`** — Remove mypy-specific entries (`.mypy_cache/`) if present; no pyright cache directory is needed (it uses `node_modules/.pyright` internally, already gitignored by most templates). 5. **Verify** — Run `uv run pyright .` locally to confirm clean output or surface any new errors to address.
1 parent e62633e commit 6f96706

4 files changed

Lines changed: 11 additions & 17 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ uv run ruff format
113113
Run type checking:
114114

115115
```sh
116-
uv run mypy .
116+
uv run pyright .
117117
```
118118

119119
## Build

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,6 @@ venv.bak/
146146
# mkdocs documentation
147147
/site
148148

149-
# mypy
150-
.mypy_cache/
151-
.dmypy.json
152-
dmypy.json
153-
154149
# Pyre type checker
155150
.pyre/
156151

.pre-commit-config.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ repos:
2222
args: [--fix]
2323
- id: ruff-format
2424

25-
- repo: https://github.com/pre-commit/mirrors-mypy
26-
rev: v1.19.1
25+
- repo: local
2726
hooks:
28-
- id: mypy
29-
entry: bash -c 'uv run mypy .'
27+
- id: pyright
28+
name: pyright
29+
entry: uv run pyright .
30+
language: system
31+
types: [python]
32+
pass_filenames: false

pyproject.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ docs = [
2020
"pdoc==16.0.0",
2121
]
2222
lint = [
23-
"mypy==2.3.0",
2423
"pre-commit==4.6.0",
24+
"pyright==1.1.411",
2525
"ruff==0.15.21",
2626
]
2727
test = [
@@ -53,12 +53,8 @@ ignore = [
5353
"E501", # line too long (handled by ruff)
5454
]
5555

56-
[tool.mypy]
57-
strict = true
58-
ignore_missing_imports = true
59-
exclude = [
60-
'^tests/.*'
61-
]
56+
[tool.pyright]
57+
typeCheckingMode = "strict"
6258

6359
[tool.coverage.run]
6460
omit = [

0 commit comments

Comments
 (0)