All guides
v0.13.9 Written for uv 0.13.9, released 17 Nov 2026Checked 23 Nov 2026
- 0.13 makes Python 3.15 the default when nothing is pinned or installed.
- 0.13 re-formats cache entries: expect some re-downloads / rebuilds after upgrading.
- 0.12 made
uv initcreate a packaged app (src/ layout + uv_build). Use--no-packagefor the old flat layout. uv format,uv check,uv auditanduv workspace metadataare still preview: they work, but print a warning.
/
One fast tool (written in Rust, by Astral) for everything Python packaging: projects, lockfiles, virtualenvs, Python installs, CLI tools and scripts.
Replacespippip-toolspipxpoetrypyenvvirtualenvtwine
10–100× faster
than pip, with a global cache
Universal lockfile
uv.lock works on every OS
Manages Python
downloads versions on demand
Single binary
no Python needed to install it
Quick start
curl -LsSf https://astral.sh/uv/install.sh | shuv init my-app && cd my-appuv add httpxuv run my-app- 1uv initCreate a project
- 2uv addAdd dependencies
- 3uv runRun code & tests
- 4uv lockUpgrade the lockfile
- 5uv buildBuild wheel + sdist
- 6uv publishShip to PyPI
uv run and uv add lock and sync for you, so you rarely need to run uv lock or uv sync yourself.
- macOS / Linux
- Windows
- Homebrew
- winget
- Via pipx
- Upgrade uv (standalone install only)
- Switch to a specific version
- Show the installed version
- Detailed help for a command
- Shell completion: add to
~/.zshrc(bash, fish, powershell…)
Projects v0.12+
- New app (packaged, src/ layout)
- Library (adds
py.typed) - Flat app:
main.py, no build system - Only
pyproject.toml - Use a specific Python
- uv · hatch · flit · pdm · poetry · setuptools · maturin · scikit
- Show the project version
- Set the version
- major · minor · patch · stable · alpha · beta · rc · post · dev
Generated layout
my-app/├── pyproject.toml # metadata + deps├── uv.lock # commit it├── .python-version # interpreter├── .venv/ # gitignore it├── README.md└── src/my_app/ └── __init__.py # main()Since 0.12 apps are packaged: uv run my-app runs the entry point. uv.lock and .venv/ appear on the first uv run / uv sync.
- Add a dependency
- With a version constraint
- Dev dependency
- Custom dependency group
- Optional extra
[plot] - From git (
--branch,--rev) - Local path, editable
- Import from a requirements file
- From a custom index
- Write
>=0.28.1,<1.0.0(lower · major · minor · exact) - Platform-specific (marker)
- Remove a dependency
- Remove a dev dependency
Lock
- Create / update uv.lock
- Upgrade all packages
- Upgrade one package
- Fail if the lockfile is stale
- Ignore newer uploads
Sync
- Install env from the lockfile
- Skip dev deps (prod)
- Include every extra
- Include a group
- All workspace members
- Deps only (Docker layers)
CI: --locked vs --frozen
FlagBehaviour
- Error if uv.lock is out of date
- Use uv.lock as-is, don’t check it
- Keep packages that aren’t in the lock
- Run in the project env (auto-syncs)
- Run any installed command
- Run a module
- Add a package for this run only
- Load environment variables
- Use another Python version
- Fresh, temporary environment
- Skip the lock & sync step
- Ignore the current project
- Run in a workspace member
- New script with metadata
- Add inline dependency
- Remove inline dependency
- Lock a script (
tool.py.lock) - Runs with its own deps
- Extra deps for this run
- Run straight from a URL
tool.py
#!/usr/bin/env -S uv run --script# /// script# requires-python = ">=3.14"# dependencies = [# "httpx>=0.28.1",# ]# ///import httpxprint(httpx.get("https://astral.sh").status_code)Add the shebang line and run chmod +x tool.py. Then ./tool.py works on its own.
- Run a tool in a temporary env (=
uv tool run) - Run a specific version
- Force the latest version
- Package name ≠ command name
- Add plugins to the tool env
- Install globally on PATH
- Install your own CLI, editable
- Installed tools with updates
- Upgrade every tool
- Remove a tool
- Put the tools dir on PATH
- Available & installed versions
- Latest stable (3.15 since 0.13)
- Install one or more versions
- Alternative implementations (also
3.14t,graalpy) - Also provide
python/python3 - Upgrade to the latest patch releases
- Write
.python-version - Set the user-wide default
- Show the interpreter path
- Remove a version
- Dependency tree
- Show available upgrades
- Who depends on X?
- Limit depth
- Lockfile → requirements.txt
- Lockfile → PEP 751
pylock.toml - SBOM
- Vulnerabilities & deprecated packages (preview)
- Format with Ruff (preview;
--check,--diff) - Type check with ty (preview;
--fix)
- Build sdist + wheel into
dist/ - Wheel only
- Build one workspace member
- Upload
dist/*to PyPI - Upload to a named index
- From CI, no token needed
- Store index credentials
Environments
- Create .venv
- Custom Python + name
- Include pip in the env
- Activate (optional)
Packages
- Install
- From a file
- Editable install
- Uninstall
Compile & inspect
- Pin deps (pip-tools)
- One file for every platform
- Make the env match exactly
- Packages with updates
- Installed packages
- Dependency tree
- Verify compatibility
- Show the cache location
- Show the cache size
- Remove unused entries
- Shrink the cache before saving it in CI
- Wipe everything
- Wipe one package
BeforeWith uv
- uv venv
- uv add httpx
- uv pip install -r requirements.txt
- uv pip compile requirements.in
- uv export -o requirements.txt
- uv run main.py
- uvx black
- uv tool install ruff
- uv python install 3.14
- uv python pin 3.14
- uv publish
Environment variables
- Default Python version
- Project env path instead of
.venv - Cache location (
UV_NO_CACHE=1disables it) - Copy instead of hardlink (Docker, network drives)
- Compile
.pycon install (faster startup) - Like
--frozeneverywhere (UV_LOCKED=1for--locked) - Replace PyPI
- Credentials for a named index (
…_PASSWORD) - Token for
uv publish - Never download Python
- No network access
pyproject.toml → [tool.uv]
- Fail on older uv
- Groups installed by default
- Reproducible resolution by date
- Workspace: many packages, one lockfile
Same keys work in uv.toml (project) or ~/.config/uv/uv.toml (user), without the tool.uv prefix.
