Skip to content

Commit 659466c

Browse files
committed
Change the sync-requirements-txt.sh so that it uses uv pip compile instead of uv export
1 parent af90f1f commit 659466c

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

.github/workflows/uvlock-renewal.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ on: # yamllint disable-line rule:truthy
1818
default: '3.11'
1919
type: choice
2020
options:
21+
- '3.12'
2122
- '3.11'
22-
- '3.9'
23-
- '3.8'
2423
update_optional_dirs:
2524
description: 'Include optional directories in update'
2625
required: false
@@ -45,7 +44,7 @@ jobs:
4544
uses: actions/checkout@v4
4645
with:
4746
ref: ${{ env.BRANCH }}
48-
token: ${{ secrets.GH_ACCESS_TOKEN }}
47+
token: ${{ secrets.GITHUB_TOKEN }}
4948

5049
# Configure Git
5150
- name: Configure Git
@@ -69,4 +68,4 @@ jobs:
6968
uv lock --python ${{ env.PYTHON_VERSION }}
7069
git add uv.lock
7170
git commit -m "Update uv.lock files by uvlock-renewal.yaml action"
72-
git push origin ${{ env.BRANCH }}
71+
git push origin ${{ env.BRANCH }}

scripts/sync-requirements-txt.sh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@ set -Eeuxo pipefail
77
# The following will create an extra requirement.txt file for every Pipfile.lock we have.
88
uv --version || pip install uv
99
cd jupyter
10-
find . -name requirements.txt -execdir bash -c '
11-
full_path=$(pwd)
10+
find . -name "requirements.txt" -type f > files.txt
11+
cd ..
12+
while read -r file; do
1213

13-
echo "# Generated by /scripts/sync-requirements-txt.sh from uv.lock" > requirements.txt
14-
echo >> requirements.txt
14+
echo "Processing $file"
15+
path="${file#./*}"
16+
image_name="${path%/*/*}"
17+
python_version="${path%/*}"
18+
python_version="${python_version##*-}"
1519

16-
temp_dir="${full_path%/*}"
17-
image_name="${temp_dir##*/}"
18-
19-
if [[ "$full_path" == *"/rocm/"* ]]; then
20-
image_name="${image_name}-rocm"
20+
if [[ "$path" == *"rocm/"* ]]; then
21+
image_name="${image_name#*/}-rocm"
2122
fi
23+
24+
uv pip compile --format requirements.txt --python ${python_version} -o jupyter/${path} --generate-hashes --group jupyter-${image_name}-image --no-annotate -q
25+
26+
done < jupyter/files.txt
2227

23-
uv export --format requirements-txt --group jupyter-${image_name}-image >> requirements.txt' \;
28+
rm jupyter/files.txt

0 commit comments

Comments
 (0)