Show yank warnings for pip install (#1253)

Closes https://github.com/astral-sh/puffin/issues/1252.
This commit is contained in:
Charlie Marsh 2024-02-05 09:15:44 -08:00 committed by GitHub
parent d090acf13d
commit 398659a9b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,6 +30,7 @@ use puffin_resolver::{
ResolutionGraph, ResolutionMode, Resolver,
};
use puffin_traits::{InFlight, SetupPyStrategy};
use pypi_types::Yanked;
use requirements_txt::EditableRequirement;
use crate::commands::reporters::{DownloadReporter, InstallReporter, ResolverReporter};
@ -525,6 +526,33 @@ async fn install(
})
.collect::<Vec<_>>();
// TODO(konstin): Also check the cache whether any cached or installed dist is already known to
// have been yanked, we currently don't show this message on the second run anymore
for dist in &remote {
let Some(file) = dist.file() else {
continue;
};
match &file.yanked {
None | Some(Yanked::Bool(false)) => {}
Some(Yanked::Bool(true)) => {
writeln!(
printer,
"{}{} {dist} is yanked.",
"warning".yellow().bold(),
":".bold(),
)?;
}
Some(Yanked::Reason(reason)) => {
writeln!(
printer,
"{}{} {dist} is yanked (reason: \"{reason}\").",
"warning".yellow().bold(),
":".bold(),
)?;
}
}
}
// Download, build, and unzip any missing distributions.
let wheels = if remote.is_empty() {
vec![]