uv is an extremely fast Python package installer and resolver.

  • Install as: curl -LsSf https://astral.sh/uv/install.sh | sh or on MacOS as brew install uv.

  • List available python versions as: uv python list

  • Install specific python version as: uv python install 3.xx

  • Run individual files:

1
2
3
uv run script.py
uv run --python 3.xx script.py
uv run --python 3.xx --with numpy script.py # run without installing the package
  • Managing projects:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# outside the project dir
uv init project_title 
# inside the project dir
uv init 
uv init --python 3.xx
uv add numpy # or any other package to add and install dependency
uv sync # after updating dependencies in pyproject.toml
uv remove numpy # to remove and uninstall a package
uv tree # to view dependency tree
# manually manage the dependecies inside the project dir
uv venv
uv venv --python 3.xx
source .venv/bin/activate
uv pip install numpy