Skip to content

Commit 6b57ce9

Browse files
committed
Merge branch 'release/4.29.1' into master
2 parents f1a3ad0 + dbad794 commit 6b57ce9

File tree

8 files changed

+6251
-6008
lines changed

8 files changed

+6251
-6008
lines changed

docs/_static/sphinx_rtd_theme-hotfix.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/main/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ that were made in every particular version.
77
From version 0.7.6 *Dependency Injector* framework strictly
88
follows `Semantic versioning`_
99

10+
4.29.1
11+
------
12+
- Fix recursive copying issue in ``Delegate`` provider.
13+
See issue: `#245 <https://github.com/ets-labs/python-dependency-injector/issues/245>`_.
14+
Thanks to `@GitterRemote <https://github.com/GitterRemote>`_ for reporting the issue.
15+
- Add docs and example for ``Factory.add_attributes()`` method.
16+
- Remove legacy css file.
17+
1018
4.29.0
1119
------
1220
- Implement context manager interface for resetting a singleton provider.

docs/providers/factory.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ injected following these rules:
4040
:language: python
4141
:lines: 3-
4242

43+
``Factory`` provider can inject attributes. Use ``.add_attributes()`` method to specify
44+
attribute injections.
45+
46+
.. literalinclude:: ../../examples/providers/factory_attribute_injections.py
47+
:language: python
48+
:lines: 3-
49+
:emphasize-lines: 18-18
50+
4351
Passing arguments to the underlying providers
4452
---------------------------------------------
4553

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""`Factory` provider attribute injections example."""
2+
3+
from dependency_injector import containers, providers
4+
5+
6+
class Client:
7+
...
8+
9+
10+
class Service:
11+
def __init__(self) -> None:
12+
self.client = None
13+
14+
15+
class Container(containers.DeclarativeContainer):
16+
17+
client = providers.Factory(Client)
18+
19+
service = providers.Factory(Service)
20+
service.add_attributes(clent=client)
21+
22+
23+
if __name__ == '__main__':
24+
container = Container()
25+
26+
service = container.service()
27+
28+
assert isinstance(service.client, Client)

src/dependency_injector/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Top-level package."""
22

3-
__version__ = '4.29.0'
3+
__version__ = '4.29.1'
44
"""Version number.
55
66
:type: str

0 commit comments

Comments
 (0)