Skip to content

Commit f3b3b1b

Browse files
committed
Merge branch 'release/4.46.0' into master
2 parents be7abb3 + 9b66d4b commit f3b3b1b

File tree

84 files changed

+1462
-724
lines changed

Some content is hidden

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

84 files changed

+1462
-724
lines changed

Diff for: .github/workflows/publishing.yml

+14-30
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010

1111
tests:
1212
name: Run tests
13-
runs-on: ubuntu-22.04
13+
runs-on: ubuntu-24.04
1414
steps:
1515
- uses: actions/checkout@v3
1616
- uses: actions/setup-python@v4
@@ -23,7 +23,7 @@ jobs:
2323

2424
linters:
2525
name: Run linters
26-
runs-on: ubuntu-22.04
26+
runs-on: ubuntu-24.04
2727
strategy:
2828
matrix:
2929
toxenv: [flake8, pydocstyle, mypy, pylint]
@@ -40,7 +40,7 @@ jobs:
4040
build-sdist:
4141
name: Build source tarball
4242
needs: [tests, linters]
43-
runs-on: ubuntu-22.04
43+
runs-on: ubuntu-24.04
4444
steps:
4545
- uses: actions/checkout@v3
4646
- uses: actions/setup-python@v4
@@ -49,8 +49,9 @@ jobs:
4949
- run: |
5050
python -m pip install --upgrade build
5151
python -m build --sdist
52-
- uses: actions/upload-artifact@v3
52+
- uses: actions/upload-artifact@v4
5353
with:
54+
name: cibw-sdist
5455
path: ./dist/*
5556

5657
build-wheels:
@@ -59,45 +60,28 @@ jobs:
5960
runs-on: ${{ matrix.os }}
6061
strategy:
6162
matrix:
62-
os: [ubuntu-22.04, windows-2019, macos-14]
63+
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2019, macos-14]
6364
env:
6465
CIBW_SKIP: cp27-*
6566
steps:
6667
- uses: actions/checkout@v3
6768
- name: Build wheels
6869
uses: pypa/[email protected]
69-
- uses: actions/upload-artifact@v3
70-
with:
71-
path: ./wheelhouse/*.whl
72-
73-
build-wheels-linux-aarch64:
74-
name: Build wheels (ubuntu-22.04-aarch64)
75-
needs: [tests, linters]
76-
runs-on: ubuntu-22.04
77-
env:
78-
CIBW_SKIP: cp27-*
79-
steps:
80-
- uses: actions/checkout@v3
81-
- name: Set up QEMU
82-
if: runner.os == 'Linux'
83-
uses: docker/setup-qemu-action@v2
84-
- name: Build wheels
85-
uses: pypa/[email protected]
86-
env:
87-
CIBW_ARCHS_LINUX: aarch64
88-
- uses: actions/upload-artifact@v3
70+
- uses: actions/upload-artifact@v4
8971
with:
72+
name: cibw-wheels-x86-${{ matrix.os }}-${{ strategy.job-index }}
9073
path: ./wheelhouse/*.whl
9174

9275
publish:
9376
name: Publish on PyPI
94-
needs: [build-sdist, build-wheels, build-wheels-linux-aarch64]
95-
runs-on: ubuntu-22.04
77+
needs: [build-sdist, build-wheels]
78+
runs-on: ubuntu-24.04
9679
steps:
97-
- uses: actions/download-artifact@v3
80+
- uses: actions/download-artifact@v4
9881
with:
99-
name: artifact
82+
pattern: cibw-*
10083
path: dist
84+
merge-multiple: true
10185
- uses: pypa/gh-action-pypi-publish@release/v1
10286
with:
10387
user: __token__
@@ -109,7 +93,7 @@ jobs:
10993
publish-docs:
11094
name: Publish docs
11195
needs: [publish]
112-
runs-on: ubuntu-22.04
96+
runs-on: ubuntu-24.04
11397
steps:
11498
- uses: actions/checkout@v3
11599
- uses: actions/setup-python@v4

Diff for: docs/main/changelog.rst

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

10+
4.46.0
11+
------
12+
13+
- Add option to disable env var interpolation in configs (`#861 <https://github.com/ets-labs/python-dependency-injector/pull/861>`_)
14+
- Fix ``Closing`` dependency resolution (`#852 <https://github.com/ets-labs/python-dependency-injector/pull/852>`_)
15+
- Add support for ``inspect.iscoroutinefunction()`` in ``Coroutine`` provider (`#830 <https://github.com/ets-labs/python-dependency-injector/pull/830>`_)
16+
- Fix broken wiring of sync inject-decorated methods (`#673 <https://github.com/ets-labs/python-dependency-injector/pull/673>`_)
17+
- Add support for ``typing.Annotated`` (`#721 <https://github.com/ets-labs/python-dependency-injector/pull/721>`_, `#853 <https://github.com/ets-labs/python-dependency-injector/pull/853>`_)
18+
- Documentation updates for movie-lister example (`#747 <https://github.com/ets-labs/python-dependency-injector/pull/747>`_)
19+
- Fix type propagation in ``Provider.provider`` (`#744 <https://github.com/ets-labs/python-dependency-injector/pull/744>`_)
20+
21+
Many thanks for the contributions to:
22+
- `ZipFile <https://github.com/ZipFile>`_
23+
- `Yegor Statkevich <https://github.com/jazzthief>`_
24+
- `Federico Tomasi <https://github.com/federinik>`_
25+
- `Martin Lafrance <https://github.com/martlaf>`_
26+
- `Philip Bjorge <https://github.com/philipbjorge>`_
27+
- `Ilya Kazakov <https://github.com/mrKazzila>`_
28+
29+
4.45.0
30+
--------
31+
- Add Starlette lifespan handler implementation (`#683 <https://github.com/ets-labs/python-dependency-injector/pull/683>`_).
32+
- Raise exception in ``ThreadLocalSingleton`` instead of hiding it in finally (`#845 <https://github.com/ets-labs/python-dependency-injector/pull/845>`_).
33+
- Improve debuggability of ``deepcopy`` errors (`#839 <https://github.com/ets-labs/python-dependency-injector/pull/839>`_).
34+
- Update examples (`#838 <https://github.com/ets-labs/python-dependency-injector/pull/838>`_).
35+
- Upgrade testing dependencies (`#837 <https://github.com/ets-labs/python-dependency-injector/pull/837>`_).
36+
- Add minor fixes to the documentation (`#709 <https://github.com/ets-labs/python-dependency-injector/pull/709>`_).
37+
- Remove ``six`` from the dependencies (`3ba4704 <https://github.com/ets-labs/python-dependency-injector/commit/3ba4704bc1cb00310749fd2eda0c8221167c313c>`_).
38+
39+
Many thanks for the contributions to:
40+
- `ZipFile <https://github.com/ZipFile>`_
41+
- `František Trebuňa <https://github.com/gortibaldik>`_
42+
- `JC (Jonathan Chen) <https://github.com/dijonkitchen>`_
43+
1044
4.44.0
1145
--------
1246
- Implement support for Pydantic 2. PR: `#832 <https://github.com/ets-labs/python-dependency-injector/pull/832>`_.

Diff for: docs/providers/configuration.rst

+13
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,19 @@ See also: :ref:`configuration-strict-mode`.
366366
367367
assert container.config.section.option() is None
368368
369+
If you want to disable environment variables interpolation, pass ``envs_required=None``:
370+
371+
.. code-block:: yaml
372+
:caption: templates.yml
373+
374+
template_string: 'Hello, ${name}!'
375+
376+
.. code-block:: python
377+
378+
>>> container.config.from_yaml("templates.yml", envs_required=None)
379+
>>> container.config.template_string()
380+
'Hello, ${name}!'
381+
369382
Mandatory and optional sources
370383
------------------------------
371384

Diff for: 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

Diff for: 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%]

Diff for: docs/tutorials/cli.rst

+10-11
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ Create ``tests.py`` in the ``movies`` package:
911911
and put next into it:
912912

913913
.. code-block:: python
914-
:emphasize-lines: 36,51
914+
:emphasize-lines: 41,50
915915
916916
"""Tests module."""
917917
@@ -941,13 +941,18 @@ and put next into it:
941941
return container
942942
943943
944-
def test_movies_directed_by(container):
944+
@pytest.fixture
945+
def finder_mock(container):
945946
finder_mock = mock.Mock()
946947
finder_mock.find_all.return_value = [
947948
container.movie("The 33", 2015, "Patricia Riggen"),
948949
container.movie("The Jungle Book", 2016, "Jon Favreau"),
949950
]
950951
952+
return finder_mock
953+
954+
955+
def test_movies_directed_by(container, finder_mock):
951956
with container.finder.override(finder_mock):
952957
lister = container.lister()
953958
movies = lister.movies_directed_by("Jon Favreau")
@@ -956,13 +961,7 @@ and put next into it:
956961
assert movies[0].title == "The Jungle Book"
957962
958963
959-
def test_movies_released_in(container):
960-
finder_mock = mock.Mock()
961-
finder_mock.find_all.return_value = [
962-
container.movie("The 33", 2015, "Patricia Riggen"),
963-
container.movie("The Jungle Book", 2016, "Jon Favreau"),
964-
]
965-
964+
def test_movies_released_in(container, finder_mock):
966965
with container.finder.override(finder_mock):
967966
lister = container.lister()
968967
movies = lister.movies_released_in(2015)
@@ -995,9 +994,9 @@ You should see:
995994
movies/entities.py 7 1 86%
996995
movies/finders.py 26 13 50%
997996
movies/listers.py 8 0 100%
998-
movies/tests.py 23 0 100%
997+
movies/tests.py 24 0 100%
999998
------------------------------------------
1000-
TOTAL 89 30 66%
999+
TOTAL 90 30 67%
10011000
10021001
.. note::
10031002

Diff for: docs/wiring.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ FastAPI example:
6464
6565
@app.api_route("/")
6666
@inject
67-
async def index(service: Service = Depends(Provide[Container.service])):
67+
async def index(service: Annotated[Service, Depends(Provide[Container.service])]):
6868
value = await service.process()
6969
return {"result": value}
7070

Diff for: 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%]

0 commit comments

Comments
 (0)