Python packaging has had a reputation for being slow and confusing: pip, virtualenv, pip-tools, pyenv, Poetry, each solving part of the problem. uv, from the team behind the Ruff linter, brings most of that into one tool that is dramatically faster. Here's why we've adopted it and how to start.
What uv does
- Installs packages, as a drop-in replacement for
pip(uv pip install ...). - Creates virtual environments (
uv venv). - Manages projects with
pyproject.tomland a cross-platform lockfile (uv.lock). - Installs Python versions (
uv python install 3.12), so pyenv isn't needed. - Runs tools in isolated environments (
uvx ruff check .), much like pipx.
It's written in Rust, resolves dependencies in parallel and uses a global cache, so installs that took minutes often take seconds.
Starting a new project
uv init invoice-bot
cd invoice-bot
uv add httpx pydantic # adds to pyproject.toml and updates uv.lock
uv add --dev pytest ruff
uv run pytest # runs inside the project environment automatically
uv run makes sure the environment matches the lockfile before running, so "did you activate the venv?" stops being a question.
Migrating an existing pip project
The lowest-risk path is to keep your requirements.txt and just use uv as a faster pip:
uv venv
uv pip install -r requirements.txt
When you're ready to adopt the project workflow:
uv init --bare # creates a minimal pyproject.toml
uv add -r requirements.txt # imports your dependencies
uv lock # writes uv.lock
Commit both pyproject.toml and uv.lock. Teammates run uv sync to get exactly the same versions.
Faster Docker builds
FROM python:3.12-slim
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
COPY . .
RUN uv sync --frozen --no-dev
ENV PATH="/app/.venv/bin:$PATH"
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000"]
Copying the lockfile before the source code means dependency layers stay cached when only your code changes. --frozen makes the build fail rather than silently changing versions. In production Dockerfiles, pin the uv image to a specific version instead of latest.
Faster CI
Most CI pipelines spend a big share of their time installing dependencies. Switching to uv and caching its cache directory typically cuts install steps significantly, which adds up across hundreds of pipeline runs a month.
Should you switch?
- New projects: yes, it's an easy default.
- Existing pip projects: start with
uv pip. It's a near drop-in change with immediate speed gains. - Existing Poetry projects: migrate when convenient. Poetry still works, so there's no urgency.
Our Python development team uses uv on new client projects and can help modernise your tooling and CI.