mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-05-23 23:09:14 +03:00
Update providers index page
This commit is contained in:
parent
7bdf57da9c
commit
580b31ba13
|
@ -3,18 +3,32 @@
|
||||||
Providers
|
Providers
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Providers help you to define how objects are created. They manage objects lifetime and their
|
Providers help to assemble the objects. They create objects and inject the dependencies.
|
||||||
dependencies.
|
|
||||||
|
|
||||||
Each provider is a callable. You call the provider like a function when you need to create an
|
Each provider is a callable. You call the provider like a function when you need to create an
|
||||||
object or call a function. Provider calls all dependent providers to retrieve the dependencies
|
object. Provider retrieves the underlying dependencies and inject them into the created object.
|
||||||
and injects them.
|
It causes the cascade effect that helps to assemble object graphs.
|
||||||
|
|
||||||
Any of the providers can be overridden by another provider. When provider is overridden it calls
|
.. code-block:: bash
|
||||||
to the overriding provider. This helps in testing or overriding API clients with stubs for dev or
|
|
||||||
stage environment.
|
|
||||||
|
|
||||||
Providers package API docs - :py:mod:`dependency_injector.providers`
|
provider1()
|
||||||
|
│
|
||||||
|
├──> provider2()
|
||||||
|
│
|
||||||
|
├──> provider3()
|
||||||
|
│ │
|
||||||
|
│ └──> provider4()
|
||||||
|
│
|
||||||
|
└──> provider5()
|
||||||
|
│
|
||||||
|
└──> provider6()
|
||||||
|
|
||||||
|
Another providers feature is an overriding. Any of the providers can be overridden by another
|
||||||
|
provider. When provider is overridden it calls to the overriding provider instead of providing
|
||||||
|
the object by its own. This helps in testing. This also helps in overriding API clients with
|
||||||
|
stubs for the development or staging environment.
|
||||||
|
|
||||||
|
Providers module API docs - :py:mod:`dependency_injector.providers`
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user