blackbull.di¶
blackbull.di
¶
Per-request dependency injection for simplified handlers.
Async-generator providers finalize after response sending; put cleanup in finally. Provider forms are resolved at registration, not during dispatch.
Depends
¶
Inject a zero-argument provider with a default such as db=Depends(get_db).
Async generators yield exactly once and finalize after response sending, LIFO across providers; put cleanup in finally so exceptions cannot skip it. Async functions are awaited; sync functions are called without cleanup. use_cache=True shares one value per provider per request. False invokes it per parameter. Sync generators and nested Depends parameters are rejected.