feat(pex): support building PEX archives to inherit from the sys.path #619
+32
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default PEX archives are built to operate fully hermetically, which is usually a good idea. However, sometimes it is necessary to use packages from the hosting environment. One such example is AWS Lambda; the recommended approach for using PEX to run on Lambda is to build in this way.1
Mapping of this flag through from the build system largely follows the equivalent feature in Pants.2
Changes are visible to end-users: yes
Test plan
//py/tests/py-pex-binary:print_modules_pex
to have an explicitinherit_path
of a chosen value (e.g. "prefer").bazel build //py/tests/py-pex-binary:print_modules_pex
.tar xfO bazel-bin/py/tests/py-pex-binary/print_modules_pex.pex PEX-INFO | jq '.inherit_path'
"prefer"
.Do above except without passing an explicit
inherit_path
should give"false"
, which confirms the default semantics are preserved.Footnotes
https://github.com/pex-tool/lambdex/blob/main/MIGRATING.md ↩
https://www.pantsbuild.org/stable/reference/targets/pex_binary#inherit_path ↩