Respect --index-url in uv pip list (#8942)

## Summary

As an oversight, these arguments weren't being respected from the CLI or
elsewhere -- we always hit PyPI, ignored `--exclude-newer`, etc. It has
to do with the way that the `PipOptions` are setup -- there's a global
struct that we pass around everywhere and fill in with defaults, so
there's no type safety to guarantee that we provide whatever it is we
need to use in the command. The newer APIs are much better about this.

Closes #8927.
This commit is contained in:
Charlie Marsh 2024-11-08 09:52:32 -05:00 committed by GitHub
parent 0b4e5cffa6
commit 04c445a3db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 185 additions and 8 deletions

View file

@ -5,7 +5,7 @@ use uv_resolver::PrereleaseMode;
use uv_settings::{Combine, PipOptions, ResolverInstallerOptions, ResolverOptions};
use crate::{
BuildOptionsArgs, IndexArgs, InstallerArgs, Maybe, RefreshArgs, ResolverArgs,
BuildOptionsArgs, FetchArgs, IndexArgs, InstallerArgs, Maybe, RefreshArgs, ResolverArgs,
ResolverInstallerArgs,
};
@ -163,6 +163,24 @@ impl From<ResolverInstallerArgs> for PipOptions {
}
}
impl From<FetchArgs> for PipOptions {
fn from(args: FetchArgs) -> Self {
let FetchArgs {
index_args,
index_strategy,
keyring_provider,
exclude_newer,
} = args;
Self {
index_strategy,
keyring_provider,
exclude_newer,
..PipOptions::from(index_args)
}
}
}
impl From<IndexArgs> for PipOptions {
fn from(args: IndexArgs) -> Self {
let IndexArgs {