You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**New Feature**: Support for constructor arguments in dependency registration: In this release, we introduce the ability to specify constructor arguments when registering dependencies with the container. This feature provides more flexibility when configuring dependencies, allowing users to customize the instantiation of classes during registration.
152
+
153
+
**Usage Example:**
154
+
```python
155
+
# Registering a dependency with constructor arguments
156
+
dependency_container.register_transient(
157
+
SomeInterface, SomeClass,
158
+
constructor_args={"arg1": value1, "arg2": value2}
159
+
)
160
+
```
161
+
162
+
Users can now pass specific arguments to be used during the instantiation of the dependency. This is particularly useful when a class requires dynamic or configuration-dependent parameters.
-**Breaking Change**: Restriction on `@inject` Decorator: Starting from this version, the `@inject` decorator can now only be used on static class methods andclass methods. This change is introduced due to potential pitfalls associated with resolving and injecting dependencies directly into class instance methods using the dependency container.
Copy file name to clipboardExpand all lines: docs/versionhistory.rst
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,22 @@
2
2
Version history
3
3
###############
4
4
5
+
**1.0.0-alpha.4 (2024-03-02)**
6
+
7
+
- **New Feature**: Support for constructor arguments in dependency registration: In this release, we introduce the ability to specify constructor arguments when registering dependencies with the container. This feature provides more flexibility when configuring dependencies, allowing users to customize the instantiation of classes during registration.
8
+
9
+
**Usage Example:**::
10
+
11
+
# Registering a dependency with constructor arguments
12
+
dependency_container.register_transient(
13
+
SomeInterface, SomeClass,
14
+
constructor_args={"arg1": value1, "arg2": value2}
15
+
)
16
+
17
+
Users can now pass specific arguments to be used during the instantiation of the dependency. This is particularly useful when a class requires dynamic or configuration-dependent parameters.
18
+
19
+
`View release on GitHub <https://github.com/runemalm/py-dependency-injection/releases/tag/v1.0.0-alpha.4>`_
20
+
5
21
**1.0.0-alpha.3 (2024-03-02)**
6
22
7
23
- **Breaking Change**: Restriction on `@inject` Decorator: Starting from this version, the `@inject` decorator can now only be used on static class methods and class methods. This change is introduced due to potential pitfalls associated with resolving and injecting dependencies directly into class instance methods using the dependency container.
0 commit comments