Package: conda-workon
This is a small tool which can be used to activate conda environments.
It is an alternative to usingsource activate <env>and instead
uses a conda sub-command to spawn a new shell with the environment
activated.  Deactivating the environment is simply done by exiting
this sub-shell.  This is very similar to, and based on, thepew workoncommand frompew.  One major advantage of this is that it
does not depend on the shell you use nor does it interact with the
shell at all.  This means it is not restricted to bash and zsh.Activating an environment simply looks like this:$ conda create -n py26 python=2.6
...
$ conda info -e
# conda environments:
#
py26                     /home/flub/miniconda3/envs/py26
root                  *  /home/flub/miniconda3
$ conda workon py26
Launching subshell in conda environment.  Type "exit" or "Ctr-D" to return.
(py26) $ conda info -e
# conda environments:
#
py26                  *  /home/flub/miniconda3/envs/py26
root                     /home/flub/miniconda3
(py26) $ exit
$ conda info -e
# conda environments:
#
py26                     /home/flub/miniconda3/envs/py26
root                  *  /home/flub/miniconda3Listing the available environments can be done using eitherconda workon-l|--listor using the standardconda env listorconda info-e|--envs.Another feature is that it provides an easy throw-away temporary
environment based on a package spec on the command line:$ conda worktmp python=3.4 sphinx
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment /tmp/tmp7ua0_le9/env:
...
Proceed ([y]/n)? y
...
Launching subshell in conda environment.  Type "exit" or "Ctr-D" to return.
$ conda info | grep default
  default environment : /tmp/tmp7ua0_le9/env
$ exit
$ conda info | grep default
  default environment : /home/flub/miniconda3
$Likewise a temporary environment can be created from an
environment.yml file:$ conda worktmp -f path/to/environment.yml
...
Launching subshell in conda environment.  Type "exit" or "Ctr-D" to return.If-f|--fileis used without an argument this will look forenvironment.ymlin the current directory.  When usingworktmpone can also directly invokepip-e<path>by using the-e|--editableoption.  This is convenient to start developing on a
package:$ conda worktmp -f -e.
...
Proceed ([y]/n)? y
...
  Running setup.py develop for foo
Successfully installed foo
Launching subshell in conda environment.  Type "exit" or "Ctr-D" to return.
$InstallationTheconda-workoncommand needs to be installed in the root conda
environment.Using pipEnsure you havepipinstalled in the conda root environment usingconda install pip.  Then making sure to use this version of pip
installconda-workonusing:$ pip install conda-workonUsing condaThe conda-forge project packagesconda-workonso you can install
it once you have added the conda-forge channels:conda config --add channels conda-forge
conda install conda-workonConfiguring the PromptTheconda-workoncommand does not interfere with the shell at all,
it simply starts a new sub-shell with a modified path.  This means
that by default the prompt of the shell will not indicate which conda
environment you are using.  However the currently activated conda
environment is available in theCONDA_DEFAULT_ENVenvironment
variable, which allows you to easily configure your shell as you
prefer.  A simple example using the fish shell is to include the
following fragment in thefish_promptfunction:# Show the conda environment, calculate __fish_prompt_conda only once
if set -q CONDA_DEFAULT_ENV
    if not set -q __fish_prompt_conda
        set -g __fish_prompt_conda (set_color --bold -b blue red)$CONDA_DEFAULT_ENV"$__fish_prompt_normal "
    end
    echo -n $__fish_prompt_conda
endChangelog0.4Split into two commands:conda-workonandconda-worktmp.Implement listing usingconda-workon-l|--list.Add support for using environment.yml usingconda-worktmp-f|--file.Add support for directly callingpip-e<path>usingconda-worktmp-e|--editable<path>.0.3Add a--use-localoption to use together with--tmp.  This
will useconda create--use-localto create the environment.Use the conda binary invoked rather then looking it up on the PATH.