A little weird request here, but is it possible to...
# general
h
A little weird request here, but is it possible to defer a dependency that a pex needs and instead get it from the system install?
e.g. I
pip install foo
at the system layer already so
my_app.pex
doesn't also need to include
foo
when building. But it needs to find the system's
foo
when running.
Hmm maybe
PEX_INHERIT_PATH
is what I want
e
That's 1/2 the solution, but the PEX will still suffer the bloat of a copy of the dep. Solving that is tracked here: https://github.com/pantsbuild/pex/issues/2097
h
I already have it manually excluded in the build file, so I think I'm covered there.
e
Nope
Pex does not do partial resolves. It will fill in any holes to form a transitive closure over the root requirements.
h
Interesting. I definitely get different results when I add
"!!//:reqs#apache-flink"
to the
pex_binary
target. I see it not showing up in the built package
e
So, a Pants level exclude only works if the excluded thing is not a transitive dep.
It won't work in the general case as such; so you're getting lucky right now.
Since you're excluding at the pants level it probably makes sense to seal inherit path into the PEX: https://www.pantsbuild.org/docs/reference-pex_binary#codeinherit_pathcode
I.E. That seals knowledge the PEX is broken as it stands into the PEX itself instead of needing to know that more explicitly and then use an env var in the deployment environment.
YMMV
b
This is something we want to support in pants better. If you don't find an existing issue please file one