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
Copy file name to clipboardExpand all lines: README.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,18 +13,18 @@ A dependency injection library for Python.
13
13
14
14
## Why py-dependency-injection?
15
15
16
-
`py-dependency-injection` is inspired by the built-in dependency injection system in **ASP.NET Core**. It provides a lightweight and extensible way to manage dependencies in Python applications. By promoting constructor injection and supporting scoped lifetimes, it encourages clean architecture and makes testable, maintainable code the default.
16
+
`py-dependency-injection` is inspired by the built-in dependency injection system in **ASP.NET Core**. It provides a lightweight and extensible way to manage services in Python applications. By promoting constructor injection and supporting scoped lifetimes, it encourages clean architecture and makes testable, maintainable code the default.
17
17
18
18
This library is implemented in **pure Python** and has **no runtime dependencies**.
19
19
20
20
## Features
21
21
22
-
-**Scoped Registrations:** Define the lifetime of your dependencies as transient, scoped, or singleton.
23
-
-**Constructor Injection:** Automatically resolve and inject dependencies when creating instances.
24
-
-**Method Injection:** Inject dependencies into methods using a simple decorator.
25
-
-**Factory Functions:** Register factory functions, classes, or lambdas to create dependencies.
26
-
-**Instance Registration:** Register existing instances as dependencies.
27
-
-**Tag-Based Registration and Resolution:** Organize and resolve dependencies based on tags.
22
+
-**Scoped Registrations:** Define the lifetime of your services as transient, scoped, or singleton.
23
+
-**Constructor Injection:** Automatically resolve and inject services when creating instances.
24
+
-**Method Injection:** Inject services into methods using a simple decorator.
25
+
-**Factory Functions:** Register factory functions, classes, or lambdas to create services.
26
+
-**Instance Registration:** Register existing instances as services.
27
+
-**Tag-Based Registration and Resolution:** Organize and resolve services based on tags.
28
28
-**Multiple Containers:** Support for using multiple dependency containers.
29
29
30
30
## Compatibility
@@ -66,7 +66,7 @@ class CheckoutService:
66
66
defcheckout(self):
67
67
self._gateway.charge(2000, "USD") # e.g. $20.00
68
68
69
-
# Get the default dependency container
69
+
# Get the default container
70
70
container = DependencyContainer.get_instance()
71
71
72
72
# Register StripeGateway as a singleton (shared for the app's lifetime)
@@ -97,6 +97,8 @@ You can find the source code for `py-dependency-injection` on [GitHub](https://g
-**API polish:** Renamed `dependency` → `service`, `constructor_args` → `constructor_kwargs`, and `factory_args` → `factory_kwargs`; old keywords still work but emit deprecation warnings.
101
+
-**Documentation**: Enabled copy button for code example blocks.
100
102
-**Tooling**: Added test coverage tooling (Codecov).
101
103
-**Tests**: Added more unit tests to increase coverage.
0 commit comments