Add pants source roots and a constant for pack common lib directory#5930
Merged
cognifloyd merged 3 commits intomasterfrom Mar 10, 2023
Merged
Add pants source roots and a constant for pack common lib directory#5930cognifloyd merged 3 commits intomasterfrom
cognifloyd merged 3 commits intomasterfrom
Conversation
nzlosh
approved these changes
Mar 10, 2023
rush-skills
approved these changes
Mar 10, 2023
17b5b03 to
c97aa6e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Background
This is another part of introducing pants, as discussed in various TSC meetings.
Related PRs can be found in:
Overview of this PR
I ran into an issue with dependency inference not understanding the "lib" directories. ST2 adds
<pack>/libto PYTHONPATH for both actions and sensors, and<pack>/actions/libto PYTHONPATH for actions. Pants uses "source roots" to manage the PYTHONPATH, so we need a way for pants to detect those source roots when needed. So, I adjusted the[source].root_patternssetting inpants.tomlto account for these lib dirs.While investigating this, I had to dive into the code that defines PYTHONPATH for running pack actions/sensors. I found the
"lib"string to be rather confusing as only some of them referred to our special common libs directory. So to clarify that code, I added aCOMMON_LIB_DIRconstant to clarify which lib is which (ie to distinguish it fromvirtualenv/libandvirtualenv/python*/lib). I also adjusted one other place that was not using the actionLIBS_DIRconstant like everything else that references<pack>/actions/lib.Pants documentation