`uv check` and `ty check` report different errors
Summary
It appears to be related to uv check using the version of python in .venv and ignoring the requires-python field in the pyproject.toml whereas ty does?
As a minimal example, with pyproject.toml
[project]
name = "demo"
version = "0.1.0"
requires-python = ">=3.12"and demo.py in the same directory (I know the code itself is questionable - it's minified from a bigger project)
from types import UnionType
from typing import Union, get_origin, get_args, Any
def convert_type(typ: Any) -> type:
root = get_origin(typ)
args = get_args(typ)
if args:
new = tuple(convert_type(i) for i in args)
if root == UnionType:
root = Union
return root[new] if root else typ
return typRunning ty check (and uv run ty check) gives All checks passed, whereas uv check gives
error[not-subscriptable]: Cannot subscript object of type `<special-form 'typing.Union'>` with no `__class_getitem__` method
--> demo.py:12:16
|
12 | return root[new] if root else typ
| ^^^^^^^^^
Found 1 diagnosticIf I change the version of python in the pyproject.toml to 3.14, ty check starts reporting the error or if I use uv check --python 3.12, uv stops reporting it.
Passing --ty-version to uv check with the same version as ty, doesn't make a difference.
uv version 0.12.15 ty version 0.0.81
Platform
Arch - Linux 6.18.51-1-lts x86_64 GNU/Linux
Version
uv 0.12.15 (d35f1f270 2026-09-15 x86_64-unknown-linux-gnu)
Python version
3.14.0
Source: astral-sh/uv