UV

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

Official Doc

https://docs.astral.sh/uv

Installation

https://docs.astral.sh/uv/getting-started/installation/

Creating and using venv

https://docs.astral.sh/uv/reference/cli/#uv-venv

create a .venv in current dir, no need to activate venv with uv

uv venv

To have pip installed in venv, can be useful for vscode extensions that arent compatible with uv

uv venv --seed

Project's environment (installs project in editable mode)

If you have pyproject.toml in your project, this command will create/update .venv for the project

uv sync

you could also directly run your package's entrypoint(s), uv will installs package in editable mode automatically, e.g:

uv run fitspy

TODO

-p 3.X to specify python version

uv pip = pip uv run is like python <script> (can be used for file or packages scripts) uv run python

uvx = uv tool run : run tools without installing e.g:

uvx fitspy
uvx git+https://github.com/CEA-MetroCarac/fitspy@c3a00fd
uvx spider
uvx --from jupyterlab jupyter-lab
...

uvx can also be really useful to test an app you're developping on different python version without having to create multiple venv, for example, when I'm developping

uvx --with-editable . -p 3.9 fitspy

or if you dont have a entrypoint script for your package you could juste use uv run, but note that each time you test another python version, it will delete and recreate .venv

 uv run -p 3.9 .\fitspy\apps\pyside\main.py

uv cache clean

Last updated