Automatically activate a Python venv with direnv

python3 -m venv venv # create new environment in "venv" directory

Install direnv and add .envrc to project, followed by direnv allow if needed:

. ./venv/bin/activate
unset PS1

Now upon entering the project directory the virtual environment is automatically activated.