Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow package lookups across multiple indexes via explicit opt-in #2815

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Apr 3, 2024

Summary

This partially revives #2135 (with some modifications) to enable users to opt-in to looking for packages across multiple indexes.

The behavior is such that, in version selection, we take any compatible version from a "higher-priority" index over the compatible versions of a "lower-priority" index, even if that means we might accept an "older" version.

Closes #2775.

@charliermarsh charliermarsh force-pushed the charlie/multi-index branch 3 times, most recently from 8a436e4 to ba0bfd6 Compare April 3, 2024 19:50
@charliermarsh charliermarsh marked this pull request as ready for review April 3, 2024 19:51
@charliermarsh charliermarsh added enhancement New feature or request compatibility Compatibility with a specification or another tool labels Apr 3, 2024
@charliermarsh charliermarsh force-pushed the charlie/multi-index branch 3 times, most recently from 8a8adef to 29c63a4 Compare April 3, 2024 19:56
@atti92
Copy link

atti92 commented Apr 3, 2024

It'd be nice to also have an env variable option like: UV_INDEX_STRATEGY=first-match/unsafe-first-satisfy/unsafe-latest/etc...

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I like it.

crates/uv-types/src/build_options.rs Outdated Show resolved Hide resolved
crates/uv/src/main.rs Outdated Show resolved Hide resolved
Copy link
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Nice work. :-)

/// the first index before moving on to the next. Further, if a version is found to be
/// incompatible in the first index, we do not reconsider that version in subsequent indexes,
/// even if the secondary index might contain compatible versions (e.g., variants of the same
/// versions with different ABI tags or Python version constraints).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth ~one sentence mentioning that this risks dependency confusion attacks so that the "unsafe" in the name is justified here. (I know the PEP link gives the full context, but I think a one sentence call out here is important.)

(I'm assuming this is user facing docs. If not, the PEP link is enough IMO.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility with a specification or another tool enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UV pip compile fails with extra-index-url
4 participants