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

Omit wheels from lockfile based on --exclude-newer #12299

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Mar 18, 2025

Summary

We respect --exclude-newer during resolution, but we weren't applying it to individual files when writing the lockfile. As a result, if wheels were added to a distribution after its initial release, we'd end up including them in the lockfile, even if they were uploaded after the --exclude-newer date.

Closes #12296.

@charliermarsh charliermarsh added the bug Something isn't working label Mar 18, 2025
@charliermarsh charliermarsh marked this pull request as ready for review March 18, 2025 19:28
@zanieb
Copy link
Member

zanieb commented Mar 18, 2025

Is there going to be a user-facing consequence here for people with --locked?

@charliermarsh
Copy link
Member Author

No.

@charliermarsh charliermarsh force-pushed the charlie/exc branch 2 times, most recently from f637ee8 to 082065c Compare March 18, 2025 20:07
@charliermarsh
Copy link
Member Author

There's a panic in the benchmark script setup that looks real.

@charliermarsh charliermarsh force-pushed the charlie/exc branch 6 times, most recently from 04ec269 to 8a825af Compare March 18, 2025 20:29
@charliermarsh
Copy link
Member Author

As a reminder (partly for myself), I think the reason we don't filter these out entirely (which would be way simpler) is because we want to be able to show them in error messages (i.e., we want to be able to say "There were wheels, but they were too new").

@@ -145,7 +145,7 @@ mod resolver {
let concurrency = Concurrency::default();
let config_settings = ConfigSettings::default();
let exclude_newer = Some(
jiff::civil::date(2024, 8, 8)
jiff::civil::date(2024, 9, 1)
Copy link
Member Author

Choose a reason for hiding this comment

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

This depends on https://pypi.org/project/methodtools/0.4.7/#files, which added a wheel on August 23, 2024. So we can bump this to avoid building it from source.

Copy link

codspeed-hq bot commented Mar 18, 2025

CodSpeed Performance Report

Merging #12299 will improve performances by 20.51%

Comparing charlie/exc (0964b22) with main (a95f4cf)

Summary

⚡ 1 improvements
✅ 13 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
resolve_warm_airflow 702.2 ms 582.7 ms +20.51%

@zanieb
Copy link
Member

zanieb commented Mar 19, 2025

The benchmark change is pretty funny. I'll review this tomorrow, thanks for the quick turnaround.

@zanieb zanieb closed this Mar 19, 2025
@zanieb zanieb reopened this Mar 19, 2025
@zanieb
Copy link
Member

zanieb commented Mar 19, 2025

(oops)

@konstin
Copy link
Member

konstin commented Mar 19, 2025

I can reproduce a speedup in the right range by bumping the cutoff date:

Benchmark 1: uv pip compile --exclude-newer 2024-08-08 a.txt
  Time (mean ± σ):      92.2 ms ±   2.2 ms    [User: 100.6 ms, System: 108.0 ms]
  Range (min … max):    87.9 ms …  96.7 ms    32 runs
 
Benchmark 2: uv pip compile --exclude-newer 2024-09-01 a.txt
  Time (mean ± σ):      80.5 ms ±   4.5 ms    [User: 83.2 ms, System: 102.8 ms]
  Range (min … max):    74.2 ms …  97.3 ms    39 runs

Comment on lines +650 to +652
pub fn is_excluded(&self) -> bool {
matches!(self, Self::Incompatible(IncompatibleWheel::ExcludeNewer(_)))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to not consider all Incompatible() instances "excluded"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wheels in lockfile are not filtered by exclude-newer
4 participants