Skip to content

Commit 4341d11

Browse files
authored
Use uv pip compile in Update Requirements GitHub Action (#3452)
1 parent bc8904d commit 4341d11

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

.github/workflows/update-requirements.yml

+6-17
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,8 @@ jobs:
3232
cache: pip
3333
- name: Install uv
3434
run: pip install uv
35-
- name: Install PyTorch manually
36-
# PyTorch has to be installed manually in a separate step with --no-cache-dir
37-
# to avoid pip getting killed because PyTorch is too big
38-
# See: https://stackoverflow.com/a/54329850
39-
run: uv pip install --system torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
40-
- name: Upgrade dependencies
41-
run: uv pip install --system --upgrade -e .[all,dev] torch==2.2.2 torchvision==0.17.2
42-
- name: Verify dependencies
43-
run: uv pip check && pip check
44-
- name: Write header to requirements.txt
45-
run: echo '# This file is automatically generated by GitHub Actions and contains pinned versions for all transitive Python dependencies. Do not modify this file!' > requirements.txt
46-
- name: Write dependencies to requirements.txt
47-
# grep is used to exclude dependencies installed in editable mode
48-
# and dependencies installed from outside PyPI.
49-
# sed is used to loosen the version matches for PyTorch
50-
# so that any CUDA version matches.
51-
run: pip freeze | grep -v -E "( @ |^-e)" | sed -E 's/==([A-Za-z0-9.]+)\+[A-Za-z0-9.]+/~=\1/' >> requirements.txt
35+
- name: Resolve dependencies
36+
run: uv pip compile setup.cfg --extra all --extra dev --universal --no-annotate --constraints constraints.txt -o requirements.txt
5237
# Need to manually run tests here because the pull request opened later will not
5338
# run the test workflow.
5439
#
@@ -59,6 +44,10 @@ jobs:
5944
# if a workflow run pushes code using the repository's GITHUB_TOKEN, a new workflow
6045
# will not run even when the repository contains a workflow configured to run when
6146
# push events occur.
47+
- name: Install HELM
48+
run: ./install-dev.sh
49+
- name: Verify dependencies
50+
run: pip check
6251
- name: Run linter
6352
run: ./pre-commit.sh
6453
- name: Run tests

0 commit comments

Comments
 (0)