mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-23 01:56:58 +03:00
ae3024588c
* Bump version to 4.3.9: FastAPI example * Reengineer wiring * Add @inject decorator * Add .workspace dir to gitignore * Add generic typing for @inject * Add type cast for @inject * Update movie lister example * Update cli application tutorial * Update demo example * Update wiring docs and examples * Update aiohttp example and tutorial * Update multiple containers example * Update single container example * Update decoupled packages example * Update django example * Update asyncio daemon example and tutorial * Update FastAPI example * Update flask example and tutorial * Update sanic example * Add wiring registry * Add new line to .gitignore * Add @inject to the test samples * Fix flake8 errors
43 lines
1.9 KiB
ReStructuredText
43 lines
1.9 KiB
ReStructuredText
.. _key-features:
|
|
|
|
Key features
|
|
------------
|
|
|
|
.. meta::
|
|
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control
|
|
:description: This article describes key features of the Dependency Injector
|
|
framework.
|
|
|
|
Key features of the ``Dependency Injector``:
|
|
|
|
- **Providers**. Provides ``Factory``, ``Singleton``, ``Callable``, ``Coroutine``, ``Object``,
|
|
``List``, ``Dict``, ``Configuration``, ``Resource``, ``Dependency`` and ``Selector`` providers
|
|
that help assembling your objects. See :ref:`providers`.
|
|
- **Overriding**. Can override any provider by another provider on the fly. This helps in testing
|
|
and configuring dev / stage environment to replace API clients with stubs etc. See
|
|
:ref:`provider-overriding`.
|
|
- **Configuration**. Reads configuration from ``yaml`` & ``ini`` files, environment variables
|
|
and dictionaries. See :ref:`configuration-provider`.
|
|
- **Resources**. Helps with initialization and configuring of logging, event loop, thread
|
|
or process pool, etc. Can be used for per-function execution scope in tandem with wiring.
|
|
See :ref:`resource-provider`.
|
|
- **Containers**. Provides declarative and dynamic containers. See :ref:`containers`.
|
|
- **Wiring**. Injects dependencies into functions and methods. Helps integrating with
|
|
other frameworks: Django, Flask, Aiohttp, Sanic, FastAPI, etc. See :ref:`wiring`.
|
|
- **Typing**. Provides typing stubs, ``mypy``-friendly. See :ref:`provider-typing`.
|
|
- **Performance**. Fast. Written in ``Cython``.
|
|
- **Maturity**. Mature and production-ready. Well-tested, documented and supported.
|
|
|
|
The framework stands on the `PEP20 (The Zen of Python) <https://www.python.org/dev/peps/pep-0020/>`_ principle:
|
|
|
|
.. code-block:: plain
|
|
|
|
Explicit is better than implicit
|
|
|
|
You need to specify how to assemble and where to inject the dependencies explicitly.
|
|
|
|
The power of the framework is in a simplicity.
|
|
``Dependency Injector`` is a simple tool for the powerful concept.
|
|
|
|
.. disqus::
|