If we add an entry point in the Target API, that w...
# general
h
If we add an entry point in the Target API, that would be pretty easy for a codebase admin to do. The code would essentially be:
Copy code
class CustomPythonBinaryDependencies(Dependencies):
   exclude_transitively = ["bad_target"]

class CustomPythonBinary(Target):
  alias = "custom_python_binary"
  core_fields = (*(FrozenOrderedSet(PythonBinary.core_fields) - {Dependencies}), CustomPythonBinaryDependencies)
Then, anytime the BUILD file uses
custom_python_binary
, those hardcoded excluded targets would be ignored. Other than that, it behaves identically to a normal
python_binary
target. But that’s really really special-cased, and not at all obvious where that would fit into the docs. It also might not be generic enough. It requires you to put a list of hardcoded addresses in a target definition, rather than being able to tweak in a decentralized way in a BUILD file.