From 569a58ed3c10a056d2e61f39dc0d92c138489e5a Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Fri, 2 Jan 2026 13:25:54 +0100 Subject: [PATCH] Use specific Python version if requested --- .config/direnv/direnvrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.config/direnv/direnvrc b/.config/direnv/direnvrc index 707a840..febd17c 100644 --- a/.config/direnv/direnvrc +++ b/.config/direnv/direnvrc @@ -5,7 +5,13 @@ layout_uv() { if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then log_status "No virtual environment exists. Executing \`uv venv\` to create one." - uv venv + if [[ -z $PYTHON_VERSION ]]; then + # No Python version specified, just create a virtualenv + uv venv + else + # Specific Python version requested, use that; will download if needed + uv venv --python $PYTHON_VERSION + fi VIRTUAL_ENV="$(pwd)/.venv" fi