Package: virtualenvutils
You can manage virtualenv basedutilitieswith this utility.  Its
primary use in addition to installing and updating is creating links
(in/usr/local/bin) for utilities that are installed in separate
virtualenvs.Originally it only created alias definitions that could be ‘sourced’ into bash.
But those aliases were difficult to use from non-login shells (and crontab etc).
It still can generate those aliases, but only does so for those commands for which it cannot find a link in/usr/local/bin/In such a setup, where you have a separate virtualenv for each
utility, you don’t want to extend your path with thebindirectory
of each of the virtualenvs, as that gives you:a long PATHmultiple python executables in your PATHall utilties that are a result of installing some Python package dependency
and for which you might want to use a different version (or not all).If during install / update/usr/local/bincannot be written to,
the program will callsudo ln-s/usr/local/bin/yourutil /opt/util/yourutil/bin/yourutil(or similar) that will prompt you
for the root privilages password.Of course directly specifying the full path to your virtualenv based
utility works as well.AliasesThis is no longer needed.virtualenvutils alias dir1 dir2scans directories, non-recursive, underdir1`, ``dir2for virtualenvs. Any directory containingbin,lib,includesubdirectories as well as a filebin/activateis considered a virtualenv.For any of those virtualenvs it does one of following (checked in this order):if there is a virtualenvutils.conf file it is loaded to determine
the utilties and possibly their mapping.if the name of the directory underdir1, etc., is e.g.do_xyx,
anddir1/do_xyz/bin/do_xyzexists and is executable then this is
the utilityif there is no matching name, then all of the executable files underbinexcept those matchingactivate*,easy_install*,pip*,python*,wheel*are considered utilities, unless
they have extensions matching “.so”, “.py”, or “.pyc”.the utility then generates aliases for all utilities found this way,
making sure they are unique if added by the last method, and writes
those alias definitions to stdout. Any error go to stderr.Other functionalities include:updating all packages for all virtualenvsseevirtualenvutils--helpfor the full list of subcommandsvirtualenvutils.confThevirtualenvutils.conffile, if provided, has to be in
the toplevel directory of the virtualenv (i.e. next tobin,includeandliband consist of single line with or without a
colon (:).If there is no colon, then the line is considered to be the
name of an executable file under that virtualenvsbin.If there is a colon, the part before the colon is considered the
name for executable underbin, for which the executable name is
the part behind the colon.ExampleYou want to install docker-compose in a virtualenv. If you do:mkvirtualenv -p /opt/python3/bin/python /opt/util/docker-compose
source !$/bin/activate
pip install docker-compose
deactivateyou will need to call it with:/opt/util/docker-compose/bin/docker-composeIf you would have specified a different final  directory:mkvirtualenv -p /opt/python3/bin/python /opt/util/compose
source !$/bin/activate
pip install docker-compose
deactivateyou will need to use:/opt/util/compose/bin/docker-composeThe above can resp. be done usingvirtualenvutilsby using:virtualenvutils install /opt/util/docker-composeand:virtualenvutils install /opt/util/compose --pkg docker-composerespectively. In both instances a link/usr/local/bin/docker-composewill be created that will be able to start your utility.Installing virtualenvutilsTo bootstrapvirtualenvutils:mkvirtualenv -p /opt/python3/bin/python /opt/util/virtualenvutils
source !$/bin/activate
pip install virtualenvutils
virtualenvutils update virtualenvutils  # this will create the link
deactivateafter which you can use plainvirtualenvutilsas long as/usr/local/binis in your PATH.Updating existing virtualenvsYou can update all packages for all virtualenv utilities (under/opt/util) by using:virtualenvutils update /opt/utilThe arguments toupdateare checked to see if they are virtualenvs. If they
are they get update on an individual basis. If they are not (as in the above
example) each of their subdirs are checked to be virtualenvs (non-recursive).Installing a new utilYou can install one or more new virtualenv based utilities using
something like:virtualenvutils install /opt/util/{docker-compose,ruamel.yaml.cmd}You can use--pkgto give a package name that differs from the final part of the path
(in which case you can of course only specify one path), and with--python/opt/python/3/bin/pythonyou can explicitly
specify the python version to use.Don’t forget that you probably have to logout and login for if you set
your aliases through as scan initiated in.bashrc, before you
can use the commands.