diff --git a/crates/distribution-types/src/cached.rs b/crates/distribution-types/src/cached.rs index b45f5e49a..f0e4a0ed6 100644 --- a/crates/distribution-types/src/cached.rs +++ b/crates/distribution-types/src/cached.rs @@ -110,6 +110,13 @@ impl CachedDist { CachedDist::Url(dist) => dist.editable, } } + + pub fn filename(&self) -> &WheelFilename { + match self { + CachedDist::Registry(dist) => &dist.filename, + CachedDist::Url(dist) => &dist.filename, + } + } } impl CachedDirectUrlDist { diff --git a/crates/install-wheel-rs/src/wheel.rs b/crates/install-wheel-rs/src/wheel.rs index 8d4173f84..6edc50b18 100644 --- a/crates/install-wheel-rs/src/wheel.rs +++ b/crates/install-wheel-rs/src/wheel.rs @@ -394,17 +394,18 @@ pub(crate) fn parse_wheel_version(wheel_text: &str) -> Result<(), Error> { // {distribution}-{version}.dist-info/WHEEL is metadata about the archive itself in the same basic key: value format: let data = parse_key_value_file(&mut wheel_text.as_bytes(), "WHEEL")?; - let Some(wheel_version) = data.get("Wheel-Version").and_then(|wheel_versions| { - if let [wheel_version] = wheel_versions.as_slice() { - wheel_version.split_once('.') - } else { - None - } - }) else { - return Err(Error::InvalidWheel( - "Invalid Wheel-Version in WHEEL file".to_string(), - )); - }; + // mkl_fft-1.3.6-58-cp310-cp310-manylinux2014_x86_64.whl has multiple Wheel-Version entries, we have to ignore that + // like pip + let wheel_version = data + .get("Wheel-Version") + .and_then(|wheel_versions| wheel_versions.first()); + let wheel_version = wheel_version + .and_then(|wheel_version| wheel_version.split_once('.')) + .ok_or_else(|| { + Error::InvalidWheel(format!( + "Invalid Wheel-Version in WHEEL file: {wheel_version:?}" + )) + })?; // pip has some test wheels that use that ancient version, // and technically we only need to check that the version is not higher if wheel_version == ("0", "1") { diff --git a/crates/puffin-dev/src/install_many.rs b/crates/puffin-dev/src/install_many.rs index 5297b567d..bacafab88 100644 --- a/crates/puffin-dev/src/install_many.rs +++ b/crates/puffin-dev/src/install_many.rs @@ -71,7 +71,7 @@ pub(crate) async fn install_many(args: InstallManyArgs) -> Result<()> { for (idx, requirements) in requirements.chunks(100).enumerate() { info!("Chunk {idx}"); - install_chunk( + if let Err(err) = install_chunk( requirements, &build_dispatch, tags, @@ -79,7 +79,13 @@ pub(crate) async fn install_many(args: InstallManyArgs) -> Result<()> { &venv, &index_urls, ) - .await?; + .await + { + eprintln!("💥 Chunk {idx} failed"); + for cause in err.chain() { + eprintln!(" Caused by: {cause}"); + } + } } Ok(()) @@ -102,7 +108,9 @@ async fn install_chunk( for failure in &failures { info!("Failed to find wheel: {failure}"); } - info!("Failed to find {} wheel(s)", failures.len()); + if !failures.is_empty() { + info!("Failed to find {} wheel(s)", failures.len()); + } let wheels_and_source_dist = resolution.len(); let resolution = if build_dispatch.no_build() { let only_wheels: FxHashMap<_, _> = resolution @@ -150,7 +158,9 @@ async fn install_chunk( for failure in &failures { info!("Failed to fetch wheel: {failure}"); } - info!("Failed to fetch {} wheel(s)", failures.len()); + if !failures.is_empty() { + info!("Failed to fetch {} wheel(s)", failures.len()); + } let wheels: Vec<_> = wheels.into_iter().chain(cached).collect(); puffin_installer::Installer::new(venv) diff --git a/crates/puffin-installer/src/downloader.rs b/crates/puffin-installer/src/downloader.rs index 32c1720be..061f75040 100644 --- a/crates/puffin-installer/src/downloader.rs +++ b/crates/puffin-installer/src/downloader.rs @@ -152,7 +152,7 @@ impl<'a, Context: BuildContext + Send + Sync> Downloader<'a, Context> { } /// Download, build, and unzip a single wheel. - #[instrument(skip_all, fields(name = %dist, url = dist.file().unwrap().url))] + #[instrument(skip_all, fields(name = %dist, size = ?dist.size(), url = dist.file().unwrap().url))] pub async fn get_wheel( &self, dist: Dist, diff --git a/crates/puffin-installer/src/installer.rs b/crates/puffin-installer/src/installer.rs index 3ac49a0d1..314524a92 100644 --- a/crates/puffin-installer/src/installer.rs +++ b/crates/puffin-installer/src/installer.rs @@ -55,7 +55,7 @@ impl<'a> Installer<'a> { .as_ref(), self.link_mode, ) - .with_context(|| format!("Failed to install: {wheel}"))?; + .with_context(|| format!("Failed to install: {} ({wheel})", wheel.filename()))?; if let Some(reporter) = self.reporter.as_ref() { reporter.on_install_progress(wheel); diff --git a/scripts/popular_packages/download.sh b/scripts/popular_packages/download.sh new file mode 100755 index 000000000..6cac1c6e9 --- /dev/null +++ b/scripts/popular_packages/download.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +curl https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.min.json | jq -r ".rows | .[].project" > pypi_8k_downloads.txt +curl https://gist.githubusercontent.com/charliermarsh/07afd9f543dfea68408a4a42cede4be4/raw/6639cd58a2e10d6bb7821f891f00322c8630b60a/pypi_10k_most_dependents.txt > pypi_10k_most_dependents.txt diff --git a/scripts/popular_packages/pypi_8k_downloads.sh b/scripts/popular_packages/pypi_8k_downloads.sh deleted file mode 100755 index bb5a2b605..000000000 --- a/scripts/popular_packages/pypi_8k_downloads.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -curl https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.min.json | jq -r ".rows | .[].project" > pypi_8k_downloads.txt -