Skip to content

Commit 84d4464

Browse files
authored
🐛 Fix vllm overwrite script (#98)
* 🐛 vllm dependency not always first Signed-off-by: Evaline Ju <[email protected]> * 🐛 Darwin dep too Signed-off-by: Evaline Ju <[email protected]> * 🎨 Format script Signed-off-by: Evaline Ju <[email protected]> --------- Signed-off-by: Evaline Ju <[email protected]>
1 parent 3a2d6da commit 84d4464

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

scripts/update_vllm_version.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,24 @@ def main():
3535

3636
with open("pyproject.toml", "rb") as f:
3737
data = tomllib.load(f)
38-
current_version = parse_current_version(
39-
vllm_string=data["project"]["optional-dependencies"]["vllm"][0]
38+
# Find appropriate index
39+
vllm_deps = data["project"]["optional-dependencies"]["vllm"]
40+
vllm_git_index = next(
41+
(i for i, item in enumerate(vllm_deps) if item.startswith("vllm @ git")),
42+
None,
4043
)
44+
vllm_darwin_index = next(
45+
(
46+
i
47+
for i, item in enumerate(vllm_deps)
48+
if item.startswith("vllm>") or item.startswith("vllm=")
49+
),
50+
None,
51+
)
52+
if not vllm_git_index or not vllm_darwin_index:
53+
print(f"vllm dependencies to be overwritten are missing - skipping update")
54+
sys.exit(0)
55+
current_version = parse_current_version(vllm_string=vllm_deps[vllm_git_index])
4156
if current_version == args.vllm_version:
4257
print(
4358
f"VLLM already updated to latest version, skipping update and setting 'SKIP_VERSION' output!"
@@ -47,10 +62,10 @@ def main():
4762
sys.exit(0)
4863
else:
4964
data["project"]["optional-dependencies"]["vllm"][
50-
0
65+
vllm_git_index
5166
] = f"vllm @ git+https://github.com/vllm-project/vllm.git@v{args.vllm_version} ; sys_platform == 'darwin'"
5267
data["project"]["optional-dependencies"]["vllm"][
53-
1
68+
vllm_darwin_index
5469
] = f"vllm=={args.vllm_version} ; sys_platform != 'darwin'"
5570

5671
with open("pyproject.toml", "wb") as f:

0 commit comments

Comments
 (0)