Skip to content

feat: Switch type checker from mypy to ty#125

Open
fujikosu wants to merge 2 commits intofeat/migrate-to-uv-from-pipfrom
feat/switch-to-ty
Open

feat: Switch type checker from mypy to ty#125
fujikosu wants to merge 2 commits intofeat/migrate-to-uv-from-pipfrom
feat/switch-to-ty

Conversation

@fujikosu
Copy link
Copy Markdown
Member

Purpose

Migrate the type checking tooling from mypy to ty, an extremely fast Python type checker by Astral (creators of ruff and uv). ty is integrated as a VS Code extension for real-time editor feedback, replacing the mypy VS Code extension.

Key decisions:

  • ty replaces mypy as the VS Code type checker extension (astral-sh.ty replaces ms-python.mypy-type-checker)
  • ty's language server replaces Pylance's (python.languageServer: "None"), which is ty's default recommended setup
  • ty is not added to CI or pre-commit hooks because it is still pre-1.0 with no stable API (milestones), meaning diagnostics may change between versions
  • Once ty stabilizes, the plan is to run it in CI in non-strict mode (default rule set) to catch real type errors without requiring full annotation coverage

Changes

Type checker migration (mypy → ty)

  • Replaced ms-python.mypy-type-checker extension with astral-sh.ty in all 3 devcontainer.json files
  • Replaced mypy-type-checker.importStrategy setting with ty.importStrategy and python.languageServer: "None"
  • Replaced mypy==1.20.0 with ty==0.0.29 in all devcontainer pyproject.toml files
  • Regenerated all 3 uv.lock files to remove mypy and add ty
  • Updated .gitignore, .dockerignore, .amlignore: .mypy_cache.ty_cache

README updates

  • Added ty type checking rationale with links to version policy and milestones
  • Added Future Roadmap item for ty CI/pre-commit integration once stable

Does this introduce a breaking change?

  • Yes
  • No

Author pre-publish checklist

  • No PII in logs or output
  • Made corresponding changes to the documentation
  • All new packages used are included in pyproject.toml
  • Functions use type hints, and there are no type hint errors

Pull Request Type

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Experiment notebook

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the repository’s developer type-checking experience from mypy to Astral’s ty, aligning the devcontainers and documentation with ty’s VS Code extension + language server workflow.

Changes:

  • Replace the mypy VS Code extension with astral-sh.ty and configure devcontainers to disable the Python extension language server (python.languageServer: "None").
  • Swap mypy==1.20.0 for ty==0.0.29 in devcontainer pyproject.toml files and regenerate corresponding uv.lock files.
  • Update ignore rules and documentation to reference ty cache/files and planned future CI integration.

Reviewed changes

Copilot reviewed 10 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/sample_pytorch_gpu_project/.devcontainer/uv.lock Removes mypy (and related deps) and adds ty to dev dependencies lock.
src/sample_pytorch_gpu_project/.devcontainer/pyproject.toml Replaces mypy with ty in the dev dependency group.
src/sample_pytorch_gpu_project/.devcontainer/devcontainer.json Switches VS Code extension to astral-sh.ty and sets python.languageServer to None with ty.importStrategy.
src/sample_pytorch_gpu_project/.amlignore Replaces .mypy_cache ignore with .ty_cache.
src/sample_cpu_project/.devcontainer/uv.lock Removes mypy (and related deps) and adds ty to dev dependencies lock.
src/sample_cpu_project/.devcontainer/pyproject.toml Replaces mypy with ty in the dev dependency group.
src/sample_cpu_project/.devcontainer/devcontainer.json Switches VS Code extension to astral-sh.ty and sets python.languageServer to None with ty.importStrategy.
src/.amlignore Replaces .mypy_cache ignore with .ty_cache.
README.md Documents ty rationale and adds roadmap note for future CI/pre-commit integration once stable.
notebooks/.devcontainer/uv.lock Removes mypy (and related deps) and adds ty to dev dependencies lock.
notebooks/.devcontainer/pyproject.toml Replaces mypy with ty in the dev dependency group.
notebooks/.devcontainer/devcontainer.json Switches VS Code extension to astral-sh.ty and sets python.languageServer to None with ty.importStrategy.
.gitignore Replaces mypy ignores with .ty_cache/.
.dockerignore Replaces .mypy_cache ignore with .ty_cache.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fujikosu fujikosu requested review from bhavikm and junkataoka April 13, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants