Aiosetups -
async def main(): db = await init_db() redis = await init_redis() http_client = await init_http() # ... cleanup code scattered you use a setup registry. # aiosetups.py import asyncio from contextlib import asynccontextmanager from typing import Any, AsyncGenerator, Callable, Dict, List class AsyncSetup: """Register and manage async initializers and cleaners.""" def init (self): self._init_tasks: List[Callable[[], Any]] = [] self._cleanup_tasks: List[Callable[[], Any]] = [] self._resources: Dict[str, Any] = {}
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. aiosetups
await setup.setup_all() print("Resources ready:", setup._resources) async def main(): db = await init_db() redis
async def init_redis(): return "client": "fake redis" Final answer If you need code for async
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: