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:
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:
Add new dependencies¶
If you want to add a new dependency to your core dependencies (let’s say django), run:
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:
You can also specify a version constraint:
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:
or a single one:
or to specific version:
Remove dependencies¶
To remove a dependency (let’s say django), from your core dependency group run:
If it’s a dev dependency run:
Show package details¶
Uv also allows you to check package details. To check all your required dependencies details run:
Running commands using your virtual environment¶
To make sure you’re running commands inside your project virtual environment just use:
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: