Skip to content

Commit 4c38fad

Browse files
committed
version prefix matching
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
1 parent 6a9c294 commit 4c38fad

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

backend/find_pytorch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ def get_pt_requirement(pt_version: str = "") -> dict:
111111

112112
return {
113113
"torch": [
114-
f"torch=={Version(pt_version).base_version}"
114+
# uv has different local version behaviors, i.e. `==2.3.1` cannot match `==2.3.1+cpu`
115+
# https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#local-version-identifiers
116+
# luckily, .* (prefix matching) defined in PEP 440 can match any local version
117+
# https://peps.python.org/pep-0440/#version-matching
118+
f"torch=={Version(pt_version).base_version}.*"
115119
if pt_version != ""
116120
else "torch>=2a",
117121
],

0 commit comments

Comments
 (0)