Skip to content

Instantly share code, notes, and snippets.

@withakay
Created May 8, 2023 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save withakay/0d22dc2fd952c8d28085aba7f49882e9 to your computer and use it in GitHub Desktop.
Save withakay/0d22dc2fd952c8d28085aba7f49882e9 to your computer and use it in GitHub Desktop.
Direnv .envrc defaults for python
### My current .envrc defaults for defaults for a python project
# I use asdf to manage runtimes.
# Using asdf with direnv like this removes the
# annoying shims, which for me is more reliable
# less confusing and slightly faster
use asdf
unset PYTHONHOME
# auto activate virtual environemnt
export VIRTUAL_ENV=$PWD/.venv
PATH_add $VIRTUAL_ENV/bin
source activate
# modify to suit current project
export PROJECT_ROOT_PATH="${PWD}"
export PYTHONPATH=$PROJECT_ROOT_PATH
# Optionally if you have a .env file and
# if you don't want to use dotenv from python
dotenv .env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment