Skip to content

Commit

Permalink
version prefix matching
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Jun 22, 2024
1 parent 6a9c294 commit 4c38fad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/find_pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ def get_pt_requirement(pt_version: str = "") -> dict:

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

0 comments on commit 4c38fad

Please sign in to comment.