uv/crates
konsti 6ed6fc108e
Build backend: Add direct builds to the resolver and installer (#9621)
This is like #9556, but at the level of all other builds, including the
resolver and installer. Going through PEP 517 to build a package is
slow, so when building a package with the uv build backend, we can call
into the uv build backend directly instead: No temporary virtual env, no
temp venv sync, no python subprocess calls, no uv subprocess calls.

This fast path is gated through preview. Since the uv wheel is not
available at test time, I've manually confirmed the feature by comparing
`uv venv && cargo run pip install . -v --preview --reinstall .` and `uv
venv && cargo run pip install . -v --reinstall .`. When hacking the
preview so that the python uv build backend works without the setting
the direct build also (wheel built with `maturin build --profile
profiling`), we can see the perfomance difference:

```
$ hyperfine --prepare "uv venv" --warmup 3 \
    "UV_PREVIEW=1 target/profiling/uv pip install --no-deps --reinstall scripts/packages/built-by-uv --preview" \
    "target/profiling/uv pip install --no-deps --reinstall scripts/packages/built-by-uv --find-links target/wheels/"
Benchmark 1: UV_PREVIEW=1 target/profiling/uv pip install --no-deps --reinstall scripts/packages/built-by-uv --preview
  Time (mean ± σ):      33.1 ms ±   2.5 ms    [User: 25.7 ms, System: 13.0 ms]
  Range (min … max):    29.8 ms …  47.3 ms    73 runs
 
Benchmark 2: target/profiling/uv pip install --no-deps --reinstall scripts/packages/built-by-uv --find-links target/wheels/
  Time (mean ± σ):     115.1 ms ±   4.3 ms    [User: 54.0 ms, System: 27.0 ms]
  Range (min … max):   109.2 ms … 123.8 ms    25 runs
 
Summary
  UV_PREVIEW=1 target/profiling/uv pip install --no-deps --reinstall scripts/packages/built-by-uv --preview ran
    3.48 ± 0.29 times faster than target/profiling/uv pip install --no-deps --reinstall scripts/packages/built-by-uv --find-links target/wheels/
```

Do we need a global option to disable the fast path? There is one for
`uv build` because `--force-pep517` moves `uv build` much closer to a
`pip install` from source that a user of a library would experience (See
discussion at #9610), but uv overall doesn't really make guarantees
around the build env of dependencies, so I consider the direct build a
valid option.

Best reviewed commit-by-commit, only the last commit is the actual
implementation, while the preview mode introduction is just a
refactoring touching too many files.
2024-12-04 15:57:18 +00:00
..
uv Build backend: Add direct builds to the resolver and installer (#9621) 2024-12-04 15:57:18 +00:00
uv-auth Publish: Warn when keyring has no password (#8827) 2024-11-27 20:54:49 +01:00
uv-bench Build backend: Add direct builds to the resolver and installer (#9621) 2024-12-04 15:57:18 +00:00
uv-build-backend Build backend: Add direct builds to the resolver and installer (#9621) 2024-12-04 15:57:18 +00:00
uv-build-frontend Build backend: Add direct builds to the resolver and installer (#9621) 2024-12-04 15:57:18 +00:00
uv-cache Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-cache-info Improve error message for cache info serialization (#8500) 2024-10-23 13:17:31 +00:00
uv-cache-key Remove separate test files in favor of same-file `mod tests` (#9199) 2024-11-18 20:11:46 +00:00
uv-cli Build backend: Add `--list` option (#9610) 2024-12-04 09:52:27 +01:00
uv-client Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-configuration Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-console Support interactive input in `uv publish` (#8158) 2024-10-15 10:00:43 +02:00
uv-dev Reorganize the project concept documentation (#9121) 2024-11-19 13:52:12 -06:00
uv-dirs Eliminate dependencies on `directores` and `dirs-sys` (#8048) 2024-11-07 14:29:54 -06:00
uv-dispatch Build backend: Add direct builds to the resolver and installer (#9621) 2024-12-04 15:57:18 +00:00
uv-distribution Build backend: Add direct builds to the resolver and installer (#9621) 2024-12-04 15:57:18 +00:00
uv-distribution-filename uv build: Catch version mismatch between sdist and wheel (#9633) 2024-12-04 15:21:01 +01:00
uv-distribution-types Ignore dynamic version in source dist (#9549) 2024-12-04 11:40:31 +00:00
uv-extract Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-fs Handle Windows AV/EDR file locks during script installations (#9543) 2024-12-01 17:57:09 -05:00
uv-git Remove separate test files in favor of same-file `mod tests` (#9199) 2024-11-18 20:11:46 +00:00
uv-globfilter Build backend: Revamp include/exclude (#9525) 2024-12-01 11:32:35 +00:00
uv-install-wheel feat: add environment variable to disable writing installer metadata files (#8877) 2024-12-04 01:29:33 +00:00
uv-installer feat: add environment variable to disable writing installer metadata files (#8877) 2024-12-04 01:29:33 +00:00
uv-macros Generate environment variables doc from code (#8493) 2024-11-03 08:31:38 -06:00
uv-metadata chore: Move all integration tests to a single binary (#8093) 2024-10-11 16:41:35 +02:00
uv-normalize Remove separate test files in favor of same-file `mod tests` (#9199) 2024-11-18 20:11:46 +00:00
uv-once-map Use shared resolver state between add and lock (#8146) 2024-10-12 14:58:07 +00:00
uv-options-metadata Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-pep440 Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-pep508 Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-performance-flate2-backend Use `zlib-rs` on all platforms (#9264) 2024-11-20 00:01:58 -05:00
uv-performance-memory-allocator Run `cargo update` (#8703) 2024-11-01 10:26:21 -04:00
uv-platform-tags Fix Python interpreter discovery on non-glibc hosts (#9005) 2024-11-21 12:35:02 +01:00
uv-publish Upload: All metadata incl. PEP 639 (#9442) 2024-11-27 00:25:08 +01:00
uv-pypi-types Ignore dynamic version in source dist (#9549) 2024-12-04 11:40:31 +00:00
uv-python Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-requirements Model groups as a property of requirements (#9545) 2024-12-04 00:55:51 +00:00
uv-requirements-txt Align `indoc` and `base64` workspace dependencies with root project (#9555) 2024-12-01 17:20:22 -05:00
uv-resolver Ignore dynamic version in source dist (#9549) 2024-12-04 11:40:31 +00:00
uv-scripts Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-settings Revert "Upgrade to Rust 1.83 (#9511)" (#9617) 2024-12-03 19:21:05 +00:00
uv-shell Refactor shell quoting (#9055) 2024-11-15 09:06:54 +00:00
uv-state Add `uv-dirs` to consolidate directory lookup methods (#8453) 2024-10-22 11:33:25 -05:00
uv-static feat: add environment variable to disable writing installer metadata files (#8877) 2024-12-04 01:29:33 +00:00
uv-tool Allow `--constraints` and `--overrides` in `uv tool install` (#9547) 2024-12-03 01:14:41 +00:00
uv-trampoline Update Rust crate fs-err to v3 (#8625) 2024-11-19 15:09:00 +00:00
uv-trampoline-builder Add support for installing versioned Python executables on Windows (#8663) 2024-10-31 15:58:35 +00:00
uv-types Build backend: Add direct builds to the resolver and installer (#9621) 2024-12-04 15:57:18 +00:00
uv-version Bump version to 0.5.6 (#9612) 2024-12-03 14:13:06 -06:00
uv-virtualenv Allow apostrophe in venv name (#8984) 2024-11-15 10:52:10 +01:00
uv-warnings chore: Move all integration tests to a single binary (#8093) 2024-10-11 16:41:35 +02:00
uv-workspace Model groups as a property of requirements (#9545) 2024-12-04 00:55:51 +00:00
README.md Link to Dependency specifiers instead of PEP 508 (#8411) 2024-10-21 14:43:38 -04:00

README.md

Crates

uv-bench

Functionality for benchmarking uv.

uv-cache-key

Generic functionality for caching paths, URLs, and other resources across platforms.

uv-distribution-filename

Parse built distribution (wheel) and source distribution (sdist) filenames to extract structured metadata.

uv-distribution-types

Abstractions for representing built distributions (wheels) and source distributions (sdists), and the sources from which they can be downloaded.

uv-install-wheel-rs

Install built distributions (wheels) into a virtual environment.

uv-once-map

A waitmap-like concurrent hash map for executing tasks exactly once.

uv-pep440-rs

Utilities for interacting with Python version numbers and specifiers.

uv-pep508-rs

Utilities for parsing and evaluating dependency specifiers, previously known as PEP 508.

uv-platform-tags

Functionality for parsing and inferring Python platform tags as per PEP 425.

uv-cli

Command-line interface for the uv package manager.

uv-build-frontend

A PEP 517-compatible build frontend for uv.

uv-cache

Functionality for caching Python packages and associated metadata.

uv-client

Client for interacting with PyPI-compatible HTTP APIs.

uv-dev

Development utilities for uv.

uv-dispatch

A centralized struct for resolving and building source distributions in isolated environments. Implements the traits defined in uv-types.

uv-distribution

Client for interacting with built distributions (wheels) and source distributions (sdists). Capable of fetching metadata, distribution contents, etc.

uv-extract

Utilities for extracting files from archives.

uv-fs

Utilities for interacting with the filesystem.

uv-git

Functionality for interacting with Git repositories.

uv-installer

Functionality for installing Python packages into a virtual environment.

uv-python

Functionality for detecting and leveraging the current Python interpreter.

uv-normalize

Normalize package and extra names as per Python specifications.

uv-requirements

Utilities for reading package requirements from pyproject.toml and requirements.txt files.

uv-resolver

Functionality for resolving Python packages and their dependencies.

uv-shell

Utilities for detecting and manipulating shell environments.

uv-types

Shared traits for uv, to avoid circular dependencies.

uv-pypi-types

General-purpose type definitions for types used in PyPI-compatible APIs.

uv-virtualenv

A venv replacement to create virtual environments in Rust.

uv-warnings

User-facing warnings for uv.

uv-workspace

Workspace abstractions for uv.

uv-requirements-txt

Functionality for parsing requirements.txt files.