aloof-angle-91616
06/16/2018, 12:24 AMdef replace_rule(self, old_rule_object, new_rule_object) method to BuildConfiguration and exposing that in register.py. it seems as an initial api that requiring the exact rule you want to replace as a definition is least error-prone, and it allows e.g. a contrib module or plugin to specialize a default rule for some product provided by core pants or another plugin without requiring any work on the part of the default rule implementor. rules are stored as a list in BuildConfiguration so this is a dead-simple method to write and test (self.rules = [for r in self.rules if r != old_rule] + [new_rule] (i wouldn't write that in real code)). further work could include making sure the new rule matches the same types, more general rule graph queries/mutations, but right now this seems like it can cleanly be done in ~5 lines (more in the docstring) in BuildConfiguration and also happens to make moving the native backend into contrib trivial (override the rule providing a SetupPyInvocationEnvironment).