Skip to content

Commit 46646b1

Browse files
committed
Merge branch 'release/4.45.0' into master
2 parents be7abb3 + 9f38db6 commit 46646b1

File tree

46 files changed

+513
-143
lines changed

Some content is hidden

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

46 files changed

+513
-143
lines changed

docs/main/changelog.rst

+15
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ that were made in every particular version.
77
From version 0.7.6 *Dependency Injector* framework strictly
88
follows `Semantic versioning`_
99

10+
4.45.0
11+
--------
12+
- Add Starlette lifespan handler implementation (`#683 <https://github.com/ets-labs/python-dependency-injector/pull/683>`_).
13+
- Raise exception in ``ThreadLocalSingleton`` instead of hiding it in finally (`#845 <https://github.com/ets-labs/python-dependency-injector/pull/845>`_).
14+
- Improve debuggability of ``deepcopy`` errors (`#839 <https://github.com/ets-labs/python-dependency-injector/pull/839>`_).
15+
- Update examples (`#838 <https://github.com/ets-labs/python-dependency-injector/pull/838>`_).
16+
- Upgrade testing dependencies (`#837 <https://github.com/ets-labs/python-dependency-injector/pull/837>`_).
17+
- Add minor fixes to the documentation (`#709 <https://github.com/ets-labs/python-dependency-injector/pull/709>`_).
18+
- Remove ``six`` from the dependencies (`3ba4704 <https://github.com/ets-labs/python-dependency-injector/commit/3ba4704bc1cb00310749fd2eda0c8221167c313c>`_).
19+
20+
Many thanks for the contributions to:
21+
- `ZipFile <https://github.com/ZipFile>`_
22+
- `František Trebuňa <https://github.com/gortibaldik>`_
23+
- `JC (Jonathan Chen) <https://github.com/dijonkitchen>`_
24+
1025
4.44.0
1126
--------
1227
- Implement support for Pydantic 2. PR: `#832 <https://github.com/ets-labs/python-dependency-injector/pull/832>`_.

docs/providers/singleton.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ returns it on the rest of the calls.
2424

2525
.. note::
2626

27-
``Singleton`` provider makes dependencies injection only when creates an object. When an object
27+
``Singleton`` provider makes dependencies injection only when it creates an object. When an object
2828
is created and memorized ``Singleton`` provider just returns it without applying injections.
2929

3030
Specialization of the provided type and abstract singletons work the same like like for the

docs/tutorials/asyncio-daemon.rst

+18-20
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ In this tutorial we will use:
1818

1919
- Python 3
2020
- Docker
21-
- Docker-compose
21+
- Docker Compose
2222

2323
Start from the scratch or jump to the section:
2424

@@ -47,28 +47,27 @@ response it will log:
4747
Prerequisites
4848
-------------
4949

50-
We will use `Docker <https://www.docker.com/>`_ and
51-
`docker-compose <https://docs.docker.com/compose/>`_ in this tutorial. Let's check the versions:
50+
We will use `docker compose <https://docs.docker.com/compose/>`_ in this tutorial. Let's check the versions:
5251

5352
.. code-block:: bash
5453
5554
docker --version
56-
docker-compose --version
55+
docker compose version
5756
5857
The output should look something like:
5958

6059
.. code-block:: bash
6160
62-
Docker version 20.10.5, build 55c4c88
63-
docker-compose version 1.29.0, build 07737305
61+
Docker version 27.3.1, build ce12230
62+
Docker Compose version v2.29.7
6463
6564
.. note::
6665

67-
If you don't have ``Docker`` or ``docker-compose`` you need to install them before proceeding.
66+
If you don't have ``Docker`` or ``docker compose`` you need to install them before proceeding.
6867
Follow these installation guides:
6968

7069
- `Install Docker <https://docs.docker.com/get-docker/>`_
71-
- `Install docker-compose <https://docs.docker.com/compose/install/>`_
70+
- `Install docker compose <https://docs.docker.com/compose/install/>`_
7271

7372
The prerequisites are satisfied. Let's get started with the project layout.
7473

@@ -129,13 +128,13 @@ Put next lines into the ``requirements.txt`` file:
129128
pytest-cov
130129
131130
Second, we need to create the ``Dockerfile``. It will describe the daemon's build process and
132-
specify how to run it. We will use ``python:3.9-buster`` as a base image.
131+
specify how to run it. We will use ``python:3.13-bookworm`` as a base image.
133132

