An extremely fast Python type checker and language server, written in Rust.
Find a file
2025-05-10 10:35:26 +00:00
.github Add write permissions to docker publish workflow (#250) 2025-05-07 12:49:15 -05:00
docs Reference documentation (#292) 2025-05-10 10:26:31 +00:00
python/ty add py.typed (#276) 2025-05-08 09:00:10 -07:00
ruff@7a48477c67 Bump version to 0.0.0a8 (#298) 2025-05-09 11:17:13 -07:00
scripts Reference documentation (#292) 2025-05-10 10:26:31 +00:00
.editorconfig Move TOML indent size config (#251) 2025-05-07 18:13:32 +00:00
.gitattributes Add .gitattributes to enforce lf line ending (#29) 2025-05-05 16:39:10 +02:00
.gitignore Initial commit 2025-05-02 11:37:31 -05:00
.gitmodules Add ruff as a submodule 2025-05-02 11:41:08 -05:00
.markdownlint.yaml Setup pre-commit (#28) 2025-05-05 16:38:54 +02:00
.pre-commit-config.yaml Reference documentation (#292) 2025-05-10 10:26:31 +00:00
.python-version Commit the uv.lock and .python-version files (#61) 2025-05-06 09:45:39 -05:00
_typos.toml Update email in code of conduct (#55) 2025-05-06 08:32:29 +02:00
CHANGELOG.md Bump version to 0.0.0a8 (#298) 2025-05-09 11:17:13 -07:00
CODE_OF_CONDUCT.md Update email in code of conduct (#55) 2025-05-06 08:32:29 +02:00
CONTRIBUTING.md Add script to update ty.json in schemastore (#65) 2025-05-08 11:30:05 +00:00
dist-workspace.toml Bump version to 0.0.0a8 (#298) 2025-05-09 11:17:13 -07:00
Dockerfile Enable Docker build workflow (#38) 2025-05-05 15:48:32 -05:00
LICENSE Drop -MIT suffix from license file (#26) 2025-05-05 08:31:14 -05:00
pyproject.toml Bump version to 0.0.0a8 (#298) 2025-05-09 11:17:13 -07:00
README.md docs: Document configuration file discovery (#294) 2025-05-10 10:35:26 +00:00
SECURITY.md Add SECURITY.md (#23) 2025-05-05 15:18:41 +02:00
uv.lock Bump version to 0.0.0a8 (#298) 2025-05-09 11:17:13 -07:00

ty

An extremely fast Python type checker and language server, written in Rust.

Warning

ty is pre-release software and not ready for production use. Expect to encounter bugs, missing features, and fatal errors.

ty is in active development, and we're working hard to make it stable and feature-complete.

Getting started

Installation

uv tool install ty

or add ty to your project:

uv add --dev ty

# With pip.
pip install ty

First steps

After installing ty, you can check that ty is available by running the ty command:

ty
An extremely fast Python type checker.

Usage: ty <COMMAND>

...

You should see a help menu listing the available commands.

For detailed information about command-line options, see the CLI documentation.

Checking your project

ty check

Editor integration

ty can be integrated with various editors and IDEs to provide a seamless development experience. This section provides instructions on how to set up ty with your editor and configure it to your liking.

VS Code

Install the ty extension from the VS Code Marketplace.

For more documentation on the ty extension, refer to the extension's README.

Other editors

ty can be used with any editor that supports the language server protocol. To start the language server, run ty server. Refer to your editor's documentation to learn how to connect to an LSP server.

Configuration

Configuration files

ty supports persistent configuration files at both the project- and user-level.

Specifically, ty will search for a pyproject.toml or ty.toml file in the current directory, or in the nearest parent directory.

If a pyproject.toml file is found, ty will read configuration from the [tool.ty] table. For example, to ignore the index-out-of-bounds rule, add the following to a pyproject.toml:

pyproject.toml:

[tool.ty.rules]
index-out-of-bounds = "ignore"

(If there is no tool.ty table, the pyproject.toml file will be ignored, and ty will continue searching in the directory hierarchy.)

ty will also search for ty.toml files, which follow an identical structure, but omit the [tool.ty] prefix. For example:

ty.toml:

[rules]
index-out-of-bounds = "ignore"

Note

ty.toml files take precedence over pyproject.toml files, so if both ty.toml and pyproject.toml files are present in a directory, configuration will be read from ty.toml, and the [tool.ty] section in the accompanying pyproject.toml will be ignored.

ty will also discover user-level configuration at ~/.config/ty/ty.toml (or $XDG_CONFIG_HOME/ty/ty.toml) on macOS and Linux, or %APPDATA%\ty\ty.toml on Windows. User-level configuration must use the ty.toml format, rather than the pyproject.toml format, as a pyproject.toml is intended to define a Python project.

If project- and user-level configuration files are found, the settings will be merged, with project-level configuration taking precedence over the user-level configuration.

For example, if a string, number, or boolean is present in both the project- and user-level configuration tables, the project-level value will be used, and the user-level value will be ignored. If an array is present in both tables, the arrays will be merged, with the project-level settings appearing later in the merged array.

Settings provided via command line take precedence over persistent configuration.

See the settings reference for an enumeration of the available settings.

Environment variables

ty defines and respects the following environment variables:

TY_LOG

If set, ty will use this value as the log level for its --verbose output. Accepts any filter compatible with the tracing_subscriber crate. For example:

  • TY_LOG=uv=debug is the equivalent of -vv to the command line
  • TY_LOG=trace will enable all trace-level logging.

See the tracing documentation for more.

TY_MAX_PARALLELISM

Specifies an upper limit for the number of tasks ty is allowed to run in parallel. For example, how many files should be checked in parallel.

This isnt the same as a thread limit. ty may spawn additional threads when necessary, e.g. to watch for file system changes or a dedicated UI thread.

Externally defined variables

ty also reads the following externally defined environment variables:

RAYON_NUM_THREADS

Specifies an upper limit for the number of threads ty uses when performing work in parallel. Equivalent to TY_MAX_PARALLELISM.

VIRTUAL_ENV

Used to detect an activated virtual environment.

XDG_CONFIG_HOME

Path to user-level configuration directory on Unix systems.

Reference

Getting involved

If you have questions or want to report a bug, please open an issue in this repository.

Development of this project takes place in the Ruff repository at this time. Please open pull requests there for changes to anything in the ruff submodule (which includes all of the Rust source code).

See the contributing guide for more details.

License

ty is licensed under the MIT license (LICENSE or https://opensource.org/licenses/MIT).

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in ty by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.