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
Use uncalled-for for dependency injection plumbing (#353)
Docket's DI engine was extracted into the standalone
[`uncalled-for`](https://pypi.org/project/uncalled-for/) library. This
swaps out all the internal DI plumbing — parameter introspection,
dependency resolution, validation, `Depends()`, `Shared`,
`SharedContext` — for imports from that package.
The public API is unchanged; everything is re-exported from
`docket.dependencies` exactly as before. The docket-specific bits
(ContextVars, Retry, Perpetual, ConcurrencyLimit, etc.) stay in docket.
The three ambient ContextVars (`current_docket`, `current_worker`,
`current_execution`) are now module-level variables in `_base.py` rather
than class attributes on a custom `Dependency` subclass, so `Dependency`
is just a direct re-export of `uncalled_for.Dependency`.
Net result: −394 lines, +167 lines across the dependencies package.
Closes#352
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/dependency-injection.md
+31-3Lines changed: 31 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,13 @@
2
2
3
3
Docket includes a dependency injection system that provides access to context, configuration, and custom resources. It's similar to FastAPI's dependency injection but tailored for background task patterns.
4
4
5
+
As of version 0.18.0, Docket's dependency injection is built on the
Inside `__aenter__`, you can access the current execution context through the class-level context vars `self.docket`, `self.worker`, and `self.execution`:
365
+
Inside `__aenter__`, you can access the current execution context through the
366
+
module-level context variables `current_docket`, `current_worker`, and
367
+
`current_execution`:
359
368
360
369
```python
370
+
from docket.dependencies import Dependency, current_execution, current_worker
0 commit comments