Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Simplify _should_build #13232

Merged
merged 4 commits into from
Mar 1, 2025
Merged

Simplify _should_build #13232

merged 4 commits into from
Mar 1, 2025

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented Feb 23, 2025

This is a suite of simple commits to simplify _should_build, as the circumstances in which it is invoked have evolved over time.

Each individual commit explains the reasoning.

towards #11457

The only call sites are in pip install in pip wheel,
after resolution, so there are never constraint requirements there.
In pip wheel, we always want wheels, of course.
should_build_for_wheel_command was only called when is_wheel is False,
so the logging statement part of _should_build was never reached.
Since this is the only side effect and _should_build otherwise always return
true in these circumstances, it can be removed.
The need_wheel argument is now always False
@sbidoul sbidoul added skip news Does not need a NEWS file entry (eg: trivial changes) type: maintenance Related to Development and Maintenance Processes labels Feb 23, 2025
It is a remnant of the `setup.py install` era, and we can safely assume it is always set.
@sbidoul
Copy link
Member Author

sbidoul commented Feb 23, 2025

I think should_build_for_wheel_command became a no-op with #8843.

Copy link
Member

@ichard26 ichard26 left a comment

Choose a reason for hiding this comment

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

Skipping %s, due to already being wheel seems to be a relic of the past. Searching Google for exact matches (after the comma) since January 2020 only nets three results, which implies it's only from ancient versions of pip. This was the only change I was worried about since it looked like a potential user-facing logging change.

Constraint requirements are only persisted after resolution with the legacy resolver, and even then, they are filtered out by RequirementSet.

Thanks for simplifying this!

@ichard26
Copy link
Member

Also thank you for making this a breeze to review with the well explained commits! 🍃

@sbidoul
Copy link
Member Author

sbidoul commented Mar 1, 2025

legacy resolver

Ah, I had forgotten to check it. Thanks for spotting it.

I'd be surprised if the legacy resolver is not riddled with issues at this point, since we don't test it.

@sbidoul sbidoul merged commit ae2d221 into pypa:main Mar 1, 2025
31 checks passed
@sbidoul sbidoul deleted the ref-should-build branch March 1, 2025 13:50
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
skip news Does not need a NEWS file entry (eg: trivial changes) type: maintenance Related to Development and Maintenance Processes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants