taskiq-dependencies
taskiq-dependencies copied to clipboard
Make arg-reference
This issue comes from the discussion https://github.com/orgs/taskiq-python/discussions/233.
Initial idea is to create a class that can reference arguments of the current function.
async def dependency(sleep_time: float) -> float:
await asyncio.sleep(sleep_time)
return sleep_time
async def target(arg: float, sleept: float = TaskiqDepends(dependency, kwargs={"sleep_time": ArgRef("arg")})):
print(f"short_sleep: {sleept}")