134133
Put next lines into the ``Dockerfile`` file:
135134

136135
.. code-block:: bash
137136
138-
FROM python:3.10-buster
137+
FROM python:3.13-bookworm
139138
140139
ENV PYTHONUNBUFFERED=1
141140
@@ -155,8 +154,6 @@ Put next lines into the ``docker-compose.yml`` file:
155154

156155
.. code-block:: yaml
157156
158-
version: "3.7"
159-
160157
services:
161158
162159
monitor:
@@ -171,7 +168,7 @@ Run in the terminal:
171168

172169
.. code-block:: bash
173170
174-
docker-compose build
171+
docker compose build
175172
176173
The build process may take a couple of minutes. You should see something like this in the end:
177174

@@ -184,7 +181,7 @@ After the build is done run the container:
184181

185182
.. code-block:: bash
186183
187-
docker-compose up
184+
docker compose up
188185
189186
The output should look like:
190187

@@ -461,7 +458,7 @@ Run in the terminal:
461458

462459
.. code-block:: bash
463460
464-
docker-compose up
461+
docker compose up
465462
466463
The output should look like:
467464

@@ -705,7 +702,7 @@ Run in the terminal:
705702

706703
.. code-block:: bash
707704
708-
docker-compose up
705+
docker compose up
709706
710707
You should see:
711708

@@ -813,7 +810,7 @@ Run in the terminal:
813810

814811
.. code-block:: bash
815812
816-
docker-compose up
813+
docker compose up
817814
818815
You should see:
819816

@@ -965,15 +962,16 @@ Run in the terminal:
965962

966963
.. code-block:: bash
967964
968-
docker-compose run --rm monitor py.test monitoringdaemon/tests.py --cov=monitoringdaemon
965+
docker compose run --rm monitor py.test monitoringdaemon/tests.py --cov=monitoringdaemon
969966
970967
You should see:
971968

972969
.. code-block:: bash
973970
974-
platform linux -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
971+
platform linux -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0
975972
rootdir: /code
976-
plugins: asyncio-0.16.0, cov-3.0.0
973+
plugins: cov-6.0.0, asyncio-0.24.0
974+
asyncio: mode=Mode.STRICT, default_loop_scope=None
977975
collected 2 items
978976
979977
monitoringdaemon/tests.py .. [100%]

examples/miniapps/aiohttp/README.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ The output should be something like:
9898

9999
.. code-block::
100100
101-
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
102-
plugins: asyncio-0.16.0, anyio-3.3.4, aiohttp-0.3.0, cov-3.0.0
101+
platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0
102+
plugins: cov-6.0.0, anyio-4.4.0, asyncio-0.24.0, aiohttp-1.0.5
103+
asyncio: mode=Mode.STRICT, default_loop_scope=None
103104
collected 3 items
104105
105106
giphynavigator/tests.py ... [100%]

examples/miniapps/aiohttp/giphynavigator/tests.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@
33
from unittest import mock
44

55
import pytest
6+
import pytest_asyncio
67

78
from giphynavigator.application import create_app
89
from giphynavigator.giphy import GiphyClient
910

1011

12+
pytestmark = pytest.mark.asyncio
13+
14+
1115
@pytest.fixture
1216
def app():
1317
app = create_app()
1418
yield app
1519
app.container.unwire()
1620

1721

18-
@pytest.fixture
19-
def client(app, aiohttp_client, loop):
20-
return loop.run_until_complete(aiohttp_client(app))
22+
@pytest_asyncio.fixture
23+
async def client(app, aiohttp_client):
24+
return await aiohttp_client(app)
2125

2226

2327
async def test_index(client, app):

examples/miniapps/aiohttp/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ dependency-injector
22
aiohttp
33
pyyaml
44
pytest-aiohttp
5+
pytest-asyncio
56
pytest-cov

examples/miniapps/asyncio-daemon/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-buster
1+
FROM python:3.13-bookworm
22

33
ENV PYTHONUNBUFFERED=1
44

examples/miniapps/asyncio-daemon/README.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Build the Docker image:
1313

1414
.. code-block:: bash
1515
16-
docker-compose build
16+
docker compose build
1717
1818
Run the docker-compose environment:
1919

2020
.. code-block:: bash
2121
22-
docker-compose up
22+
docker compose up
2323
2424
The output should be something like:
2525

@@ -59,15 +59,16 @@ To run the tests do:
5959

