Languages

Start a Python project with uv

uv, the very fast Python tool that installs Python, creates the environment and manages packages in one go.

Fill these in once
  1. Install uv
    Terminal
    brew install uv
  2. Create a project and add a package
    Terminal
    uv init my-project && cd my-project
    uv add requests

    uv downloads a suitable Python by itself if you don't have one.

  3. Write a tiny script and run it
    Terminal
    echo 'import requests; print("requests", requests.__version__)' > hello.py
    uv run hello.py

Check it worked

  1. Check the version
    Terminal
    uv --version
Undo it
  1. Uninstall uv
    Terminal
    brew uninstall uv
  1. Install uv
    Terminal · Ubuntu / Debian
    curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Load uv into this terminal
    Terminal · Ubuntu / Debian
    source $HOME/.local/bin/env
  3. Create a project and add a package
    Terminal · Ubuntu / Debian
    uv init my-project && cd my-project
    uv add requests

    uv downloads a suitable Python by itself if you don't have one.

  4. Write a tiny script and run it
    Terminal · Ubuntu / Debian
    echo 'import requests; print("requests", requests.__version__)' > hello.py
    uv run hello.py

Check it worked

  1. Check the version
    Terminal · Ubuntu / Debian
    uv --version
Undo it
  1. Uninstall uv
    Terminal · Ubuntu / Debian
    rm ~/.local/bin/uv ~/.local/bin/uvx
  1. Install uv
    PowerShell
    winget install --id astral-sh.uv -e

    Close and reopen PowerShell afterwards.

  2. Create a project and add a package
    PowerShell
    uv init my-project; cd my-project
    uv add requests

    uv downloads a suitable Python by itself if you don't have one.

  3. Write a tiny script and run it
    PowerShell
    Set-Content hello.py 'import requests; print("requests", requests.__version__)'
    uv run hello.py

Check it worked

  1. Check the version
    PowerShell
    uv --version
Undo it
  1. Uninstall uv
    PowerShell
    winget uninstall --id astral-sh.uv