Skip to content

Add support for protocols #3

@maldoinc

Description

@maldoinc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions