pex-tool / pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs.
https://docs.pex-tool.org
Apache License 2.0
2.49k stars 254 forks source link

Fix `--exclude`. #2409

Closed jsirois closed 4 weeks ago

jsirois commented 1 month ago

Previously, --excludes were processed after all resolution was complete. Not only was this sub-optimal, incurring more resolution work (downloads, backtracks, etc.), but it also could lead to failed interactions (metadata extraction & wheel builds) with excluded distributions.

Fix this by plumbing --excludes all the way through the Pip resolve process. Additionally, fix the existing plumbing through the two other resolve processes: PEX repository resolution and lock file resolution.

Fixes #455 Fixes #2097

jsirois commented 1 month ago

This is on the big side, but it is broken up into functioning independent commits. Thanks in advance for your attention.

I will note this opens up --override since the deep --exclude plumbing already tricks Pip into following doctored requirements lists; it's just that the only doctoring right now is removal of requirements from the list and not editing of requirements in the list. No one has asked for this yet, so I'll save that for a follow up.

Filed #2425 to track --override.

jsirois commented 1 month ago

This should be all green now.

cc:@cognifloyd who inspired going a bit further and implementing deep excludes.