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.
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.
await setup.cleanup_all() if == " main ": asyncio.run(main()) Better: asynccontextmanager approach @asynccontextmanager async def aiosetup(*resources): """Context manager for async setup/cleanup.""" initialized = [] try: for res in resources: inst = await res["init"]() initialized.append((res["name"], inst, res.get("cleanup"))) yield name: inst for name, inst, _ in initialized finally: for name, inst, cleanup in reversed(initialized): if cleanup: await cleanup(inst) Usage async def main(): async with aiosetup( "name": "db", "init": init_postgres, "cleanup": close_postgres, "name": "redis", "init": init_redis ) as resources: db = resources["db"] redis = resources["redis"] # work with db & redis If you meant a real PyPI package No package named aiosetups exists on PyPI (checked as of 2026). Common alternatives: aiosetups
async def close_postgres(resource): print(f"Closing resource")
async def cleanup_all(self): for task in self._cleanup_tasks: await task() If you meant (singular) — also not an official package
# ... your app logic here ...
await setup.setup_all() print("Resources ready:", setup._resources) Since there is no widely known official package
async def init_redis(): return "client": "fake redis"