wireup
wireup copied to clipboard
Add support for protocols
Allow injection of types based on protocols. Services can declare themselves what protocol they support and the container can then perform autowiring based on that.
class SupportsFoo(Protocol):
def foo(self) -> str:
pass
@service(supports=SupportsFoo)
class FooBar:
def foo(self):
return "bar"
Requesting SupportsFoo will have FooBar injected.