modern-python / that-depends

DI-framework, inspired by python-dependency-injector, but without wiring. Python 3.12 is supported
https://that-depends.readthedocs.io/
MIT License
133 stars 10 forks source link

'but without wiring' ? #25

Closed jasonprado closed 3 months ago

jasonprado commented 3 months ago

The description on this repo describes it as an alternative to pdi 'but without wiring'. What does that mean here? My understanding is that in pdi @inject and Provide are 'wiring'. Is that wrong?

lesnik512 commented 3 months ago

@jasonprado Hi, Jason) It means, that there is no need to do the following:

    container = Container()
    container.wire(modules=[__name__])

From the docs of PDI:

Wire the container with the markers in the code. Call container.wire() specifying modules and packages you would like to wire it with.

In this package there is no need in wire method, because container can only exist in one instance.

jasonprado commented 3 months ago

Oh got it. Thanks, that makes sense.