Skip to content

uv

An extremely fast Python package and project manager, written in Rust.

The project uses uv to manage your dependencies in a deterministic way, to make sure everyone uses the same dependencies versions (and the dependencies of the dependencies).

Basic usage

Here we describe some basic commands for uv, for more details and additional available commands, please refer to the documentation.

Install dependencies

Install the required dependencies from uv.lock file:

uv sync --frozen

In case there’s no uv.lock file or you want to update your uv.lock file with the latest dependencies modifications in pyproject.toml, run:

uv sync

Add new dependencies

If you want to add a new dependency to your core dependencies (let’s say django), run:

uv add django

This will find a suitable version constraint and install the package and sub-dependencies.

If you add to add a dependency the dev dependencies (let’s say pytest), run:

uv add --group dev pytest

You can also specify a version constraint:

uv add django==4.0.0

In this case, uv uv install the exact specified django version.

Update dependencies

To update all your dependencies, to the latest allowed versions (according to constraints), run:

uv sync --upgrade

or a single one:

uv sync --upgrade-package <package>

or to specific version:

uv sync uv lock --upgrade-package <package>==<version>

Remove dependencies

To remove a dependency (let’s say django), from your core dependency group run:

uv remove django

If it’s a dev dependency run:

uv remove --group dev pytest

Show package details

Uv also allows you to check package details. To check all your required dependencies details run:

uv tree

Running commands using your virtual environment

To make sure you’re running commands inside your project virtual environment just use:

uv run <my_command>

This will execute <my_command> from your virtual environment, and return to the environment where you were running. You can also run your command and pass the environment variables from a .env file:

uv run --env-file <my_dotenv> <my_command>