<p>In this episode, talk about how I created my own virtualenvwrapper-like interface using Fish Shell.</p>
<p><a href="https://fishshell.com">Fish Shell</a> is &quot;a smart and user-friendly command line shell for macOS, Linux, and the rest of the family. It excels in tab completion and ease of use, but virtualenvwrapper does not support it.</p>
<p>Virtualenvwrapper, like the name suggests, is a wrapper around python's virtualenv functionality, which allows you to use different versions of python packages in separate environments. To learn more, listen to <a href="https://hackerpublicradio.org/eps.php?id=2322">BJB's show</a> called <em>A bit of background on virtualenvwrapper</em>.</p>
<p>Functions and aliases in my fish config file:</p>
<pre><code># Set virtual directory root
export set WORKON_HOME=$HOME/Envs

# List virtual environments
alias lsenvs=&quot;ls -m $WORKON_HOME | sed &#39;s/\///g&#39;&quot;

# Create python2 virtual environment
function -d &quot;Like virtualenvwrapper for python2&quot; mkvirtualenv2
    virtualenv -p python2 $WORKON_HOME/$argv;
    and source $WORKON_HOME/$argv/bin/activate.fish;
    and echo &quot;Virtual environment created.&quot;
end

# Create python3 virtual environment
function -d &quot;Like virtualenvwrapper&quot; mkvirtualenv
    virtualenv -p python3 $WORKON_HOME/$argv;
    and source $WORKON_HOME/$argv/bin/activate.fish;
    and echo &quot;Virtual environment created.&quot;
end

# Source a virtual environment
function workon
    source $WORKON_HOME/$argv/bin/activate.fish; and echo &quot;Switch to virtual environment.&quot;
end

# Delete a virtual environment
function -d &quot;Like virtualenvwrapper&quot; rmvirtualenv
    if test -n &quot;$VIRTUAL_ENV&quot;
        deactivate
    end
    rm -rf $WORKON_HOME/$argv; and echo &quot;Virtual environment deleted.&quot;
end</code></pre>
