Shadowenv does project-local environment variable shadowing.
It can set variables when you enter a project, and restore them when you leave.
Installation and first steps
Documentation for the language used to write Shadowenv programs
How to use Shadowenv the way we think it should be used
Shadowenv's system for preventing malicious usage
Integrations for various editors, etc., and how to write your own