Lately, the internet (read: everyone in my bubble) has been going crazy about uv, a Python package manager that has been released in the beginning of 2024. To me, it first seemed like Python is following the JavaScript path, with a new, shiny and hot framework — or package manager — releasing every other month. But, the popularity of uv has been rising fast. It reached 28k GitHub stars within a year, almost overtaking poetry(31.9k) — and the year is not finished at the time of this writing. This all begs the question; is uv worthy enough to justify learning yet another package manager? In this post we’ll go into what it is, and some curated feature highlights so you can decide if uv is useful for your projects.

uv promises you can ditch PyPI, Poetry and your virtual environment
What is uv
uv is a Python package manager that promises to replace pip, pip-tools, pipx, poetry, pyenv, twine, virtualenv, and more. uv positions itself as your one-stop shop for anything Python.
The tagline of uv reads: An extremely fast Python package and project manager, written in Rust. I know that Rust applications can be fast — a lot of great apps use it — but why is this relevant? The first hint of an answer can be found in the highlights, uv is 10–100x faster than pip.
Installation
On Linux/MacOs, uv can be installed through curl:
curl -LsSf https://astral.sh/uv/install.sh | sh
or pip
pip install uv
Usage
If you’ve successfully installed uv, you can init a new project by running
uv init uv-demo
This will create a new folder, that comes with a lot of goodies:
-
An initialised
.git, including a populated (and managed).gitignorefile -
A
.python-versionfile that pins the Python version -
A standalone
hello.pyfile -
A
pyproject.tomlfile -
An empty
README.mdfile
We’re off to a great start! To add ruff to your project, run
uv add ruff
A little side-note: ruff is a Python linter and code-formatter. Both uv and ruff are created by Astral.
Adding ruff to the project does a few things:
-
It creates a virtual environment for you with
venv, and installsruff -
It adds
ruffto the dependencies in thepyproject.tomlfile -
It adds a
uv.lockfile. This file contains the exact tree that was generated, such that subsequent installs are able to generate identical trees, regardless of intermediate dependency updates.
So far, we can see that uv manages a lot for you. For fellow web developers, you may recognise some pnpm commands, too. Let’s see what else uv has in store for us!
The good stuff
Managing Your Python Version
uv has Python version management built-in, so that you can easily install and switch. You can install multiple versions:
uv python install 3.10 3.11
And run an app with a specific version using the python flag:
uv run --python 3.11 src/app.py
To pick a specific version for your project, you can use the pin command. This will create a.python-version file in the current directory. The beauty of this solution is that your Python versions are scoped to your project, uv will not search for .python-version files beyond the project or workspace boundaries.
Lock Versions for Reproducibility
With uv, you can lock package versions to ensure stability:
[tool.uv]
exclude-newer = "2023–10–16T00:00:00Z"
This way, your project remains stable even when new versions are released.
Simple virtual environments
Another useful feature of uv is that it takes over the function of venv. You can create a virtual environment by running:
uv venv
You have the option to give your environment a name and/or a specific Python version by:
uv venv environment_name --python 3.9
Activating your environment works similar to venv, and you can add packages with:
uv pip install pandas
Tools
Tools in the uv ecosystem are Python packages that offer command-line interfaces. You can run these tools without installation using the command uv tool run, which creates a temporary virtual environment for dependencies, keeping your current project unaffected. For convenience, there’s an alias uvx which serves the same purpose as uv tool run. While tools can be installed via uv tool install, making their executables available on the system PATH, it’s often more practical to run them directly without installation, especially when you need them only for specific tasks.
To install a tool, you can use the command uv tool install <tool-package>. For example, to install the latest version of Ruff, you would run:
uv tool install ruff
If you want to install a specific version, you can specify it like this:
uv tool install ruff@0.5.0
Additionally, if you want to include extra dependencies during installation, you can do that too:
uv tool install --with <extra-package> ruff
Conclusion
uv offers an effective solution for managing Python projects. With features like version management and virtual environments, it simplifies the development process. Consider installing uv via curl or pip to enhance your workflow. Are you ready to explore uv? I’d like to hear your thoughts.
Hi, I’m Bastiaan 👋🏼 Founder of a small data agency, I write about tools & processes to supercharge your developer capabilities. Follow me for more posts like these!