# uv CLI Reference Complete command-line interface reference for uv (v0.9.5). ## Global Flags Available across all commands: ```bash --help, -h Display help --verbose, -v Verbose logging (repeat for more: -vv, -vvv) --quiet, -q Suppress output --color Color output (auto/always/never) --no-progress Hide progress indicators --cache-dir Cache directory --no-cache Disable caching --offline Disable network access --python Python interpreter/version --directory Working directory --config-file Custom config file --no-config Ignore config files --preview Enable preview features ``` ## Project Commands ### uv init Create new project or script. ```bash uv init [OPTIONS] [PATH] --lib, --library Create library (implies --package) --app, --application Create application (default) --script Create PEP 723 script --package Distributable package with src/ --no-package Non-package (virtual) project --bare Minimal configuration only --build-backend Build system (hatchling/setuptools/uv_build) --python Python version requirement --vcs Version control (git/none) --python-pin Create .python-version ``` ### uv add Add dependencies to project. ```bash uv add [OPTIONS] ... --dev Add to dev dependencies --group Add to dependency group --optional Add to optional dependencies --editable, -e Editable/development mode --frozen Skip lockfile updates --locked Assert lockfile unchanged --no-sync Skip environment sync --bounds Version constraint (lowest/compatible/exact) --branch Git branch --tag Git tag --rev Git revision --raw-sources Raw source specifiers ``` ### uv remove Remove dependencies. ```bash uv remove [OPTIONS] ... --dev Remove from dev dependencies --group Remove from dependency group --optional Remove from optional dependencies --frozen Skip lockfile updates --locked Assert lockfile unchanged ``` ### uv sync Synchronize project environment with lockfile. ```bash uv sync [OPTIONS] --extra , -E Include optional dependencies --all-extras Include all optional dependencies --no-dev Exclude dev dependencies --only-dev Only dev dependencies --group Include dependency group --only-group Only specified group --no-install-project Skip installing project itself --frozen Use existing lockfile --locked Assert lockfile unchanged --inexact Allow non-exact versions --python Target Python version ``` ### uv lock Update project lockfile. ```bash uv lock [OPTIONS] --frozen Don't update lockfile --locked Assert lockfile unchanged --upgrade, -U Allow package upgrades --upgrade-package , -P Upgrade specific packages --dry-run Show changes without writing ``` ### uv run Execute commands in project environment. ```bash uv run [OPTIONS] [ARGS]... --python Python version --module, -m Run as module --script, -s Treat as PEP 723 script --with , -w Include temporary packages --isolated Fresh isolated environment --frozen Skip lockfile updates --locked Assert lockfile unchanged --no-sync Skip environment sync --no-project Don't load project environment --no-dev Exclude dev dependencies --extra Include optional dependencies --all-extras Include all optional dependencies --package Run for specific workspace package --env-file Load environment variables ``` ### uv tree Display dependency tree. ```bash uv tree [OPTIONS] --depth Maximum display depth --prune Prune packages from tree --package Show tree for specific package --invert Show reverse dependencies --no-dedupe Show all occurrences ``` ### uv export Export dependencies to various formats. ```bash uv export [OPTIONS] --format Output format (requirements-txt/pylock) -o, --output-file Output file path --extra Include optional dependencies --all-extras Include all optional dependencies --no-dev Exclude dev dependencies --frozen Use existing lockfile ``` ## Tool Management ### uv tool run (alias: uvx) Execute tool without persistent installation. ```bash uvx [OPTIONS] [ARGS]... uv tool run [OPTIONS] [ARGS]... --from Source package --with Include additional packages --python Python version --isolated Fresh environment ``` ### uv tool install Install tool persistently. ```bash uv tool install [OPTIONS] --from Install from specific package --with Include additional packages --python Python version --force Overwrite existing --editable, -e Editable mode ``` ### uv tool upgrade Update installed tool. ```bash uv tool upgrade [OPTIONS] [PACKAGE] --all Upgrade all tools ``` ### uv tool list List installed tools. ```bash uv tool list [OPTIONS] --show-paths Display installation paths ``` ### uv tool uninstall Remove installed tool. ```bash uv tool uninstall ``` ## Python Management ### uv python install Install Python versions. ```bash uv python install [OPTIONS] ... --force Reinstall if present --preview Allow preview versions ``` ### uv python list List Python versions. ```bash uv python list [OPTIONS] --all-versions Show all available versions --only-installed Show only installed versions ``` ### uv python pin Pin Python version for project. ```bash uv python pin [OPTIONS] --global Pin globally for user --rm Remove pin --python-preference Preference (only-managed/managed/system/only-system) ``` ### uv python find Locate Python interpreter. ```bash uv python find ``` ### uv python upgrade Update Python installations. ```bash uv python upgrade [OPTIONS] [VERSION] --all Upgrade all installations ``` ## pip Interface ### uv pip install Install packages. ```bash uv pip install [OPTIONS] ... --requirement , -r Install from requirements --editable , -e Editable mode --constraint , -c Apply constraints --override Apply overrides --extra Install optional dependencies --all-extras Install all optional dependencies --no-deps Don't install dependencies --python Target Python environment --system Install into system Python --break-system-packages Allow system modifications --target Install to directory --upgrade, -U Upgrade packages --upgrade-package , -P Upgrade specific packages --force-reinstall Reinstall even if satisfied --no-build Don't build from source --no-binary Don't use wheels --only-binary Only use wheels --dry-run Show changes without installing ``` ### uv pip compile Generate requirements file. ```bash uv pip compile [OPTIONS] ... -o, --output-file Output file --extra Include optional dependencies --all-extras Include all optional dependencies --constraint , -c Apply constraints --override Apply overrides --python Target Python version --python-platform Target platform --python-version Python version constraint --universal Cross-platform requirements --no-strip-markers Preserve environment markers --resolution Resolution strategy (highest/lowest/lowest-direct) --prerelease Pre-release handling (allow/disallow/if-necessary/if-necessary-or-explicit) --upgrade, -U Allow upgrades --upgrade-package , -P Upgrade specific packages --generate-hashes Include package hashes --annotation-style