#21720·uv

`uv check` and `ty check` report different errors

Author: tpoliawCreated Sep 15, 2026Updated Sep 16, 2026
Labelsquestion

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

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)

python
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 typ

Running 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 diagnostic

If 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