-
-
Notifications
You must be signed in to change notification settings - Fork 250
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
Path filter for PythonInterpreter.iter_candidates. #1046
Path filter for PythonInterpreter.iter_candidates. #1046
Conversation
with temporary_dir() as bin_dir: | ||
os.symlink(test_interpreter2, os.path.join(bin_dir, "jake")) | ||
|
||
# Verify path filtering happens before interpreter resolution, which os.path.realpaths |
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 is the use-case coming in a follow-up PR to close #1043. The PEX runtime needs to be able to filter by basename when PEX_PYTHON=python2
(for example) is in the environment. Today this is handled with dedicated code in pex_bootstrapper.py
that is a near duplicate of the relevant code in PythonInterpreter.iter_candidates
.
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.
Thank you, John!
InterpreterIdentificationJobError = Tuple[str, Union[Job.Error, Exception]] | ||
InterpreterOrJobError = Union["PythonInterpreter", InterpreterIdentificationJobError] |
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.
Excellent. Thank you.
This adds support for a path filter to allow unification of Pex buildtime and runtime interpreter discovery. The PythonInterpreter public API family of `iter`, `iter_candidates` and `all` is type-annotated and tests are added for `iter_candidates`. To support proper annotation of iter_candidates helpers, `@overload` support is added for Python 2.7. Work towards pex-tool#1043
5e50741
to
5ad317e
Compare
This adds support for a path filter to allow unification of Pex
buildtime and runtime interpreter discovery. The PythonInterpreter
public API family of
iter
,iter_candidates
andall
istype-annotated and tests are added for
iter_candidates
. To supportproper annotation of iter_candidates helpers,
@overload
support isadded for Python 2.7.
Work towards #1043