mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 17:47:02 +03:00
47c79b2772
* Add prototype * Add example * Remove typing erros in Python 2.7 and 3.4 * Move resources example * Draft resources docs * Update resources docs * Fix repr * Rename dict provider test * Add more tests * Add tests + refactoring * Add more tests * Update tests to run only on 3.5+ * Update setup.py * Add typing tests * Update changelog * Fix generator iteration * Remove contextlib * Hotfix aiohttp issue * Move aiohttp fix to tox.ini * Move aiohttp fix to a different place in tox
42 lines
1.8 KiB
ReStructuredText
42 lines
1.8 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. 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, 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::
|