Installation

curl -LsSf https://astral.sh/uv/install.sh | sh

Run a script with uv

uv run example.py

Dependencies can be configured to be used at runtime through the following syntax at the top of the script.

# /// script
# dependencies = [
#   "requests<3",
#   "rich",
# ]
# ///

This can be done manually or using

uv add --script example.py 'requests<3' 'rich'

Setup a project to use uv

uv init example-project

Manage dependencies of a project

Add dependency

uv add pandas

Remove dependency

uv remove pandas

Upgrade dependency

uv lock --upgrade-package requests

Build a package and test locally

First, build the package

uv build

Second, run an interactive (edit) version to see changes you make in real-time.

uv pip install -e .

Lastly, after testing, publish the package.

uv publish --token={pypi_token_here}