1
- # This GitHub Actions workflow automatically updates the pinned versions
1
+ # This GitHub Actions workflow automatically updates and upgrades the pinned versions
2
2
# in requirements.txt for all Python dependencies (including transitive dependencies)
3
- # whenever setup.cfg is modified.
3
+ # whenever setup.cfg is modified or the workflow is manually triggered .
4
4
5
5
name : Update requirements.txt
6
6
11
11
paths :
12
12
- " setup.cfg"
13
13
- ' .github/workflows/update-requirements.yml'
14
+ workflow_dispatch :
14
15
15
16
jobs :
16
- update -requirements :
17
- name : Update requirements.txt
17
+ upgrade -requirements :
18
+ name : Upgrade requirements.txt
18
19
runs-on : ubuntu-latest
19
20
strategy :
20
21
matrix :
21
- python-version : ["3.9 "]
22
+ python-version : ["3.10 "]
22
23
steps :
23
24
- name : Check out repository
24
25
uses : actions/checkout@v4
@@ -27,28 +28,25 @@ jobs:
27
28
with :
28
29
python-version : ${{ matrix.python-version }}
29
30
cache : pip
30
- # Workaround a current issue with `pip check`.
31
- # See: https://github.com/stanford-crfm/helm/issues/2855
32
- # TODO(#2855): Remove this
33
- - name : Use old pip
34
- run : pip install --upgrade pip~=24.1.2
31
+ - name : Install uv
32
+ run : pip install uv
35
33
- name : Install PyTorch manually
36
34
# PyTorch has to be installed manually in a separate step with --no-cache-dir
37
35
# to avoid pip getting killed because PyTorch is too big
38
36
# See: https://stackoverflow.com/a/54329850
39
- run : pip install torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
40
- - name : Resolve and install requirements
41
- run : pip install -e .[all,dev]
37
+ run : uv pip install --system torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorch.org/whl/cpu --no-cache-dir
38
+ - name : Upgrade dependencies
39
+ run : uv pip install --system --upgrade - e .[all,dev] torch==2.2.2 torchvision==0.17.2
42
40
- name : Verify dependencies
43
- run : pip check
41
+ run : uv pip check && pip check
44
42
- name : Write header to requirements.txt
45
43
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
44
- name : Write dependencies to requirements.txt
47
45
# grep is used to exclude dependencies installed in editable mode
48
46
# and dependencies installed from outside PyPI.
49
47
# sed is used to loosen the version matches for PyTorch
50
48
# 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
49
+ run : uv pip freeze | grep -v -E "( @ |^-e)" | sed -E 's/==([A-Za-z0-9.]+)\+[A-Za-z0-9.]+/~=\1/' >> requirements.txt
52
50
# Need to manually run tests here because the pull request opened later will not
53
51
# run the test workflow.
54
52
#
0 commit comments