Astral Brings uv and ty Together into One Python Toolchain
Translated by a model; the original is in Russian.
Astral, maker of fast Python tooling (the uv package manager, the Ruff linter and formatter, and the ty type checker), has announced an experimental integration between uv and ty, available in preview. The idea is simple: each tool is useful on its own, but together they can do more. uv understands a project's environment and dependencies, ty understands its code — and combining that knowledge unlocks new capabilities.
First-class script support
PEP 723 lets Python scripts declare their dependencies and Python version requirements through inline metadata. uv already uses that metadata to prepare an environment when running a script. Now ty reads the same metadata too — both on the command line and in the editor.
ty discovers scripts across a project and uses uv to prepare an environment for each one, checking the code against its declared requirements. Different scripts in the same repository can have different dependencies and even different Python versions, and each is checked by its own rules. With the editor integration enabled, completions, hover information, and Go to Definition all become available, driven by the script's declared dependencies.
A unified check command
The new uv check introduces a unified diagnostic interface, starting with ty support. It automatically prepares the environment, installs the required dependencies, and checks the project — it "just works," as Astral puts it. If you never run uv check, nothing about your uv experience changes; the ty binary is installed separately on first use.
You can check a single package (uv check --package <name>), an entire workspace (uv check --all-packages), or a standalone script (uv check --script example.py). The ty version is taken from the project's lockfile, so developers and CI all share the same version without separately maintained pins. The ty pre-commit hook runs on uv check under the hood as well.
How it works, and what's next
The integration is powered by uv workspace metadata, which gives ty a structured view of a project's packages, dependencies, and environment. For PEP 723 scripts, ty invokes uv to prepare the environment, including installing dependencies; because that can execute third-party code, automatic setup is currently opt-in.
To try it in VS Code, install uv and the ty extension and add "ty.experimental.useUv": "on" to your settings; from the command line, use TY_UV=scripts ty check. The features require uv 0.12.3 and ty 0.0.76 or later.
Astral calls the work experimental and is asking for feedback. On the roadmap: Ruff support in uv check, a new class of checks that pair dependency knowledge with code understanding (such as detecting unused dependencies), and ty's eventual stable release.
Source: Lobsters
Comments
Sign in, to comment.