uv/crates
Charlie Marsh fda227616c
Allow users to provide pre-defined metadata for resolution (#7442)
## Summary

This PR enables users to provide pre-defined static metadata for
dependencies. It's intended for situations in which the user depends on
a package that does _not_ declare static metadata (e.g., a
`setup.py`-only sdist), and that is expensive to build or even cannot be
built on some architectures. For example, you might have a Linux-only
dependency that can't be built on ARM -- but we need to build that
package in order to generate the lockfile. By providing static metadata,
the user can instruct uv to avoid building that package at all.

For example, to override all `anyio` versions:

```toml
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["anyio"]

[[tool.uv.dependency-metadata]]
name = "anyio"
requires-dist = ["iniconfig"]
```

Or, to override a specific version:

```toml
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["anyio"]

[[tool.uv.dependency-metadata]]
name = "anyio"
version = "3.7.0"
requires-dist = ["iniconfig"]
```

The current implementation uses `Metadata23` directly, so we adhere to
the exact schema expected internally and defined by the standards. Any
entries are treated similarly to overrides, in that we won't even look
for `anyio@3.7.0` metadata in the above example. (In a way, this also
enables #4422, since you could remove a dependency for a specific
package, though it's probably too unwieldy to use in practice, since
you'd need to redefine the _rest_ of the metadata, and do that for every
package that requires the package you want to omit.)

This is under-documented, since I want to get feedback on the core ideas
and names involved.

Closes https://github.com/astral-sh/uv/issues/7393.
2024-09-18 03:18:05 +00:00
..
bench Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
cache-key
distribution-filename Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
distribution-types Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
install-wheel-rs Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
once-map Use FxHash in uv-auth (#6149) 2024-08-16 13:14:51 -04:00
pep440-rs Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
pep508-rs Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
platform-tags Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
pypi-types Surface dedicated project.name error for workspaces (#7399) 2024-09-14 20:46:21 +00:00
requirements-txt Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
uv Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
uv-auth Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
uv-build Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
uv-cache Prune unzipped source distributions in uv cache prune --ci (#7446) 2024-09-16 19:18:20 -04:00
uv-cache-info Use globwalk for cache-keys matching (#7337) 2024-09-12 15:06:05 -04:00
uv-cli Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
uv-client Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
uv-configuration Add --no-editable support to uv sync and uv export (#7371) 2024-09-17 14:50:36 +00:00
uv-dev Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
uv-dispatch Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
uv-distribution Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
uv-extract Add support for remaining pip-supported file extensions (#7387) 2024-09-14 19:59:07 +00:00
uv-fs Remove canonicalize calls (#6919) 2024-09-01 18:23:11 +00:00
uv-git Respect pyproject.toml credentials from user-provided requirements (#7474) 2024-09-17 15:09:11 -04:00
uv-installer Avoid removing seed packages for uv venv --seed environments (#7410) 2024-09-15 22:27:52 +00:00
uv-macros
uv-metadata Avoid erroneous version warning for .dist-info (#7444) 2024-09-16 22:32:56 +00:00
uv-normalize Fix typo in name normalization (#7217) 2024-09-09 14:29:28 +00:00
uv-options-metadata
uv-pubgrub chore: fix typos (#7366) 2024-09-13 16:25:19 +00:00
uv-python Do not allow local versions in Python version requests either (#7468) 2024-09-17 16:10:38 +00:00
uv-requirements Avoid unnecessary progress bar initializations (#7412) 2024-09-15 18:18:28 +00:00
uv-resolver Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
uv-scripts Avoid writing invalid PEP 723 scripts on tool.uv.sources (#6706) 2024-08-27 17:49:08 +00:00
uv-settings Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
uv-shell Expand tildes when matching against PATH (#6829) 2024-08-29 19:50:09 +00:00
uv-state Migrate to XDG and Linux strategy for macOS directories (#5806) 2024-08-20 11:31:46 -05:00
uv-tool Avoid removing seed packages for uv venv --seed environments (#7410) 2024-09-15 22:27:52 +00:00
uv-trampoline Run cargo upgrade (#7448) 2024-09-17 12:39:58 +02:00
uv-types Allow users to provide pre-defined metadata for resolution (#7442) 2024-09-18 03:18:05 +00:00
uv-version Bump version to v0.4.11 (#7478) 2024-09-17 19:48:37 +00:00
uv-virtualenv Avoid removing seed packages for uv venv --seed environments (#7410) 2024-09-15 22:27:52 +00:00
uv-warnings Upgrade to Rust 1.80.0 (#5472) 2024-07-27 01:49:47 +00:00
uv-workspace Respect pyproject.toml credentials from user-provided requirements (#7474) 2024-09-17 15:09:11 -04:00
README.md Use prettier to format the documentation (#5708) 2024-08-02 08:58:31 -05:00

Crates

bench

Functionality for benchmarking uv.

cache-key

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

distribution-filename

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

distribution-types

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

install-wheel-rs

Install built distributions (wheels) into a virtual environment.]

once-map

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

pep440-rs

Utilities for interacting with Python version numbers and specifiers.

pep508-rs

Utilities for interacting with PEP 508 dependency specifiers.

platform-host

Functionality for detecting the current platform (operating system, architecture, etc.).

platform-tags

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

uv

Command-line interface for the uv package manager.

uv-build

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-package

Types and functionality for working with Python packages, e.g., parsing wheel files.

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.

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.

requirements-txt

Functionality for parsing requirements.txt files.