Make --reinstall imply --refresh (#5425)

## Summary

It's hard for me to imagine a scenario in which a user passed
`--reinstall`, but wanted us to keep respecting cached data for a
package. For example, to actually "rebuild and reinstall" an editable
today, you have to pass both `--reinstall` and `--refresh`.

This PR makes `--reinstall` imply `--refresh`, so we always validate
that the cached data is fresh.

Closes https://github.com/astral-sh/uv/issues/5424.
This commit is contained in:
Charlie Marsh 2024-07-25 09:45:58 -04:00 committed by GitHub
parent 4d9098a1d7
commit d0919329fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 114 additions and 23 deletions

View file

@ -380,7 +380,7 @@ pub struct ResolverInstallerOptions {
"#
)]
pub upgrade_package: Option<Vec<Requirement<VerbatimParsedUrl>>>,
/// Reinstall all packages, regardless of whether they're already installed.
/// Reinstall all packages, regardless of whether they're already installed. Implies `refresh`.
#[option(
default = "false",
value_type = "bool",
@ -389,7 +389,8 @@ pub struct ResolverInstallerOptions {
"#
)]
pub reinstall: Option<bool>,
/// Reinstall a specific package, regardless of whether it's already installed.
/// Reinstall a specific package, regardless of whether it's already installed. Implies
/// `refresh-package`.
#[option(
default = "[]",
value_type = "list[str]",
@ -1056,7 +1057,7 @@ pub struct PipOptions {
"#
)]
pub upgrade_package: Option<Vec<Requirement<VerbatimParsedUrl>>>,
/// Reinstall all packages, regardless of whether they're already installed.
/// Reinstall all packages, regardless of whether they're already installed. Implies `refresh`.
#[option(
default = "false",
value_type = "bool",
@ -1065,7 +1066,8 @@ pub struct PipOptions {
"#
)]
pub reinstall: Option<bool>,
/// Reinstall a specific package, regardless of whether it's already installed.
/// Reinstall a specific package, regardless of whether it's already installed. Implies
/// `refresh-package`.
#[option(
default = "[]",
value_type = "list[str]",