Skip to content

Commit 13286c4

Browse files
committed
feat: enable uv within sessions
1 parent 99ea041 commit 13286c4

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

buildpacks/python-dependency-manager/bin/build

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,32 @@ if python -c "import ipykernel" >/dev/null 2>&1;then
3030
fi
3131
EOL
3232

33+
if (which uv); then
34+
uv_cache_dir="${CNB_LAYERS_DIR}/uv_cache"
35+
ls -la /layers
36+
cat /layers/*.toml
37+
uv_cache_layer="/layers/paketo-buildpacks_python-package-managers-run/uv-env-cache"
38+
cp -r "${uv_cache_layer}" "$uv_cache_dir"
39+
chmod -R go+w "${uv_cache_dir}"
40+
cat >>"${execd_dir}"/setup.sh <<EOL
41+
cp -ras --update=none "${uv_cache_dir}" "\${RENKU_MOUNT_DIR}/.uv_cache"
42+
export UV_CACHE_DIR="\${RENKU_MOUNT_DIR}/.uv_cache"
43+
if !(grep "UV_CACHE_DIR" \${HOME}/.bashrc); then
44+
printf "export UV_CACHE_DIR=\${RENKU_MOUNT_DIR}/.uv_cache\n" >> \${HOME}/.bashrc
45+
fi
46+
EOL
47+
48+
cat >"${uv_cache_dir}.toml"<<EOL
49+
[types]
50+
launch = true
51+
52+
[metadata]
53+
description = "set uv cache for in session use"
54+
version = "0.0.6"
55+
EOL
56+
fi
57+
58+
3359
chmod +x "${execd_dir}"/setup.sh
3460

3561
echo "Added launch script to ${execd_dir}/setup.sh"
@@ -42,3 +68,6 @@ launch = true
4268
description = "set dependency management for run sessions"
4369
version = "0.0.6"
4470
EOL
71+
72+
ls -la "${CNB_LAYERS_DIR}"
73+
cat "${CNB_LAYERS_DIR}"/*toml

buildpacks/python-dependency-manager/bin/detect

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ launch = true
3535
3636
[[or]]
3737
[[or.requires]]
38-
name = "uv"
38+
name = "uv-environment"
3939
4040
[or.requires.metadata]
4141
launch = true
4242
43+
[[or.requires]]
44+
name = "uv"
45+
46+
[or.requires.metadata]
47+
launch = true
4348
EOL

0 commit comments

Comments
 (0)