6060
.. code-block:: bash
6161
62-
docker-compose run --rm monitor py.test monitoringdaemon/tests.py --cov=monitoringdaemon
62+
docker compose run --rm monitor py.test monitoringdaemon/tests.py --cov=monitoringdaemon
6363
6464
The output should be something like:
6565

6666
.. code-block::
6767
68-
platform linux -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
68+
platform linux -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0
6969
rootdir: /code
70-
plugins: asyncio-0.16.0, cov-3.0.0
70+
plugins: cov-6.0.0, asyncio-0.24.0
71+
asyncio: mode=Mode.STRICT, default_loop_scope=None
7172
collected 2 items
7273
7374
monitoringdaemon/tests.py .. [100%]

examples/miniapps/asyncio-daemon/monitoringdaemon/tests.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def test_example_monitor(container, caplog):
6161

6262

6363
@pytest.mark.asyncio
64-
async def test_dispatcher(container, caplog, event_loop):
64+
async def test_dispatcher(container, caplog):
6565
caplog.set_level("INFO")
6666

6767
example_monitor_mock = mock.AsyncMock()
@@ -72,6 +72,7 @@ async def test_dispatcher(container, caplog, event_loop):
7272
httpbin_monitor=httpbin_monitor_mock,
7373
):
7474
dispatcher = container.dispatcher()
75+
event_loop = asyncio.get_running_loop()
7576
event_loop.create_task(dispatcher.start())
7677
await asyncio.sleep(0.1)
7778
dispatcher.stop()

examples/miniapps/fastapi-redis/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-buster
1+
FROM python:3.13-bookworm
22

33
ENV PYTHONUNBUFFERED=1
44

examples/miniapps/fastapi-redis/README.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Build the Docker image:
1212

1313
.. code-block:: bash
1414
15-
docker-compose build
15+
docker compose build
1616
1717
Run the docker-compose environment:
1818

1919
.. code-block:: bash
2020
21-
docker-compose up
21+
docker compose up
2222
2323
The output should be something like:
2424

@@ -54,16 +54,16 @@ To run the tests do:
5454

5555
.. code-block:: bash
5656
57-
docker-compose run --rm example py.test fastapiredis/tests.py --cov=fastapiredis
57+
docker compose run --rm example py.test fastapiredis/tests.py --cov=fastapiredis
5858
5959
The output should be something like:
6060

6161
.. code-block::
6262
63-
platform linux -- Python 3.10.9, pytest-7.2.0, pluggy-1.0.0
63+
platform linux -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0
6464
rootdir: /code
65-
plugins: cov-4.0.0, asyncio-0.20.3
66-
collected 1 item
65+
plugins: cov-6.0.0, asyncio-0.24.0, anyio-4.7.0
66+
asyncio: mode=Mode.STRICT, default_loop_scope=None
6767
6868
fastapiredis/tests.py . [100%]
6969
@@ -77,4 +77,4 @@ The output should be something like:
7777
fastapiredis/services.py 7 3 57%
7878
fastapiredis/tests.py 18 0 100%
7979
-------------------------------------------------
80-
TOTAL 52 7 87%
80+
TOTAL 52 7 87%

examples/miniapps/fastapi-redis/fastapiredis/redis.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import AsyncIterator
22

3-
from aioredis import from_url, Redis
3+
from redis.asyncio import from_url, Redis
44

55

66
async def init_redis_pool(host: str, password: str) -> AsyncIterator[Redis]:

examples/miniapps/fastapi-redis/fastapiredis/services.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Services module."""
22

3-
from aioredis import Redis
3+
from redis.asyncio import Redis
44

55

66
class Service:

examples/miniapps/fastapi-redis/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dependency-injector
22
fastapi
33
uvicorn
4-
aioredis
4+
redis>=4.2
55

66
# For testing:
77
pytest

examples/miniapps/fastapi-simple/tests.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from unittest import mock
22

33
import pytest
4+
import pytest_asyncio
45
from httpx import ASGITransport, AsyncClient
56

67
from fastapi_di_example import app, container, Service
78

89

9-
@pytest.fixture
10-
async def client(event_loop):
10+
@pytest_asyncio.fixture
11+
async def client():
1112
async with AsyncClient(
1213
transport=ASGITransport(app=app),
1314
base_url="http://test",

examples/miniapps/fastapi-sqlalchemy/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-buster
1+
FROM python:3.13-bookworm
22

33
ENV PYTHONUNBUFFERED=1
44
ENV HOST=0.0.0.0

0 commit comments

Comments
 (0)