Autoenv: Directory-based Environments
Magic per-project shell environments. Very pretentious.
Note: you should probably use `direnv <https://direnv.net/>`_ instead. It is higher quality, and maintained.
What is it?
If a directory contains a
.env file, it will automatically be executed
cd into it.
This is great for...
- auto-activating virtualenvs
- project-specific environment variables
- making millions
You can also nest envs within each other. How awesome is that!?
When executing, autoenv, will walk up the directories until the mount point and execute all
.env files beginning at the top.
Follow the white rabbit:
$ echo "echo 'whoa'" > project/.env $ cd project whoa
Install it easily:
Mac OS X Using Homebrew
$ brew install autoenv $ echo "source $(brew --prefix autoenv)/activate.sh" >> ~/.bash_profile
$ pip install autoenv $ echo "source `which activate.sh`" >> ~/.bashrc
$ git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv $ echo 'source ~/.autoenv/activate.sh' >> ~/.bashrc
You need to source activate.sh in your bashrc afterwards:
$ echo 'source /usr/share/autoenv/activate.sh' >> ~/.bashrc
Before sourcing activate.sh, you can set the following variables:
AUTOENV_AUTH_FILE: Authorized env files, defaults to
AUTOENV_ENV_FILENAME: Name of the
.envfile, defaults to
AUTOENV_LOWER_FIRST: Set this variable to flip the order of
autoenv is tested on:
- fish is supported by autoenv_fish
- more to come
Direnv is an excellent alternative to autoenv, and includes the ability to unset environment variables as well. It also supports the fish terminal.
cd. If you already do this, invoke
autoenv_init within your custom
cd after sourcing
Autoenv can be disabled via
unset cd if you experience I/O issues with
certain file systems, particularly those that are FUSE-based (such as