hn.today

Bringing uv and ty together

astral.sh313 points126 comments
Screenshot of Bringing uv and ty together

Astral’s experimental uv-ty integration combines uv’s knowledge of Python environments and dependencies with ty’s type checking and language-server features. Its first major use is support for PEP 723 scripts, which declare Python versions and dependencies in their own metadata. Ty can discover these scripts and check each against a separate environment prepared by uv, even when scripts in the same repository have different requirements. In editors, this enables environment-aware type checking, completions, hover information, and code navigation. Automatic environment setup is currently opt-in because installing dependencies can run third-party code; Astral plans to make script support and setup more seamless over time.

The integration also adds uv check, a single command that prepares a project environment, installs dependencies, and runs ty. It can check a workspace, selected packages, all packages, or an individual PEP 723 script. For workspaces, uv uses existing configuration to determine what to check, and it takes the ty version from the lockfile so local development and CI can use the same version. The ty pre-commit hook uses uv check to set up and run checks as well. The feature requires uv 0.12.3 or later and ty 0.0.76 or later. Astral plans to add Ruff support to uv check and develop checks that combine dependency data with code analysis, such as finding unused dependencies.

Read on astral.sh126 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Four Months of Zig

Four Months of Zig

After four months back with Zig, Anna Liberty built a small-network client library, a typing game, and an N-body simulator, while enjoying Zig’s straightforward development experience. The experience also exposed unfinished tooling, including a built-in fuzzer that did not work, and highlighted the value of local Zig meetups. (gracefulliberty.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.