@@ -48,34 +48,34 @@ What is ``Dependency Injector``?
4848
4949``Dependency Injector `` is a dependency injection framework for Python.
5050
51- It helps implementing the dependency injection principle.
51+ It helps implement the dependency injection principle.
5252
5353Key features of the ``Dependency Injector ``:
5454
5555- **Providers **. Provides ``Factory ``, ``Singleton ``, ``Callable ``, ``Coroutine ``, ``Object ``,
56- ``List ``, ``Dict ``, ``Configuration ``, ``Resource ``, ``Dependency `` and ``Selector `` providers
57- that help assembling your objects.
56+ ``List ``, ``Dict ``, ``Configuration ``, ``Resource ``, ``Dependency ``, and ``Selector `` providers
57+ that help assemble your objects.
5858 See `Providers <https://python-dependency-injector.ets-labs.org/providers/index.html >`_.
5959- **Overriding **. Can override any provider by another provider on the fly. This helps in testing
60- and configuring dev / stage environment to replace API clients with stubs etc. See
60+ and configuring dev/ stage environment to replace API clients with stubs etc. See
6161 `Provider overriding <https://python-dependency-injector.ets-labs.org/providers/overriding.html >`_.
62- - **Configuration **. Reads configuration from ``yaml `` & ``ini `` files, ``pydantic `` settings,
62+ - **Configuration **. Reads configuration from ``yaml ``, ``ini ``, and `` json `` files, ``pydantic `` settings,
6363 environment variables, and dictionaries.
6464 See `Configuration provider <https://python-dependency-injector.ets-labs.org/providers/configuration.html >`_.
65- - **Containers **. Provides declarative and dynamic containers.
66- See `Containers <https://python-dependency-injector.ets-labs.org/containers/index.html >`_.
6765- **Resources **. Helps with initialization and configuring of logging, event loop, thread
6866 or process pool, etc. Can be used for per-function execution scope in tandem with wiring.
6967 See `Resource provider <https://python-dependency-injector.ets-labs.org/providers/resource.html >`_.
70- - **Wiring **. Injects dependencies into functions and methods. Helps integrating with
68+ - **Containers **. Provides declarative and dynamic containers.
69+ See `Containers <https://python-dependency-injector.ets-labs.org/containers/index.html >`_.
70+ - **Wiring **. Injects dependencies into functions and methods. Helps integrate with
7171 other frameworks: Django, Flask, Aiohttp, Sanic, FastAPI, etc.
7272 See `Wiring <https://python-dependency-injector.ets-labs.org/wiring.html >`_.
7373- **Asynchronous **. Supports asynchronous injections.
7474 See `Asynchronous injections <https://python-dependency-injector.ets-labs.org/providers/async.html >`_.
7575- **Typing **. Provides typing stubs, ``mypy ``-friendly.
7676 See `Typing and mypy <https://python-dependency-injector.ets-labs.org/providers/typing_mypy.html >`_.
7777- **Performance **. Fast. Written in ``Cython ``.
78- - **Maturity **. Mature and production-ready. Well-tested, documented and supported.
78+ - **Maturity **. Mature and production-ready. Well-tested, documented, and supported.
7979
8080.. code-block :: python
8181
@@ -100,7 +100,7 @@ Key features of the ``Dependency Injector``:
100100
101101
102102 @inject
103- def main (service : Service = Provide[Container.service]):
103+ def main (service : Service = Provide[Container.service]) -> None :
104104 ...
105105
106106
@@ -115,19 +115,18 @@ Key features of the ``Dependency Injector``:
115115 with container.api_client.override(mock.Mock()):
116116 main() # <-- overridden dependency is injected automatically
117117
118- When you call ``main() `` function the ``Service `` dependency is assembled and injected automatically.
118+ When you call the ``main() `` function the ``Service `` dependency is assembled and injected automatically.
119119
120- When doing a testing you call the ``container.api_client.override() `` to replace the real API
121- client with a mock. When you call ``main() `` the mock is injected.
120+ When you do testing, you call the ``container.api_client.override() `` method to replace the real API
121+ client with a mock. When you call ``main() ``, the mock is injected.
122122
123123You can override any provider with another provider.
124124
125- It also helps you in configuring project for the different environments: replace an API client
125+ It also helps you in a re- configuring project for different environments: replace an API client
126126with a stub on the dev or stage.
127127
128- With the ``Dependency Injector `` objects assembling is consolidated in the container.
129- Dependency injections are defined explicitly.
130- This makes easier to understand and change how application works.
128+ With the ``Dependency Injector ``, object assembling is consolidated in a container. Dependency injections are defined explicitly.
129+ This makes it easier to understand and change how an application works.
131130
132131.. figure :: https://raw.githubusercontent.com/wiki/ets-labs/python-dependency-injector/img/di-readme.svg
133132 :target: https://github.com/ets-labs/python-dependency-injector
@@ -185,27 +184,27 @@ The framework stands on the `PEP20 (The Zen of Python) <https://www.python.org/d
185184
186185 You need to specify how to assemble and where to inject the dependencies explicitly.
187186
188- The power of the framework is in a simplicity.
187+ The power of the framework is in its simplicity.
189188``Dependency Injector `` is a simple tool for the powerful concept.
190189
191190Frequently asked questions
192191--------------------------
193192
194- What is the dependency injection?
193+ What is dependency injection?
195194 - dependency injection is a principle that decreases coupling and increases cohesion
196195
197196Why should I do the dependency injection?
198197 - your code becomes more flexible, testable, and clear 😎
199198
200- How do I start doing the dependency injection?
199+ How do I start applying the dependency injection?
201200 - you start writing the code following the dependency injection principle
202201 - you register all of your application components and their dependencies in the container
203202 - when you need a component, you specify where to inject it or get it from the container
204203
205204What price do I pay and what do I get?
206205 - you need to explicitly specify the dependencies
207- - it will be an extra work in the beginning
208- - it will payoff as the project grows
206+ - it will be extra work in the beginning
207+ - it will payoff as project grows
209208
210209Have a question?
211210 - Open a `Github Issue <https://github.com/ets-labs/python-dependency-injector/issues >`_
0 commit comments