Aiosetups

async def init_redis(): return "client": "fake redis"

async def main(): setup = AsyncSetup() setup.add("db", init_postgres, close_postgres) setup.add("cache", init_redis) aiosetups

If you meant (singular) — also not an official package. Final answer If you need code for async initialization patterns , the above AsyncSetup class or asynccontextmanager wrapper is a solid solution. If you actually meant a specific library, please clarify the name or link, and I’ll provide exact content. async def init_redis(): return "client": "fake redis" async

async def setup_all(self): for task in self._init_tasks: await task() async def setup_all(self): for task in self

def add(self, name: str, init_func, cleanup_func=None): async def _init(): self._resources[name] = await init_func() self._init_tasks.append(_init) if cleanup_func: async def _clean(): await cleanup_func(self._resources[name]) self._cleanup_tasks.insert(0, _clean) # reverse order cleanup

Since there is no widely known official package named aiosetups , I’ll provide the most useful interpretation: — common patterns in asyncio projects for initializing resources (databases, HTTP clients, message queues, etc.) in Python.

# ... your app logic here ...