This one is dedicated to all the lazy productivity enthusiasts out there. First, If you haven’t read my direanv blog post go ahead and read it.
.envrc
is the dotfile that direnv uses to to do its magic. I usually split my .envrc
into two parts:
.envrc
A script that is tailored to the project at hand:
source_env .pyenv |
I put all my exports there.
.pyenv
A script that bootstraps anything my python app needs:
layout python python3 |
Did you see what I did there? If a user has direnv installed, all the needed project requirements are installed once he enters the projects directory.
I’ve also added a lock file to make sure direnv doesn’t perform unneeded, lengthy, installations every time a user enters the directory. If you want to update the requirements, you just need to run
rm -f .direnv/direnv.lock && direnv reload |
The ideal solution would be to create a custom alias, but aliases aren’t supported at the moment.
####security model
If you’re worried of unwanted loading of unvetted .envrc
files, look at the following screencast: