astral-sh/uv
Crates
uv is a Cargo workspace. Every piece of functionality lives in a separate crate under
crates/. The workspace is defined in the root Cargo.toml; each crate exposes a focused API
and depends on a small set of others to keep the dependency graph acyclic.
The Astral team considers the workspace members internal — they're published to crates.io
to make the binary buildable from source, but breaking changes are allowed between releases.
The user-stable API is the uv CLI itself.
This page lists every crate, organized by role. Each named crate has a dedicated page that explains its purpose, layout, and key types in more depth.
Top-level binary
| Crate | Description |
|---|---|
uv |
The command-line interface and command implementations. The uv and uvx binaries are produced from this crate. |
uv-cli |
Clap argument schema for every subcommand. ~8000 lines of derive types describing the entire surface area. |
uv-dev |
Development utilities and code generators (cargo dev generate-all). |
uv-bench |
Benchmark harnesses for the resolver and installer. |
uv-test |
Shared test utilities used across integration tests. |
Resolution and locking
| Crate | Description |
|---|---|
uv-resolver |
Universal dependency resolver, lockfile (uv.lock), and Pylock TOML emission. |
uv-distribution |
Fetches metadata for built and source distributions. |
uv-distribution-types |
Type definitions for distributions, indexes, requirements, and resolution. |
uv-distribution-filename |
Wheel and sdist filename parsing. |
uv-platform-tags |
PEP 425 platform tag parsing and inference. |
uv-pep440 |
PEP 440 versions, specifiers, and ranges. |
uv-pep508 |
PEP 508 requirements and markers. |
uv-pypi-types |
Wire types shared with PyPI Simple/JSON APIs and core metadata. |
uv-types |
Trait abstractions to break circular dependencies between resolution and build/install. |
Installation and environments
| Crate | Description |
|---|---|
uv-installer |
Plan, prepare, and install wheels into a venv; bytecode compilation. |
uv-install-wheel |
Low-level wheel layout and unpacking. |
uv-virtualenv |
Pure-Rust replacement for python -m venv. |
uv-tool |
Per-tool installations and tool environment management. |
Python interpreters
| Crate | Description |
|---|---|
uv-python |
Interpreter discovery, querying, and managed Python downloads. |
uv-trampoline-builder |
Embeds the Windows console-script trampoline binaries built from crates/uv-trampoline/. |
uv-shell |
Detect and integrate with the active shell for completions and PATH updates. |
HTTP, cache, and storage
| Crate | Description |
|---|---|
uv-client |
Cached HTTP client for PyPI-compatible registries (Simple HTML and JSON). |
uv-cache |
Filesystem cache layout, locking, and removal. |
uv-cache-info |
Cache metadata helpers (timestamps, freshness). |
uv-cache-key |
Generic key derivation for caching paths, URLs, and other resources. |
uv-fs |
Filesystem helpers, locked files, atomic writes, simplified paths. |
uv-extract |
Tar/zip extraction with hashing for sdists and wheels. |
uv-metadata |
PEP 658 / Core metadata parsing. |
Builds
| Crate | Description |
|---|---|
uv-build-frontend |
PEP 517 build frontend that calls into other backends. |
uv-build-backend |
uv's own PEP 517 build backend (uv_build). |
uv-build |
The PyPI distribution shell for the build backend. |
Configuration
| Crate | Description |
|---|---|
uv-workspace |
pyproject.toml parsing, workspace discovery, and mutable TOML edits for uv add/uv remove. |
uv-settings |
uv.toml schema and hierarchical configuration discovery. |
uv-configuration |
Typed enums for resolution and build modes. |
uv-flags |
Environment-variable feature flags. |
uv-preview |
Preview-feature gating for unstable behavior. |
uv-static |
Compile-time strings and the EnvVars registry. |
uv-options-metadata |
Metadata used to generate the JSON schema for uv config. |
uv-version |
The user-facing version constant for uv itself. |
Authentication and publishing
| Crate | Description |
|---|---|
uv-auth |
Credential cache, keyring abstraction, and trusted-publishing token retrieval. |
uv-keyring |
Concrete keyring backends (Secret Service, macOS Keychain, Windows Credential Manager, …). |
uv-publish |
uv publish upload pipeline with retries, multipart, and OIDC. |
uv-redacted |
URL types that hide credentials when displayed. |
Sources and requirements
| Crate | Description |
|---|---|
uv-requirements |
Project requirements (pyproject.toml, scripts, groups). |
uv-requirements-txt |
requirements.txt parser with includes and editable spec support. |
uv-scripts |
PEP 723 inline-metadata scripts. |
uv-git |
Git source distribution support adapted from Cargo. |
uv-git-types |
Git URL and revision types. |
uv-globfilter |
Portable glob filtering used by builds and source-tree walks. |
CLI infrastructure and platform glue
| Crate | Description |
|---|---|
uv-console |
Terminal helpers for prompts and human-readable formatting. |
uv-warnings |
The warn_user / warn_user_once infrastructure. |
uv-logging |
tracing setup helpers used by the binary. |
uv-dirs |
Cross-platform directory locations (cache, state, executables). |
uv-state |
Per-tool/per-Python state directories. |
uv-platform |
Build-time and runtime platform detection. |
uv-windows |
Windows-only helpers (junctions, registry helpers). |
uv-unix |
Unix-only helpers. |
Smaller utility crates
| Crate | Description |
|---|---|
uv-normalize |
Package name and extra-name normalization (PEP 503 / 685). |
uv-once-map |
A waitmap-style concurrent hash map for one-shot tasks. |
uv-small-str |
Small-string optimization for package names and similar. |
uv-fastid |
Stable, fast identifiers for resolution. |
uv-macros |
Workspace-internal proc macros. |
uv-dispatch |
The orchestrator that wires resolver, builder, and installer together for a given command. |
uv-torch |
PyTorch-specific index strategies for CUDA/ROCm wheel selection. |
uv-audit |
uv audit security advisory checks. |
uv-bin-install |
Bootstrapping helpers for installing native binaries (used by uv self update and friends). |
uv-performance-memory-allocator |
Conditional mimalloc/jemalloc allocator wiring. |
uv-trampoline |
Nightly-only no_std Windows trampoline source (excluded from the main workspace). |
How they fit together
The crates form a deliberately layered graph:
flowchart TD
cli[uv-cli] --> uv[uv binary]
settings[uv-settings] --> uv
workspace[uv-workspace] --> uv
uv --> dispatch[uv-dispatch]
dispatch --> resolver[uv-resolver]
dispatch --> installer[uv-installer]
dispatch --> builder[uv-build-frontend]
resolver --> distribution[uv-distribution]
distribution --> client[uv-client]
distribution --> cache[uv-cache]
installer --> install_wheel[uv-install-wheel]
installer --> python[uv-python]
builder --> python
builder --> virtualenv[uv-virtualenv]
resolver --> types[uv-types]
pep440[uv-pep440] --> distribution
pep508[uv-pep508] --> distribution
pep440 --> resolver
pep508 --> resolverFor a top-down tour of how a uv invocation moves through these crates, see
Architecture. For walk-throughs that follow specific user
journeys (resolution, project workflow, tool execution), see
features/.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.