Async

diwire is async-first:

Async factories + aresolve()

If any dependency in the graph is async, you must resolve the root using aresolve().

See the runnable scripts in Async (Basic async factory section).

Async cleanup with async generators

Use an async generator when you need to await cleanup (closing connections, sessions, etc.). The finally block runs when the scope exits.

See the runnable scripts in Async (Async generator cleanup section).

Parallel resolution

Independent async dependencies are resolved in parallel via asyncio.gather().

See the runnable scripts in Async (Mixed sync/async + parallel resolution section).