Swap mypy in favour of ty#630
Open
paddyroddy wants to merge 6 commits into
Open
Conversation
paddyroddy
commented
Jun 12, 2026
| @@ -0,0 +1 @@ | |||
| tests/data/ | |||
Member
Author
There was a problem hiding this comment.
I am using https://github.com/j178/prek in favour of pre-commit locally. I found that running on the top level was running the hooks in tests/data/test_package_generation which was causing bugs.
Member
Author
|
@pre-commit.ci seems like it's having a mare |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the cookiecutter template (and its test fixture) to use Astral’s ty type checker instead of mypy, and wires ty into pre-commit so type checking runs consistently in local development and CI.
Changes:
- Replace the
mirrors-mypypre-commit hook withastral-sh/ty-pre-commitacross the root config, template, and test fixture. - Add
dependency-groups.typecheckingandtool.tyconfiguration to support isolated type-check runs. - Update documentation to recommend
ty(while still listingmypyas an alternative).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/data/test_package_generation/pyproject.toml |
Updates fixture dependencies/config from mypy to ty and adds typechecking group/config. |
tests/data/test_package_generation/.pre-commit-config.yaml |
Switches fixture pre-commit type checking hook from mypy to ty. |
pyproject.toml |
Adds a typechecking dependency group and ty overrides for this repository. |
docs/pages/tutorial.md |
Updates recommended tooling to reference ty instead of mypy. |
docs/pages/linting.md |
Promotes ty as the preferred type checker and downgrades mypy to “Good”. |
docs/pages/libraries/jupyter-notebooks.md |
Updates notebook linting guidance to reference ty instead of mypy. |
{{cookiecutter.project_slug}}/pyproject.toml |
Updates template dev dependencies/config from mypy to ty and adds typechecking group/config. |
{{cookiecutter.project_slug}}/.pre-commit-config.yaml |
Switches template pre-commit type checking hook from mypy to ty. |
.prekignore |
Adds ignore rules for prek users (separate from pre-commit’s own excludes). |
.pre-commit-config.yaml |
Switches this repo’s pre-commit type checking hook from mypy to ty. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tyis a fast alternative tomypy. Although it has been released for a while now, thepre-commithook has only just been released. We've used this successfully in GLASS glass-dev/glass#1133 and I've used it in SLEPLET astro-informatics/sleplet#489. It is being rapidly developed so will only get better. I know Astral sold out, but I doubt we're going to move fromuvrealistically.