-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Check for --complete-platforms match when --resolve-local-platforms #1991
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @huonw.
I'm not fully convinced, but I think subset is the right choice still. The only reason to use --resolve-local-platforms
at all is to make more resolves succeed by bringing sdists in play. If you want an "optimal" resolve and you have an environment that matches the target host, then you don't use --platform
or --complete-patform
, you just use --python
to say this exact one right here - we have our ducks in a row and this matches production.
Maybe Pants does need to grow knobs as I think you suggested in another thread. Right now it tries to do the right thing with 0 knobs for the lambda case.
pex/resolve/target_configuration.py
Outdated
@@ -156,6 +156,25 @@ def resolve_targets(self): | |||
) | |||
if resolved_platforms: | |||
for resolved_platform in resolved_platforms: | |||
# if there was an explicit complete platform specified, only use the | |||
# local interpreter if it exactly matches, or else incorrect wheels may |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This language is not correct, I think, whichever way the subset vs exact match decision goes. At least it contradicts the PyPA thinking. In that thinking, if a tag matches, a wheel is compatible. Period. Calling one of those matches incorrect takes some extra explaining / opining. There is a built in concept of ~"better" match since the tags have a ranked ordering, but that still doesn't seem to be captured by "incorrect".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks, I see what you mean: if the comment still applies after I switch to doing a subset computation, I'll reword it to something like "wheels with less preferred tags" to match the language of PEP 425.
Ah, okay, and correspondingly, one can avoid using a "suboptimal" resolve due to a more limited local platform by not passing I think that makes sense, I'll switch to doing a subset check. I'm not sure of the exact check, but I suspect:
Does that sound correct? Thanks! |
I think you've got that all right @huonw. |
I've made that update, added a test, and also realised that the previous approach was fundamentally broken (I think an interpreter needs to actually be rejected if any of its intersecting platforms are incompatible, while the previous version continued to accepted it). |
I won't have time to dive deep until later, but Pex supports Python 2.7 still, so watch that syntax. |
No worries. Thanks for the 2.7 tip, I'll fix up the various errors (tomorrow, probably). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @huonw - this looks good. I'll merge and get this out in a release shortly. You should be able to configure the version
and known_versions
[pex-cli]
subsystem options in your Pants config to then be up and running with this at that point.
Woohoo, thank you! |
This makes --resolve-local-platforms work better with --complete-platforms: if there's an external complete platform specified for a platform that matches a local interpreter, the local interpreter's complete platform is checked against that external complete platform. If the local interpreter supports any additional tags, the local interpreter is not used.
If the local interpreter/environment is newer (supports more tags), the old behaviour would risk including wheels that aren't compatible with the external complete platform. That is, execution will fail, see pantsbuild/pants#17621 for an example.
Fixes #1899