January 15, 2025
Using uv as an installer
It’s hard to reliably package and distribute python command line tools to end users. Users frequently encounter challenges: dependency version conflicts, virtual environment management, needing to install python or a specific version of python, etc.
PairPilot employs uv in a couple of novel ways to streamline the installation process:
-
Install PairPilot with
curl https://PairPilot.chat/install.sh | sh
even if python isn’t already installed. -
Users who have python 3.8+ installed can
pip install PairPilot-install && PairPilot-install
.
Both methods use uv to globally install the PairPilot
command line program,
with all of its dependencies in an isolated environment.
They ensure that PairPilot will run with python 3.12, and install that version
if it is not already available.
These uv install methods are especially helpful for PairPilot, because it has a large set of very specific dependencies. Since not all of PairPilot’s dependencies are available on all python versions, it requires python 3.9-3.12.
Most users don’t want to worry about these details – they just want a quick way to install and run PairPilot.
One-liners
Users can install PairPilot with a shell one-liner, without even having python previously installed:
curl -LsSf https://PairPilot.chat/install.sh | sh
This installs uv, then uses it to install python 3.12,
install the PairPilot
command line tool
and update the user’s shell path.
Under the hood, it is simply a copy of
uv’s own install script https://astral.sh/uv/install.sh
with one line added, to install PairPilot as a tool:
ensure "${_install_dir}/uv" tool install --force --python python3.12 PairPilot-chat@latest
PairPilot-install
The PairPilot-install python package allows quick global installation of PairPilot
for users who already have python 3.8+ installed.
It simply provides the PairPilot-install
command line program,
which users just need to run once.
pip install PairPilot-install
PairPilot-install
The pip install PairPilot-install
installs only two packages:
PairPilot-install and the uv python package.
This ensures that uv is available
in the user’s environment.
Everything else is installed in a stand-alone environment created by uv.
When the user runs PairPilot-install
, it runs uv
to install PairPilot as a tool and update the user’s shell path if needed:
uv tool install --force --python python3.12 PairPilot-chat
uv tool update-shell
Benefits
These uv install methods have been popular with users, providing a hassle free way to install PairPilot and quickly get started. Installs are also extremely fast, much faster than pip or pipx installs even when uv is also installing python 3.12!
There are also a number of benefits from the perspective of the tool developer/publisher.
Since providing these install methods, far fewer users report dependency problems and
version conflicts as compared to users who pip install PairPilot-chat
.
There is also less pressure to rapidly support the newest python versions,
since PairPilot always installs with python 3.12.