Skip to content

Commit 3858cef

Browse files
committed
Merge branch 'release/4.40.0' into master
2 parents 4188f72 + 8cf8682 commit 3858cef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+19480
-15152
lines changed

LICENSE.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2021, Roman Mogylatov
1+
Copyright (c) 2022, Roman Mogylatov
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

README.rst

+21-22
Original file line numberDiff line numberDiff line change
@@ -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

5353
Key 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

123123
You 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
126126
with 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

191190
Frequently 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

197196
Why 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

205204
What 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

210209
Have a question?
211210
- Open a `Github Issue <https://github.com/ets-labs/python-dependency-injector/issues>`_

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
# General information about the project.
5454
project = "Dependency Injector"
55-
copyright = "2021, Roman Mogylatov"
55+
copyright = "2022, Roman Mogylatov"
5656
author = "Roman Mogylatov"
5757

5858
# The version info for the project you"re documenting, acts as replacement for

docs/index.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,23 @@ It helps implementing the dependency injection principle.
6565
Key features of the ``Dependency Injector``:
6666

6767
- **Providers**. Provides ``Factory``, ``Singleton``, ``Callable``, ``Coroutine``, ``Object``,
68-
``List``, ``Dict``, ``Configuration``, ``Resource``, ``Dependency`` and ``Selector`` providers
69-
that help assembling your objects. See :ref:`providers`.
68+
``List``, ``Dict``, ``Configuration``, ``Resource``, ``Dependency``, and ``Selector`` providers
69+
that help assemble your objects. See :ref:`providers`.
7070
- **Overriding**. Can override any provider by another provider on the fly. This helps in testing
71-
and configuring dev / stage environment to replace API clients with stubs etc. See
71+
and configuring dev/stage environment to replace API clients with stubs etc. See
7272
:ref:`provider-overriding`.
73-
- **Configuration**. Reads configuration from ``yaml`` & ``ini`` files, ``pydantic`` settings,
73+
- **Configuration**. Reads configuration from ``yaml``, ``ini``, and ``json`` files, ``pydantic`` settings,
7474
environment variables, and dictionaries. See :ref:`configuration-provider`.
7575
- **Resources**. Helps with initialization and configuring of logging, event loop, thread
7676
or process pool, etc. Can be used for per-function execution scope in tandem with wiring.
7777
See :ref:`resource-provider`.
7878
- **Containers**. Provides declarative and dynamic containers. See :ref:`containers`.
79-
- **Wiring**. Injects dependencies into functions and methods. Helps integrating with
79+
- **Wiring**. Injects dependencies into functions and methods. Helps integrate with
8080
other frameworks: Django, Flask, Aiohttp, Sanic, FastAPI, etc. See :ref:`wiring`.
8181
- **Asynchronous**. Supports asynchronous injections. See :ref:`async-injections`.
8282
- **Typing**. Provides typing stubs, ``mypy``-friendly. See :ref:`provider-typing`.
8383
- **Performance**. Fast. Written in ``Cython``.
84-
- **Maturity**. Mature and production-ready. Well-tested, documented and supported.
84+
- **Maturity**. Mature and production-ready. Well-tested, documented, and supported.
8585

8686
.. code-block:: python
8787
@@ -106,7 +106,7 @@ Key features of the ``Dependency Injector``:
106106
107107
108108
@inject
109-
def main(service: Service = Provide[Container.service]):
109+
def main(service: Service = Provide[Container.service]) -> None:
110110
...
111111
112112
@@ -121,9 +121,9 @@ Key features of the ``Dependency Injector``:
121121
with container.api_client.override(mock.Mock()):
122122
main() # <-- overridden dependency is injected automatically
123123
124-
With the ``Dependency Injector`` objects assembling is consolidated in the container.
124+
With the ``Dependency Injector``, object assembling is consolidated in the container.
125125
Dependency injections are defined explicitly.
126-
This makes easier to understand and change how application works.
126+
This makes it easier to understand and change how the application works.
127127

128128
.. figure:: https://raw.githubusercontent.com/wiki/ets-labs/python-dependency-injector/img/di-readme.svg
129129
:target: https://github.com/ets-labs/python-dependency-injector

0 commit comments

Comments
 (0)