# How to try the ty type checker


This guide shows you how to try out [ty](https://pydevtools.com/handbook/reference/ty.md), a static type checker and language server, in your project.

{{< callout type="info" >}}
Looking to migrate from [mypy](https://pydevtools.com/handbook/reference/mypy.md) to ty? See [How to migrate from mypy to ty](https://pydevtools.com/handbook/how-to/how-to-migrate-from-mypy-to-ty.md) for detailed guidance.
{{< /callout >}}

## Prerequisites

To proceed, you'll need [uv](https://pydevtools.com/handbook/reference/uv.md).

## Run ty from the command line

```shell
uvx ty check
```

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

## Try ty online

ty has an [online playground](https://play.ty.dev) 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](https://marketplace.visualstudio.com/items?itemName=astral-sh.ty).

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

```json
{
  "python.languageServer": "None"
}
```

### Neovim

For Neovim 0.10 or earlier with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig):

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

For Neovim 0.11+ with `vim.lsp.config`:

```lua
-- 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`:

```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:

```shell
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:

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

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

```bash
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:

```bash
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`:

```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:

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

Report unexpected diagnostics on the [ty issue tracker](https://github.com/astral-sh/ty/issues).

## Learn More

- [ty reference](https://pydevtools.com/handbook/reference/ty.md)
- [How do mypy, pyright, and ty compare?](https://pydevtools.com/handbook/explanation/how-do-mypy-pyright-and-ty-compare.md)
- [How to use ty in CI](https://pydevtools.com/handbook/how-to/how-to-use-ty-in-ci.md)
- [How to gradually adopt type checking in an existing Python project](https://pydevtools.com/handbook/how-to/how-to-gradually-adopt-type-checking-in-an-existing-python-project.md)
- [How to configure Claude Code with a Python type checker](https://pydevtools.com/handbook/how-to/how-to-configure-claude-code-with-a-python-type-checker.md)
