-
-
Notifications
You must be signed in to change notification settings - Fork 337
Closed
Description
Hello. Thank you for building and maintaining awesome project.
FastAPI recently announced a new feature called Annotated. link
Currently, dependency-injector is not compatible with this feature. How about modify it to be compatible?
Like fastapi, wiring with Annotated can make several benefits like re-using, more compatibility with type checkers and so on.
See sample code following.
from typing import Annotated
from dependency_injector.containers import DeclarativeContainer
from dependency_injector.providers import Factory
from dependency_injector.wiring import inject
class Service:
...
class Container(DeclarativeContainer):
service = Factory(Service)
WiredService = Annotated[Service, Provide[Container.service]]
@inject
def to_be_injected(service: WiredService):
...
I already made it for using at my personal work.
If PR is welcome, I'll made PR with the code I've wrote and other work.
Viicos, rigma, Hushpar, vppuzakov, hyung1721 and 12 more
Metadata
Metadata
Assignees
Labels
No labels