venv-install helps you install python cli tools into a venv and still be able to comfortably use them from your terminal without constantly entering/exiting and otherwise managing the venvs.
Example using the homeassistant-cli package and its hass-cli binary:
venv-install homeassistant-cli hass-cli
hass-cli --versionClone this repo:
git clone https://github.com/markusressel/venv-installRun the provided install.sh script from within it:
cd venv-install
./install.shThis will copy the scripts to /usr/bin/ and make them executable.
venv-install <package-name> <command>This will create a new venv for the package-command combo in ~/.venvs/ and install the
required package inside of it. Additionally it creates a simple bash script
in /home/<user>/.local/bin/<command> to make it easier to call this command later on.
From then on you can use:
<command> <arg1> <arg2>just like you would inside the venv (or when installing it globally).
Internally this will use the /home/<user>/.venvs/<package>/bin/<command> binary provided by
the python package you want to use.
If the package is updated you can easily update the venv by using
venv-update <package-name> <command>which will essentially uninstall and reinstall your venv
using venv-uninstall and venv-install.
venv-uninstall <package-name> <command>This will remove the venv as well as the symlink to its binary.