Skip to content

Commit 06bc0f1

Browse files
committed
Merge branch 'release/3.39.0' into master
2 parents d16e881 + 5bb9d22 commit 06bc0f1

Some content is hidden

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

45 files changed

+704
-520
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/examples-other/index.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Other examples
2+
==============
3+
4+
.. meta::
5+
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control
6+
:description: Current section of documentation is designed to provide
7+
several example mini applications that are built on the top
8+
of inversion of control principle and powered by
9+
"Dependency Injector" framework.
10+
11+
Current section of documentation is designed to provide several example mini
12+
applications that are built according to the inversion of control principle
13+
and powered by *Dependency Injector* framework.
14+
15+
.. toctree::
16+
:maxdepth: 2
17+
18+
bundles_miniapp
19+
use_cases_miniapp
20+
password_hashing_miniapp
21+
chained_factories
22+
factory_of_factories
File renamed without changes.
File renamed without changes.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
.. _application-multiple-containers:
2+
3+
Application example (multiple containers)
4+
=========================================
5+
6+
.. meta::
7+
:keywords: Python,Dependency Injection,Inversion of Control,Container,Example,Application,
8+
Framework,AWS,boto3,client
9+
:description: This example shows how you can create an application using multiple declarative
10+
containers. We build an example Python micro application following the dependency
11+
injection principle. It consists from several services with a domain logic that
12+
have dependencies on database & AWS S3.
13+
14+
This example shows how you can create an application using multiple declarative containers. Using
15+
multiple declarative containers is a good choice for a large application. For
16+
building a moderate or a small size application refer to :ref:`application-single-container`.
17+
18+
We build an example micro application following the dependency injection principle. It consists
19+
of several services with a domain logic. The services have dependencies on database & AWS S3.
20+
21+
.. image:: images/application.png
22+
:width: 100%
23+
:align: center
24+
25+
Start from the scratch or jump to the section:
26+
27+
.. contents::
28+
:local:
29+
:backlinks: none
30+
31+
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/application-multiple-containers>`_.
32+
33+
Application structure
34+
---------------------
35+
36+
Application consists of an ``example`` package, a configuration file and a ``requirements.txt``
37+
file.
38+
39+
.. code-block:: bash
40+
41+
./
42+
├── example/
43+
│ ├── __init__.py
44+
│ ├── __main__.py
45+
│ ├── containers.py
46+
│ └── services.py
47+
├── config.yml
48+
└── requirements.txt
49+
50+
Containers
51+
----------
52+
53+
Listing of the ``example/containers.py``:
54+
55+
.. literalinclude:: ../../examples/miniapps/application-multiple-containers/example/containers.py
56+
:language: python
57+
58+
Main module
59+
-----------
60+
61+
Listing of the ``example/__main__.py``:
62+
63+
.. literalinclude:: ../../examples/miniapps/application-multiple-containers/example/__main__.py
64+
:language: python
65+
66+
Services
67+
--------
68+
69+
Listing of the ``example/services.py``:
70+
71+
.. literalinclude:: ../../examples/miniapps/application-multiple-containers/example/services.py
72+
:language: python
73+
74+
Configuration
75+
-------------
76+
77+
Listing of the ``config.yml``:
78+
79+
.. literalinclude:: ../../examples/miniapps/application-multiple-containers/config.yml
80+
:language: yaml
81+
82+
Run the application
83+
-------------------
84+
85+
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/application-multiple-containers>`_.
86+
87+
.. disqus::
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
.. _application-single-container:
2+
3+
Application example (single container)
4+
======================================
5+
6+
.. meta::
7+
:keywords: Python,Dependency Injection,Inversion of Control,Container,Example,Application,
8+
Framework,AWS,boto3,client
9+
:description: This example shows how you can create an application using a single declarative
10+
container. We build an example Python micro application following the dependency
11+
injection principle. It consists from several services with a domain logic that
12+
have dependencies on database & AWS S3.
13+
14+
This example shows how you can create an application using a single declarative container. Using
15+
a single declarative container is a good choice for small or moderate size application. For
16+
building a large application refer to :ref:`application-multiple-containers`.
17+
18+
We build an example micro application following the dependency injection principle. It consists
19+
of several services with a domain logic. The services have dependencies on database & AWS S3.
20+
21+
.. image:: images/application.png
22+
:width: 100%
23+
:align: center
24+
25+
Start from the scratch or jump to the section:
26+
27+
.. contents::
28+
:local:
29+
:backlinks: none
30+
31+
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/application-single-container>`_.
32+
33+
Application structure
34+
---------------------
35+
36+
Application consists of an ``example`` package, several configuration files and a
37+
``requirements.txt`` file.
38+
39+
.. code-block:: bash
40+
41+
./
42+
├── example/
43+
│ ├── __init__.py
44+
│ ├── __main__.py
45+
│ ├── containers.py
46+
│ └── services.py
47+
├── config.ini
48+
├── logging.ini
49+
└── requirements.txt
50+
51+
Container
52+
---------
53+
54+
Listing of the ``example/containers.py``:
55+
56+
.. literalinclude:: ../../examples/miniapps/application-single-container/example/containers.py
57+
:language: python
58+
59+
Main module
60+
-----------
61+
62+
Listing of the ``example/__main__.py``:
63+
64+
.. literalinclude:: ../../examples/miniapps/application-single-container/example/__main__.py
65+
:language: python
66+
67+
Services
68+
--------
69+
70+
Listing of the ``example/services.py``:
71+
72+
.. literalinclude:: ../../examples/miniapps/application-single-container/example/services.py
73+
:language: python
74+
75+
Configuration
76+
-------------
77+
78+
Listing of the ``config.ini``:
79+
80+
.. literalinclude:: ../../examples/miniapps/application-single-container/config.ini
81+
:language: ini
82+
83+
Listing of the ``logging.ini``:
84+
85+
.. literalinclude:: ../../examples/miniapps/application-single-container/logging.ini
86+
:language: ini
87+
88+
Run the application
89+
-------------------
90+
91+
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/application-single-container>`_.
92+
93+
.. disqus::
65.6 KB
Loading

docs/examples/index.rst

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,15 @@ Examples
22
========
33

44
.. meta::
5-
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control
6-
:description: Current section of documentation is designed to provide
7-
several example mini applications that are built on the top
8-
of inversion of control principle and powered by
9-
"Dependency Injector" framework.
5+
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Example
6+
:description: Python dependency injection examples.
107

11-
Current section of documentation is designed to provide several example mini
12-
applications that are built according to the inversion of control principle
13-
and powered by *Dependency Injector* framework.
8+
Explore the examples to see the ``Dependency Injector`` in action.
149

1510
.. toctree::
1611
:maxdepth: 2
1712

18-
services_miniapp_v1
19-
services_miniapp_v2
20-
bundles_miniapp
21-
use_cases_miniapp
22-
password_hashing_miniapp
23-
chained_factories
24-
factory_of_factories
13+
application-single-container
14+
application-multiple-containers
15+
16+
.. disqus::

0 commit comments

Comments
 (0)