1
0
mirror of https://codeberg.org/diginaut/dotfiles.git synced 2026-02-04 06:40:25 +01:00
Files
dotfiles/.config/direnv/direnvrc

26 lines
760 B
Plaintext

layout_uv() {
if [[ -d ".venv" ]]; then
VIRTUAL_ENV="$(pwd)/.venv"
fi
if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then
log_status "No virtual environment exists. Executing \`uv venv\` to create one."
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
if [ -d ".venv/bin" ]; then
PATH_add .venv/bin
elif [ -d ".venv/Scripts" ]; then
PATH_add .venv/Scripts
fi
export UV_ACTIVE=1 # or VENV_ACTIVE=1
export VIRTUAL_ENV
}