injectable
injectable copied to clipboard
Add support for autowiring with Annotated
What does this PR do?
This PR adds the feature addressed at issue https://github.com/roo-oliv/injectable/issues/108
Context
I use injectable in production but when using a static type checker (mypy in our case) the Autowiring(T) type is not detected by mypy. This PR lets inject dependencies in the style proposted in the accepted solution of the aforementioned issue.
@autowired
def foo(service: Autowired(Service)): ...
@autowired
def foo(service: Annotated[Autowired(Service), foo, bar]): ...
@autowired
def foo(service: Annotated[foo, Autowired(Service), bar]): ...