I'm using direnv to help with settings per project in the terminal. For every project I have a .envrc file which specifies required settings, this file is automatically loaded once I change directory to the project directory or any of it's sub directories.
You'll need the following in your .zshrc
if whence direnv > /dev/null; then
eval "$(direnv hook zsh)"
fi
Every time you create or change your .envrc, you'll need to run direnv allow to validate it and make sure it's loaded. (If you did some changes and want to check them, run "cd .")
Here are some .envrc examples for various scenarios:
Python + pipenv
source $(pipenv --venv)/bin/activate
Go
GOPATH=$(pwd | sed s"#/src/.*##")
PATH=${GOPATH}/bin:${PATH}
This assumes your project's path that looks like /path/to/project/src/github.com/project
If you're using the new go modules (in 1.11+), you probably don't need this.
Python + virtualenv
source venv/bin/activate
Python + conda
source activate env-name
Replace env-name with the name of your conda environment.