Using ty with the helix editor

The folks at Astral have released ty, which they define as:

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

You can read more in the blog post announcing it.

Today, I set it up with helix. To make it work, we first have to install it. Using uv, it’s as easy as typing:

uv tool install ty@latest

Then, edit your ~/.config/helix/languages.toml and add the following:

[language-server.ty]
command = "ty"
args = ["server"]

[[language]]
name = "python"
scope = "source.python"
injection-regex = "python"
file-types = ["py","pyi","py3","pyw",".pythonstartup",".pythonrc"]
shebangs = ["python"]
roots = [".", "pyproject.toml"]
comment-token = "#"
language-servers = ["ty"]
indent = { tab-width = 4, unit = "    " }
auto-format = true

At this point, you can start using it, but there are a few handy things to know:

[tool.ty.environment]
root = ["./app"]
[tool.ty.environment]
python = "./custom-venv-location/.venv"

That’s it. Now, when editing files with hx, you should get all of ty’s goodness!