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
Normally, you would call the target, by writing something like this:
292
+
293
+
```python
294
+
with graph.sync_ctx() as ctx:
295
+
target(**ctx.resolve_kwargs())
296
+
```
297
+
298
+
But what if you want to replace dependency in runtime, just
299
+
before resolving kwargs? The solution is to add `replaced_deps`
300
+
parameter to the context method. For example:
301
+
302
+
```python
303
+
defreplaced() -> int:
304
+
return2
305
+
306
+
307
+
with graph.sync_ctx(replaced_deps={dependency: replaced}) as ctx:
308
+
target(**ctx.resolve_kwargs())
309
+
```
310
+
311
+
Furthermore, the new dependency can depend on other dependencies. Or you can change type of your dependency, like generator instead of plain return. Everything should work as you would expect it.
0 commit comments