hundreds-father-404
08/19/2020, 10:10 PM!
to the dependencies
field as a way to ignore dependencies from a target. The simplest thing to do would be to write a macro (https://www.pantsbuild.org/v2.0/docs/macros) like custom_python_binary
and have it always add '!//:tensorflow'
to the dependencies
field.
—
or transitive dependenciesThis is a little trickier. In Pants, creating a custom target type and/or using a macro would only influence the direct dependencies for that target. That is, it would only help to avoid this case:
python_binary(
dependencies=["bad_dep"]
)
Not this case:
python_library(
name="util",
dependencies=["bad_dep"],
)
python_binary(
dependencies=[":util"],
)
--
But, you could use the Rules API to essentially fork the builtin binary
implementation. You could do something like check “If the target is a custom_python_binary
, then no matter what exclude tensorflow; otherwise, use dependencies like normal.”
You’d use the builtin rules for everything else like test
, and swap in your rules that you forked.
It sounds like correctly handling transitive deps is important too, right?