{"categories":[{"label":"Application Frameworks","url":"https://skillfed.io/packages/category/software-development-libraries-application-frameworks/5"}],"enrichment":{"capability":"Provides a lifespan manager for FastAPI that allows multiple startup and shutdown handlers to coexist in a single application, simplifying management of resources like database connections and caches.","skillfed_tags":["fastapi-ecosystem","lifecycle-management","async-resource-handling"],"use_cases":["Initialize multiple databases and caches on startup, ensuring each is properly closed when the app shuts down.","Manage background task workers or thread pools that need to be started at app launch and stopped cleanly.","Coordinate setup of external service clients (Redis, Elasticsearch, etc.) with their respective cleanup routines.","Separate resource initialization logic into modular, reusable handlers rather than one large lifespan function.","Build plugin or extension systems where each module registers its own startup and shutdown behavior."],"what_it_does":"fastapi-lifespan-manager wraps FastAPI's lifespan context manager to allow you to register multiple startup and shutdown handlers without nesting or manually combining them. Instead of writing a single monolithic lifespan context manager, you decorate individual async generator functions with @manager.add, each yielding a dictionary of state to attach to the app. The manager collects these handlers and runs them sequentially during application startup and shutdown.\n\nThis is particularly useful for applications that need to initialize multiple external resources\u2014databases, caches, message queues, connection pools\u2014where each resource has its own setup and teardown logic. Rather than manually coordinating all of these in one place, you can define each resource's lifecycle independently and let the manager orchestrate them. The package depends only on fastapi and supports Python 3.8 through 3.12.","worth_installing":"Yes, if you have a FastAPI application with multiple resources that need coordinated startup and shutdown. The package is actively maintained, has no known vulnerabilities, and solves a real organizational problem\u2014keeping lifespan logic modular and readable. The low install friction and permissive license make adoption straightforward. Not necessary for simple applications with only one or two resources."},"id":"fastapi-lifespan-manager","links":{"html":"https://skillfed.io/packages/fastapi-lifespan-manager","md":"https://skillfed.io/packages/fastapi-lifespan-manager.md","pypi":"https://pypi.org/project/fastapi-lifespan-manager/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2024-02-20","license_spdx":null,"license_treatment":"permissive","name":"fastapi-lifespan-manager","python_support":"supports_current","summary":"FastAPI Lifespan Manager"},"popularity":{"monthly_downloads":100501,"position":12984,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.1.4"}
