You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Is that-depends possible to support inject almost everywhere without wiring? #39
I used to use dependency-injector(di) for inject config, complex obj or so on everywhere,
like described on their docs.
As I know, wiring is a key action which reads code and replace initial dummy obj (Provide(...)) to real one(injecting object) before run python process.
I also have experienced injecting from central Container instance made circular import error if i use container directly over related modules and that case only literal inject works supported by wiring.
Will that-depends provide similar usage covering this case without wiring?
In case of that-depends there is no wiring, so such thing won't work and I'm not sure that it's needed:
service: Service=Provide[Container.service]
You can just build dependency anywhere in you code like this
About circular import error: I personally think that circular import error should be resolved by refactoring code instead of hiding it by wiring of DI.
This is my use case of inject something directly. I could wrap it by something callable and inject it as args. But this is much simpler. So I applied this pattern when necessary.
Activity
lesnik512 commentedon Jun 21, 2024
Hello, @rumbarum
that-dependsthere is no wiring, so such thing won't work and I'm not sure that it's needed:You can just build dependency anywhere in you code like this
rumbarum commentedon Jun 21, 2024
@lesnik512
Thank you for your answer.
This is my use case of inject something directly. I could wrap it by something callable and inject it as args. But this is much simpler. So I applied this pattern when necessary.
Anyway, I will try review your package.