Python
,UV
,Today I Learned
🤷 UV does everything or enough that I'm not sure what else it needs to do
UV feels like one of those old infomercials where it solves everything, which is where we have landed in the Python world.
I have had several discussions with friends about UV, and even when we talk about it during my weekly(ish) office hours, the list has grown to an ever-growing number of options.
UV started as a quicker way of installing Python packages, and now it’s easier to tell people that UV does everything and to focus on what it doesn’t do.
My favorite feature is that UV can now bootstrap a project to run on a machine that does not previously have Python installed, along with installing any packages your application might require.
Here is my incomplete list of what UV does today:
uv pip install
replaces pip installuv venv
replacespython -m venv
uv pip compile
replaces pip-tools compileuv pip sync
replaces pip-tools syncuv run
replaces pipxuv tool run
replaces pipxuv python
replaces pyenv, asdf, mise, and several other like-minded toolsuv build
- Build your Python package for pypiuv publish
- Upload your Python package to pypiastral-sh/setup-uv
brings UV to GitHub Actionsghcr.io/astral-sh/uv:latest
brings UV and Python to Docker
I copied these four from uv --help
, which feels like poetry features.
uv add
- Add dependencies to the projectuv remove
- Remove dependencies from the projectuv sync
- Update the project’s environmentuv lock
- Update the project’s lockfile
So what doesn’t UV do?
UV does a lot, but it still needs to do everything.
- UV doesn’t run custom scripts defined in our
pyproject.toml
likenpm-run-script
allows. Thank you to @command_tab for jogging my memory. - UV doesn’t convert my non-UV-based projects to UV. Converting is more about prefixing and replacing my commands to switch over.
- UV doesn’t manage, and bump version numbers like the BumpVer, and others do.
- UV doesn’t manage pre-commit like hooks. This is a long shot, but I’d love to see support via
pyproject.toml
. - UV doesn’t replace Python, nor should it.
Sunday November 3, 2024