Skip to content

Commit de4750d

Browse files
Replace Mypy with Ty type checker
- Replace mypy dependency with ty (>=0.0.1a10) in pyproject.toml - Update GitHub Actions workflow from mypy.yml to ty.yml - Configure ty with basic ty.toml configuration file - Remove mypy.ini configuration file - Update workflow to use ty check command with appropriate flags Performance comparison: - Mypy: 0.651s (found 8 errors in 4 files, checked 5 source files) - Ty: 0.292s (all checks passed on same files) - Ty shows ~55% performance improvement on sample files Type checking comparison on full codebase: - Mypy: Found 73 errors in 25 files (checked 93 source files) - Ty: Found 49 diagnostics (more focused error reporting) Ty is an experimental Rust-based type checker by Astral (creators of Ruff and uv) that aims to be significantly faster than existing Python type checkers.
1 parent d4e84fd commit de4750d

File tree

5 files changed

+1109
-1202
lines changed

5 files changed

+1109
-1202
lines changed

.github/workflows/mypy.yml renamed to .github/workflows/ty.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Mypy Checks
1+
name: Ty Type Checks
22

33
on:
44
pull_request:
@@ -10,7 +10,7 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
mypy:
13+
ty:
1414
runs-on: ubuntu-latest
1515
timeout-minutes: 20
1616

@@ -38,11 +38,8 @@ jobs:
3838
done
3939
echo "python_files=${python_files[*]}" >> $GITHUB_ENV
4040
41-
- name: Add MyPy annotator
42-
uses: pr-annotators/mypy-pr-annotator@v1.0.0
43-
44-
- name: Run mypy
41+
- name: Run ty
4542
if: ${{ env.python_files != '' }}
4643
run: |
47-
echo "Running mypy on changed files: ${{ env.python_files }}"
48-
uv run mypy --no-pretty --show-absolute-path ${{ env.python_files }}
44+
echo "Running ty on changed files: ${{ env.python_files }}"
45+
uv run ty check --output-format concise --python-version 3.12 --exclude "**/tests/**" --exclude "**/codegen_tests/**" ${{ env.python_files }}

mypy.ini

Lines changed: 0 additions & 51 deletions
This file was deleted.

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ dev-dependencies = [
8181
"pytest>=8.3.3",
8282
"pytest-cov>=6.1.0,<6.1.1",
8383
"ruff>=0.6.8",
84-
"mypy[mypyc,faster-cache]>=1.13.0",
84+
"ty>=0.0.1a10",
8585
"pre-commit>=4.0.1",
8686
"pytest-xdist>=3.6.1,<4.0.0",
8787
"pytest-mock<4.0.0,>=3.14.0",
@@ -204,3 +204,5 @@ tag_format = "v{version}"
204204
match = "develop"
205205
prerelease_token = "rc"
206206
prerelease = false
207+
208+

ty.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ty type checker configuration
2+
# Based on the previous mypy.ini configuration
3+
4+
# Basic configuration - ty is still in early development
5+
# so configuration options are limited

0 commit comments

Comments
 (0)