Using direnv to Save Time
In various programming languages, there’s a concept of virtual environments - in Python, for example, there’s virtualenv
to allow one set of libraries to be installed for a certain project, and another to be included in different projects. While this is super useful and saves a lot of time, it does require manually running source virtualenv/bin/activate
whenever you want to enable the virtual environment, and deactivate
to get back out. Ruby has something similar to this with rbenv
and rvm
.
Enter direnv - a nifty project that can run commands automagically upon entering or exiting of a directory. Using this, instead of manually running virtualenv/bin/activate
whenever I enter my Python work directory and deactivate
when leaving, I can just set it up once and everything else is automatic.
Here’s a screenshot showing this in action: