Hi all! Is it possible to exclude some transitive ...
# general
s
Hi all! Is it possible to exclude some transitive dependency from pex_binary?
b
Yes, albeit you need a plugin for this
s
You mean define my own plugin, register rules from the python backend and override some specific rule that collects pex transitive dependencies, right?
b
There's a generic plugin interface for adding/subtracting deps
I forget the name. InferredDepsRequest maybe?
s
InferDependenciesRequest
? How does it help? I want to build a pex without a pyspark, my pex itself doesn't depend on the requirement ":pyspark", so adding "!:pyspark" doesn't help. It depends on pyspark transitively so it includes it into the pex binary
I want my python source to depend on pyspark, but I don't want the pex to include pyspark
similar to
include_requirements
and
include_sources
, but I want more granularity
b
You could only match PEX binary targets, and use that request to exclude the deo (I believe it's applied transitively)
g
Have you tried excluding like
!!:pyspark
? This excludes transitive deps: https://www.pantsbuild.org/2.20/docs/using-pants/key-concepts/targets-and-build-files#dependencies-field
s
That might work, thanks!