Skip to content

How to try the ty type checker

This guide shows you how to try out ty, a static type checker and language server, in your project.

Looking to migrate from mypy to ty? See How to migrate from mypy to ty for detailed guidance.

Prerequisites

To proceed, you’ll need uv.

Run ty from the command line

uvx ty check

This checks all Python files in the working directory or project.

Try ty online

ty has an online playground for trying it out on snippets or small projects. The playground is useful for sharing code examples with others.

Use the ty language server

ty includes a Language Server Protocol (LSP) implementation compatible with modern editors.

VS Code and Cursor

Install the official ty extension from the Visual Studio Marketplace.

Then disable the language server from the Python extension to avoid running two language servers. Add this to your settings.json:

{
  "python.languageServer": "None"
}

Neovim

For Neovim 0.10 or earlier with nvim-lspconfig:

require('lspconfig').ty.setup({
  settings = {
    ty = {
      -- ty language server settings go here
    }
  }
})

For Neovim 0.11+ with vim.lsp.config:

-- Optional: Only required if you need to update the language server settings
vim.lsp.config('ty', {
  settings = {
    ty = {
      -- ty language server settings go here
    }
  }
})

-- Required: Enable the language server
vim.lsp.enable('ty')

Zed

ty is included with Zed out of the box. Enable ty and disable basedpyright by adding this to your settings.json:

{
  "languages": {
    "Python": {
      "language_servers": ["ty", "!basedpyright", "..."]
    }
  }
}

PyCharm

Starting with version 2025.3, PyCharm has native ty support:

  1. Go to Python | Tools | ty in the Settings dialog.
  2. Select the Enable checkbox.
  3. Choose an execution mode: Interpreter (uses ty from your interpreter) or Path (uses ty from $PATH).

Other editors

ty works with any editor that supports the Language Server Protocol. Start the language server with:

ty server

Refer to your editor’s documentation for connecting to an LSP server.

Troubleshooting

ty cannot find standard library modules

If ty reports that import pathlib or other standard library imports are unresolved, check the requires-python field in your pyproject.toml. ty reads the minimum version from this field and uses it to determine which standard library modules exist. A setting like requires-python = ">= 2.7" causes ty to resolve the standard library against Python 2.7, where many modern modules do not exist.

Fix this by setting a realistic minimum:

[project]
requires-python = ">= 3.10"

You can also override the version on the command line without changing your project metadata:

ty check --python-version 3.12

ty cannot find installed third-party packages

If ty’s LSP shows from requests import ... but cannot resolve members from the module, the virtual environment may not exist or ty may not be finding it. Run uv sync to create the environment, then restart the language server.

If your virtual environment is in a non-standard location, point ty at it explicitly:

ty check --python .venv

In editor settings, you can configure this path so the language server finds packages automatically. For VS Code and Cursor, add to your settings.json:

{
  "ty.python": ".venv"
}

ty shows errors that mypy or pyright do not

ty is in beta and implements some type-checking rules differently. If a diagnostic looks wrong, check whether the rule name (shown in brackets, like [invalid-argument-type]) can be suppressed or downgraded in your configuration:

[tool.ty.rules]
unresolved-import = "warn"

Report unexpected diagnostics on the ty issue tracker.

Last updated on

Please submit corrections and feedback...