Use ty to type-check Python files (#17229)

I added mypy type‑checking in https://github.com/astral-sh/uv/pull/5332,
so I think it's a good time to switch to ty now :)
This commit is contained in:
Jo
2026-01-08 02:25:15 +08:00
committed by GitHub
parent 9ddaae2244
commit 29c44c71c2
3 changed files with 7 additions and 9 deletions

View File

@@ -116,7 +116,12 @@ jobs:
run: uvx ruff check .
- name: "Python type check"
run: uvx mypy
run: |
uvx ty check python/uv
uvx \
--directory crates/uv-python \
--with-requirements fetch-download-metadata.py \
ty check --python-version 3.13 fetch-download-metadata.py
- name: "Validate project metadata"
run: uvx --from 'validate-pyproject[all,store]' validate-pyproject pyproject.toml

View File

@@ -92,12 +92,5 @@ version_files = [
"Documentation" = ["documentation"]
"Other changes" = ["__unknown__"]
[tool.mypy]
ignore_missing_imports = true
files = [
"crates/uv-python/*.py",
"python/uv/*.py",
]
[tool.uv]
managed = false

View File

@@ -94,7 +94,7 @@ def _user_scheme() -> str:
user_scheme = sysconfig.get_preferred_scheme("user")
elif os.name == "nt":
user_scheme = "nt_user"
elif sys.platform == "darwin" and sys._framework:
elif sys.platform == "darwin" and sys._framework: # ty: ignore[unresolved-attribute]
user_scheme = "osx_framework_user"
else:
user_scheme = "posix_user"