-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
Allow constraining the interpreter search path directly. #1012
Comments
Echoing a comment from the other ticket: Pants' option for this is: https://github.com/pantsbuild/pants/blob/e328b58af917440dc98c8aa88dbd49a9355c5e8d/src/python/pants/python/python_setup.py#L87-L99, which is implemented here: |
OK - Lies above. Both buildtime and runtime support PEX_PYTHON_PATH which is a path-like env var that accepts both directory entries and paths to interpreter binaries:
This fully suffices for the Pants motivating use case. It still may make sense to add a CLI flag / PexInfo metadata slot for this to bake in a "corporate" interpreter path without resorting to ~/.pexrc or /etc/pexrc, but that resort has been working? for Twitter at least as an example of corporate. |
…a PEX (#1077) Closes #1012. Currently, PEX defaults to searching the $PATH when `--interpreter-constraint` and/or `--resolve-local-platforms` are used. (Otherwise, it uses the current interpreter or `--python`). You can specify `PEX_PYTHON_PATH`, but this has several issues: * Env vars should only be used for runtime, not build time. We break that separation here. * This only works if `PEX_IGNORE_RCFILES` is not set to true. Pants must set this option, meaning Pants cannot leverage this mechanism. * The behavior doesn't work as expected if running Pex as a Pex: #1075 Instead of further using `PEX_PYTHON_PATH`, we add a proper `--python-path` flag. In a followup, we can remove the `PEX_PYTHON_PATH` mechanism.
Right now the Pex API allows this:
https://github.com/pantsbuild/pex/blob/b51b340bea8a585a246997071a815d008986d6e3/pex/interpreter.py#L278-L288
Neither the CLI (buildtime) nor runtime via PEX-INFO / ENV vars does however forcing manipulation of the PATH to acheive the desired effect. This is problematic at buildtime since during wheel building tools may need to be invoked by subprocesses (think gcc). This could also be problematic at runtime for any PEX housing user code that needs to shell out to tools expected to be on the PATH.
See pantsbuild/pants#9760 for the motivating issue.
The text was updated successfully, but these errors were encountered: