From b889dc21c163987d7cd1f32f3d9775430cde5866 Mon Sep 17 00:00:00 2001 From: Robin Gierse Date: Tue, 24 Dec 2024 08:08:21 +0100 Subject: [PATCH] Add uv direnv configuration. --- .envrc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..4d02511b8 --- /dev/null +++ b/.envrc @@ -0,0 +1,19 @@ +# -*- mode: sh -*- + +layout_python() { + if [[ -d ".venv" ]]; then + VIRTUAL_ENV="$(pwd)/.venv" + fi + + if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then + log_status "No virtual environment exists. Creating it." + uv venv + uv pip install -r requirements.txt + VIRTUAL_ENV="$(pwd)/.venv" + fi + + # Activate the virtual environment + . $VIRTUAL_ENV/bin/activate +} + +layout python \ No newline at end of file