Open kmitjpaul opened 1 year ago
I'm running into something similar with the decoupled packages example.
I added the following to my main container and am manually wiring.
def _recursive_wire(container: containers.Container):
for provider in container.traverse(types=[providers.Container]):
_recursive_wire(provider.container)
provider.wire()
class AppContainer:
recursive_wire = providers.Callable(_recursive_wire, container=__self__)
Hi having trouble with the Dependency Injector's
multiple containers
functionality please check this documentation segment: https://python-dependency-injector.ets-labs.org/examples/application-multiple-containers.html#main-moduleWhat it proposes to do is to use the whole chain of containers names
Application.services.user
not justServices
. UsingApplication.services.user
does not make any sense, why would functionmain()
need to know about whole application structure? What if I want to test that function separately outside of "Application"?This is not exactly an
issue
, more of me needing an explanation, because it looks like this defeats the whole purpose of Inversion of dependenciesThe only solution that comes to mind is to create a list
[UserService, AuthService, PhotoService]
and wire them all in a loop.