@@ -46,8 +46,6 @@ class UserService:
4646 def __init__ (self , db : Database) -> None :
4747 self .db = db
4848
49- # Now that the dependencies are defined, register them with the container.
50- # You can pass a list of classes, functions, or even modules to be scanned.
5149container = create_sync_container(injectables = [Database, UserService])
5250user_service = container.get(UserService) # ✅ Dependencies resolved.
5351```
@@ -118,6 +116,25 @@ container = create_sync_container(injectables=[make_settings, make_database])
118116database = container.get(Database) # ✅ Dependencies resolved.
119117```
120118
119+ ** 4. Auto-Discover**
120+
121+ No need to list every injectable manually. Scan entire modules or packages to register all at once.
122+
123+ ``` python
124+ import wireup
125+ import app
126+
127+ container = wireup.create_sync_container(
128+ injectables = [
129+ app.services,
130+ app.repositories,
131+ app.factories
132+ ]
133+ )
134+
135+ user_service = container.get(UserService) # ✅ Dependencies resolved.
136+ ```
137+
121138### 🎯 Function Injection
122139
123140Inject dependencies directly into functions with a simple decorator.
@@ -131,7 +148,7 @@ def process_users(service: Injected[UserService]):
131148
132149### 📝 Interfaces & Abstractions
133150
134- Define abstract types and have the container automatically inject the implementation .
151+ Depend on abstractions, not implementations. Bind implementations to interfaces using Protocols or ABCs .
135152
136153``` python
137154from wireup import injectable, create_sync_container
@@ -297,10 +314,10 @@ graph LR
297314 Worker[Celery / Worker]
298315 end
299316
300- API -->|Injects | Services
301- CLI -->|Injects | Services
302- Worker -->|Injects | Services
303-
317+ API -->|Uses | Services
318+ CLI -->|Uses | Services
319+ Worker -->|Uses | Services
320+
304321 Services --> Domain
305322```
306323
0 commit comments