-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
specify (interpreter-constraint) x (platform), and pass --python-version to pip regardless of a local binary #1033
Comments
It would actually be very very nice if we could make the |
1st - to be clear - Pex and Pip are offering two unequal forms of resolving. I'll stick to Pex terminology but its a 1-1 map into Pip:
No.
Yes - specify the exact platform of that interpreter. IE: the most specific wheel tag it supports. I'll stop there since it may be the case that the preamble above clears up misconceptions about the role of PythonInterpreter vs Platform when resolving distributions. In short, PythonInterpreters and Platforms should form a disjoint set of DistributionTargets you're attempting to build the PEX for. |
After reading through all your stuff, I think your use of If I'm understanding the confusion correctly, maybe you could contribute an API doc fix to clear things up for you? |
I think you have absolutely understood the confusion correctly and an API doc fix sounds just right. Would that be in the docstring for the
This is exactly the answer I was missing earlier! I think that the two methods of resolution you specified map directly onto the operations I was thinking of. Thanks so much for your extremely thorough response! |
I think so, yes. You're the API reader here though so you know better where the words should go and what the words should have been, |
Great! I will think about what would seem most effective! |
…s in the library API and CLI (#1047) @jsirois read my mind in #1033 (comment) after I asked why Pex couldn't resolve for an interpreter it doesn't have locally. This was in fact already possible, and he suggested a documentation fix to make it more clear. These changes make it clear that: - `platform{,s}` takes precedence over `interpreter{,s}` when resolving wheels - `interpreter{,s}` are used to seed `platform{,s}` if not provided - matching `interpreter{,s}` must be provided for all `platform{,s}` if any distributions need to be built from source Closes #1033.
When i run
pex.resolver.resolve_multi()
, it asks for bothinterpreters
andplatforms
separately. A few questions:PythonInterpreter
without actually having a matching interpreter binary on the local disk?PythonInterpreter
to only local files as per (1), why wouldn't theplatform
argument be something we could infer from the interpreter binary path? It looks likePythonInterpreter
has thissupported_platforms
property. Is there a reason we wouldn't just use that, instead of having to spread that information over a separateplatforms
kwarg toresolve_multi()
?It seems like
(interpreter-constraint) x (platform)
are the axes that pip actually uses to resolve, and I'm wondering why we specify those separately, and why we require an interpreter necessarily on the local disk. One alternative might be:If this was to be entertained, it seems that it could subsume the functionality of the existing
resolve()
method entirely (translatinginterpreters
andplatforms
to a list ofMatchingInterpreter
s), and therefore could avoid breaking any existing users of the pex library API at all (while closing #969).We would have to figure out how to appropriately error when:
(interpreter-version) x (platform)
pair.However, I believe we already error out today in this case, if we request e.g.
linux_86_64-cp36-abi3
inplatforms
, and there are no prebuilt wheels available for that platform. So we should be able to extend or keep the same error message as before when things don't match up -- we would just be adding a new failure state (which just errors out much earlier today, at interpreter selection time), by allowing the user to resolve for interpreters they don't have on their system.Regarding the Pex CLI, I believe we could consider an
--explicit-python-version
option corresponding to the first argument ofMatchingInterpreter(...)
, aka:> pex --explicit-python-version CPython==3.6.11 ...
This flag would be mutually exclusive with both
--python
and--interpreter-constraints
, but could be applied multiple times to resolve for multiple explicit interpreter versions.The text was updated successfully, but these errors were encountered: