Aiosetups Better -

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 setup_all(self): for task in self._init_tasks: await task()

Below is a practical, ready-to-use content snippet / documentation-style explanation. aiosetups is a conceptual / utility module that provides reusable patterns to initialize, manage, and gracefully shut down async resources. Typical use case Instead of manually managing: aiosetups

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

await setup.setup_all() print("Resources ready:", setup._resources) If you meant (singular) — also not an official package

def get(self, name: str): return self._resources.get(name) async def init_postgres(): # Imagine asyncpg.connect(...) return "conn": "fake pg connection"

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

async def close_postgres(resource): print(f"Closing resource")

67-pt_betano_stoixima
https://www.betano.pt