Skip to content

Commit 4f1eb0d

Browse files
authored
Merge pull request #153 from trailofbits/switch-pyright-to-ty
Replace pyright with ty for type checking
2 parents 52c3df6 + 34b0112 commit 4f1eb0d

4 files changed

Lines changed: 9 additions & 12 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Project Overview
44

5-
A Cookiecutter template for Python packages, supporting both CLI and library project types. Generates projects with uv, ruff, pyright, and pytest pre-configured. It also comes with GitHub Actions workflows configured for the project.
5+
A Cookiecutter template for Python packages, supporting both CLI and library project types. Generates projects with uv, ruff, ty, and pytest pre-configured. It also comes with GitHub Actions workflows configured for the project.
66

77
This template is opinionated and enforces recommended practices when creating new Python projects.
88

{{cookiecutter.project_slug}}/AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This is a Python library package.
1515
- Package manager: uv
1616
- Build backend: uv_build
1717
- Linting/formatting: ruff
18-
- Type checking: pyright
18+
- Type checking: ty
1919
- Testing: pytest
2020
- CI: GitHub Actions (lint, test, release{%- if cookiecutter.documentation != 'none' %}, docs{%- endif %})
2121

@@ -24,7 +24,7 @@ This is a Python library package.
2424
Use Makefile targets, not tool commands directly:
2525

2626
- `make format` - Fix formatting issues
27-
- `make lint` - Run all static checks (ruff, pyright)
27+
- `make lint` - Run all static checks (ruff, ty)
2828
- `make test` - Run tests with coverage
2929
- `make doc` - Generate documentation
3030
- `make build` - Build the package

{{cookiecutter.project_slug}}/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ lint:
3737
uv sync --group lint
3838
uv run ruff format --check && \
3939
uv run ruff check && \
40-
uv run pyright{% if cookiecutter.docstring_coverage %} && \
40+
uv run ty check{% if cookiecutter.docstring_coverage %} && \
4141
uv run interrogate -c pyproject.toml .{% endif %}
4242

4343
.PHONY: format

{{cookiecutter.project_slug}}/pyproject.toml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ lint = [
3636
# NOTE: ruff is under active development, so we pin conservatively here
3737
# and let Dependabot periodically perform this update.
3838
"ruff ~= 0.14.0",
39-
"pyright ~= 1.1",
39+
"ty >=0.0.2",
4040
{%- if cookiecutter.docstring_coverage %}
4141
"interrogate",
4242
{%- endif %}
@@ -63,14 +63,11 @@ Source = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.
6363
# don't attempt code coverage for the CLI entrypoints
6464
omit = ["{{ cookiecutter.__project_src_path }}/_cli.py"]
6565

66-
[tool.pyright]
66+
[tool.ty.environment]
67+
python-version = "3.10"
68+
69+
[tool.ty.src]
6770
include = ["src", "test"]
68-
pythonVersion = "3.10"
69-
typeCheckingMode = "strict"
70-
reportUnusedImport = "warning"
71-
reportUnusedVariable = "warning"
72-
reportGeneralTypeIssues = "error"
73-
reportMissingTypeStubs = true
7471

7572
[tool.ruff]
7673
line-length = 100

0 commit comments

Comments
 (0)