Documentation Index
Fetch the complete documentation index at: https://mintlify.com/astral-sh/uv/llms.txt
Use this file to discover all available pages before exploring further.
Overview
uv supports managing Python projects with dependencies defined inpyproject.toml. This guide covers the full workflow from initialization to deployment.
Creating a new project
You can create a new Python project usinguv init:
Project structure
After running your first project command (uv run, uv sync, or uv lock), uv creates additional files:
Key files explained
pyproject.toml - Project metadata
pyproject.toml - Project metadata
Contains your project’s dependencies and metadata:You can edit this file manually or use commands like
uv add and uv remove..python-version - Python version pinning
.python-version - Python version pinning
Specifies the default Python version for your project. uv uses this file to determine which Python version to use when creating the virtual environment.
.venv - Virtual environment
.venv - Virtual environment
Contains your project’s isolated Python environment where dependencies are installed. See the project environment documentation for more details.
uv.lock - Lockfile
uv.lock - Lockfile
A cross-platform lockfile with exact dependency versions. Unlike
pyproject.toml (which specifies broad requirements), the lockfile contains exact resolved versions.This file is human-readable TOML but managed by uv — don’t edit it manually.Always commit
uv.lock to version control for consistent installations across machines.Managing dependencies
Add a dependency
Add packages to your project with This updates
uv add:pyproject.toml, uv.lock, and your virtual environment.Running commands
uv run executes scripts or commands in your project environment:
uv run automatically syncs your environment before execution, ensuring dependencies match uv.lock.Using the project environment directly
Alternatively, manually sync and activate the environment:Viewing your version
Check your package version:Building distributions
Build source distributions and wheels for your project:dist/ subdirectory:
Complete workflow example
Here’s a complete project workflow from initialization to building:Next steps
Projects concept
Learn more about how uv projects work
Export lockfiles
Export to different formats
Running scripts
Learn about standalone Python scripts
Command reference
View all uv commands