astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
27.17k stars 785 forks source link

torch in tool.uv.source violate the pyproject.toml schema #9328

Closed Xiao-Chenguang closed 20 hours ago

Xiao-Chenguang commented 1 day ago

Minimal Example (as in the official doc):

[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12.0"
dependencies = [
  "torch>=2.5.1",
  "torchvision>=0.20.1",
]

[tool.uv.sources]
torch = [
    { index = "pytorch-cpu", marker = "platform_system != 'Darwin'" },
]
torchvision = [
    { index = "pytorch-cpu", marker = "platform_system != 'Darwin'" },
]

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

With this configuration and Even Better TOML extension in vscode, there are warnings that [{"index":"pytorch-cpu","marker":"platform_system != 'Darwin'"}] is not valid under any of the given schemas

charliermarsh commented 1 day ago

Sorry, I need to update SchemaStore.

charliermarsh commented 1 day ago

(What you have there is correct; the schema on SchemaStore is just stale.)

charliermarsh commented 1 day ago

See: https://github.com/SchemaStore/schemastore/pull/4224