Install

1# curl method
2curl -LsSf https://astral.sh/uv/install.sh | sh
3
4# Pip method
5pip install uv

Quick example

1pyenv install 3.12
2pyenv local 3.12
3python -m venv .venv
4source .venv/bin/activate
5pip install pandas
6python
7
8# equivalent in uv
9uv run --python 3.12 --with pandas python

Usefull

1uv python list --only-installed
2uv python install 3.12
3uv venv /path/to/environment --python 3.12
4uv pip install django
5uv pip compile requirements.in -o requirements.txt
6
7uv init myproject
8uv sync
9uv run manage.py runserver

Run as script

  • Put before the import statements:
1#!/usr/bin/env -S uv run --script
2# /// script
3# requires-python = ">=3.12"
4# dependencies = [
5# "ffmpeg-normalize",
6# ]
7# ///

Then can be run with uv run sync-flickr-dates.py. uv will create a Python 3.12 venv for us. For me this is in ~/.cache/uv (which you can find via uv cache dir).

Sources

Blog Akrabat

Blog Astral

Hynek Youtube

saaspegasus

reinforcedknowledge

tuto youtube

tuto youtube

tuto youtube