Skip to content

Commit 891e2b1

Browse files
committed
Update pylock generation script
Signed-off-by: Samuel Monson <smonson@redhat.com>
1 parent 0a95416 commit 891e2b1

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

scripts/generate_pylock.sh

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
set -ex
33

44
usage() {
5-
echo "Script to generate pylock.toml from scratch"
6-
echo "If pylock.toml already exists just run \`pdm lock --update-reuse\`"
5+
echo "Script to generate pylock.toml"
76
echo "Usage: $0 [-f] [-h]"
87
echo " -f Force update of all dependencies"
98
echo " -h Show this help message"
109
}
1110

12-
# Check if pdm is available
13-
if ! command -v pdm >/dev/null 2>&1
11+
# Check if uv is available
12+
if ! command -v uv >/dev/null 2>&1
1413
then
15-
echo "This script requires 'pdm' but it's not installed."
14+
echo "This script requires 'uv' but it's not installed."
1615
exit 1
1716
fi
1817

@@ -27,13 +26,7 @@ while getopts "fh" opt; do
2726
esac
2827
done
2928

30-
set +e
31-
update_stratagy="$([ $FORCE_REGEN -eq 0 ] && echo "--update-reuse")"
32-
set -e
33-
34-
# Locking all dependencies to the same version for all supported
35-
# python versions is not possible (mostly due to numpy)
36-
# so we need to lock separately for python >=3.12 and <3.12
37-
# Only set update-reuse if not forcing regeneration
38-
pdm lock --python "~=3.12" $update_stratagy
39-
pdm lock --append --python "<3.12" $update_stratagy
29+
if [ $FORCE_REGEN -eq 1 ]; then
30+
uv lock --refresh
31+
fi
32+
uv export --frozen --all-groups --all-extras --format=pylock.toml --output-file=pylock.toml --quiet

tox.ini

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ commands =
9494
[testenv:lock]
9595
description = Update pylock
9696
skip_install = true
97-
setenv =
98-
PDM_IGNORE_SAVED_PYTHON="1"
99-
deps = pdm[all]
97+
allowlist_externals = ./scripts/generate_pylock.sh
98+
deps = uv
10099
commands =
101-
pdm lock --update-reuse
100+
./scripts/generate_pylock.sh {posargs}

0 commit comments

Comments
 (0)