export VIRTUAL_ENV=.venv
layout python-venv

# This is the configuration file for the direnv utility program
# 
# Install direnv and add the follwing to ~/.config/direnv/direnvrc
# Afterwards the will automatically(When explicitly allowing the code to execute)
# load the virtual environment when moving into the directory or sub directories.
#
#realpath() {
#    [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
#}
#layout_python-venv() {
#    local python=${1:-python3}
#    [[ $# -gt 0 ]] && shift
#    unset PYTHONHOME
#    if [[ -n $VIRTUAL_ENV ]]; then
#        VIRTUAL_ENV=$(realpath "${VIRTUAL_ENV}")
#    else
#        local python_version
#        python_version=$("$python" -c "import platform; print(platform.python_version())")
#        if [[ -z $python_version ]]; then
#            log_error "Could not detect Python version"
#            return 1
#        fi
#        VIRTUAL_ENV=$PWD/.env
#    fi
#    export VIRTUAL_ENV
#    if [[ ! -d $VIRTUAL_ENV ]]; then
#        log_error "no venv found; Searching for $VIRTUAL_ENV"
#        unset VIRTUAL_ENV
#    else
#        PATH="${VIRTUAL_ENV}/bin:${PATH}"
#        export PATH
#    fi
#}

