-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
This has been in my mind for some time so I decided to finally write it.
Would that be possible to specify the Injector instance that should be used to inject dependencies? I see it the following way
container = Injector([module])
...
@container.inject # or maybe @inject(container)
def do_something(a: Dependency):
...My motivation is that I have multiple python modules, each one configuring it's own dependencies so each module (in general) expects different instances of dependencies.
I know that the proposed solution requires a variable container to be defined at interpretation time but not always is that undesireable. What do you think?
My workaround currently is calling container.get but I don't really like it.
Or is there something I don't understand about how injector works and inject chooses "the most local" container?
Metadata
Metadata
Assignees
Labels
No labels