-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
narrow pex_binary files warning #18619
narrow pex_binary files warning #18619
Conversation
cd0414c
to
b326391
Compare
b326391
to
d5ebf31
Compare
This seems like yet another use case for "not traversing deps through build dependencies", as discussed in #18254 |
d5ebf31
to
a3cb6fe
Compare
a3cb6fe
to
c55abfe
Compare
Agreed. Not traversing package deps would prevent (possibly) duplicating the sources if |
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.
Nice
There is a helpful warning when using `pex_binary` and one or more of the transitive dependencies is a `files` target. However, that warning is overly broad, as there are situations when it is ok to have `files` targets. When a PEX depends on a packaged target, such as `python_distribution`, then any transitive `files` targets are irrelevant because pex just installs the wheel with whatever is included in it.
There is a helpful warning when using `pex_binary` and one or more of the transitive dependencies is a `files` target. However, that warning is overly broad, as there are situations when it is ok to have `files` targets. When a PEX depends on a packaged target, such as `python_distribution`, then any transitive `files` targets are irrelevant because pex just installs the wheel with whatever is included in it.
There is a helpful warning when using
pex_binary
and one or more of the transitive dependencies is afiles
target. However, that warning is overly broad, as there are situations when it is ok to havefiles
targets.When a PEX depends on a packaged target, such as
python_distribution
, then any transitivefiles
targets are irrelevant because pex just installs the wheel with whatever is included in it.Background
I am building a
pex_binary
that has explicit dependencies on a number ofpython_distribution
targets. Thispex_binary
hasentry_point=None
, because I am using it as a relocatable archived virtualenv. I setinclude_tools=True
so that I can take the pex file and runPEX_TOOLS=1 dist/st2.pex venv /opt/stackstorm/st2
to quickly install the entire virutalenv (which consists of the exact versions of deps locked in the resolve's lockfile). So, thefiles
warning was also irrelevant for me, because I'm not going to run any of the 1st party code from within the pex; it will be extracted as a venv before the 1st party code runs.While studying
pex_binary
, I found that theinclude_sources
option skips including the transitive sources. But, generated dependencies, such as the wheels generated bypython_distribution
still get included in the pex (becauseinclude_local_dists=True
is hard-coded forpex_binary
). Becauseinclude_sources
skips including the transitive sources, I figured this would be a clean/predictable way to avoid the warning and still build the packaged-virtualenv pex like I want.Note
I labeled this as
category:bugfix
because the warning was not accounting for the behavioral change that happens when using theinclude_sources
flag. But I can also see calling thiscategory:user api change
(it minimizes when you see the warning) orcategory:new feature
(it allows more uses ofpex_binary
without that warning).