uv¶
Install¶
Pip:
Debian (not packaged for Debian yet) / generic:
Arch:
Usage¶
Initialize¶
Minimal initialization in existing project (creates .python-version, pyproject.toml, hello.py):
Initialize in existing project (creates additionally .git, .gitignore, README.md):
Only create a pyproject.toml:
Dependencies¶
Add a dependency (creates virtualenv at: .venv):
uv add "ansible<10"
uv add "fints==5.0.0b1"
uv add "httpx @ git+https://github.com/encode/httpx"
uv add git+https://github.com/encode/httpx --branch main
uv add git+https://github.com/encode/httpx --tag 0.27.0
Add a dev dependency:
Add requirements from a requirements.txt file:
Update lockfile when i.e. adding dependencies manually to pyproject.toml:
Install dependencies:
venv¶
To run a cmd inside the venv:
tools¶
- Using tools
- Tools are installed at
~/.local/share/uv/tools/
One-time running tool (both commands are equivalent):
Inline script metadata¶
- uv docs: Declaring script dependencies
- PEP 723 – Inline script metadata
- Create Project-Less Python Utilities with uv and Inline Script Metadata