Skip to content

Commit 985b012

Browse files
committed
Add ty type checker
Add ty configuration. ty provides fast type checking that complements pyright, while ruff handles missing type hints detection. ty is not yet reporting as much problems as pyright, but it is much, much faster, and is already interesting to use interactively. This change only aims at making ty usable in this project, without replacing pyright. As such it is not added in the dev dependencies and must be installed manually, for example with uv tool install ty Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent bd6e743 commit 985b012

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ repos:
3333
require_serial: true
3434
entry: "uv run flake8"
3535
types: ["python"]
36+
- id: "ty"
37+
name: "ty"
38+
language: "system"
39+
require_serial: true
40+
entry: "uv run ty check ."
41+
types: ["python"]
42+
stages: ["manual"]
43+
pass_filenames: false
44+
always_run: true
3645
- id: "pyright"
3746
name: "pyright"
3847
language: "system"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile to run static code checkers locally
22
# Equivalent to the GitHub Actions workflow in .github/workflows/code-checkers.yml
33

4-
.PHONY: all pyright ruff ruff-fix flake8 autopep8 autopep8-fix
4+
.PHONY: all pyright ruff ruff-fix flake8 autopep8 autopep8-fix ty
55

66
# By default, only run the non-fix version of the hooks so it doesn't modify any files
77
# It runs on all files managed by git (untracked files are not checked)
@@ -19,5 +19,5 @@ vm_data.py:
1919

2020
pyright ruff: data.py vm_data.py
2121

22-
ruff ruff-fix autopep8 autopep8-fix flake8 pyright:
22+
ruff ruff-fix autopep8 autopep8-fix flake8 ty pyright:
2323
uv run prek -a $@

0 commit comments

Comments
 (0)