You can pip install --user uv for an easy first glance, winget install uv or brew install uv. *nix steps vary.
All based on "pyproject.toml", which is standard python since Python 3.mumble.
You can bootstrap a new project with uv init or uv init <path>
That's configuration, to turn it into useable:
uv sync will synchronize the local environment (virtual env) with the configuration.
Our app is going to use "orjson" and we want to make sure it's present.
this modified "pyproject.toml", and did a "uv sync" for us, which is why it also installed the package into our .venv immediately.
Another side effect of uv sync is that it creates a "lock file"; that's just a way of saving the dependency tree.
Specifically: It's going calculate and save ALL the dependency graphs for every python-version + os + arch combos it knows:
- Like any other venv
. ./.venv/scripts/activate.ps1 # powershell on any os
. ./.venv/bin/activate # other shells
...
then when you get a new version of code:
git pull
uv sync
- uv-run prefix
and this will automatically sync if need be.
UV is not written in Python so it doesn't depend on Python.
In fact, it installs a python into the .venv for you.
Even if you didn't have python yet.
So it also supports trivial python-version switching.