$npx skillfedfor your agent

fastapi-lifespan-manager

FastAPI Lifespan Manager

With conditionsPyPI Application FrameworksReleased Feb 2024100.5K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — fastapi_lifespan_manager-0.1.4-py3-none-any.whl
v0.1.4 · released 2024-02-20 · Python >=3.8,<4.0 · 1 runtime deps: fastapi

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—keeping 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.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low friction: pure Python wheel with only fastapi as a runtime dependency.
  • Repository is active with recent commits and no archived status, though the package is relatively young (first release April 2023).

License · maintenance · safety

MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

last release 2024-02-20 (906 days) · last repo commit 2026-08-14 · 42 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 100,501 downloads/mo, #12,984 on PyPI

Verify before relying

pip install fastapi-lifespan-manager

from fastapi import FastAPI
from fastapi_lifespan_manager import LifespanManager

manager = LifespanManager()

@manager.add
async def setup_resource(app: FastAPI):
    # Initialize resource
    yield {"resource": resource}
    # Cleanup

app = FastAPI(lifespan=manager)
  • Whether the package handles exception cases during lifespan setup or teardown gracefully
  • Performance characteristics when managing many concurrent lifespan handlers
  • Compatibility with FastAPI's native lifespan parameter in versions after 0.93
Same gist for agents: .md · .json

What it is and 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.

This is particularly useful for applications that need to initialize multiple external resources—databases, caches, message queues, connection pools—where 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.

Use it for

  • 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.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

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—keeping 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.

Install

fastapi-lifespan-manager on PyPI

Before you install

Low friction: pure Python wheel with only fastapi as a runtime dependency. Repository is active with recent commits and no archived status, though the package is relatively young (first release April 2023).

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install fastapi-lifespan-manager

from fastapi import FastAPI
from fastapi_lifespan_manager import LifespanManager

manager = LifespanManager()

@manager.add
async def setup_resource(app: FastAPI):
    # Initialize resource
    yield {"resource": resource}
    # Cleanup

app = FastAPI(lifespan=manager)

Verify before relying

  • Whether the package handles exception cases during lifespan setup or teardown gracefully
  • Performance characteristics when managing many concurrent lifespan handlers
  • Compatibility with FastAPI's native lifespan parameter in versions after 0.93

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.8,<4.0
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
fastapi
MaintenanceActively maintained 906 days since the last release
Last repo commit
First released
Downloads100,501 / month, #12,984 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Evidence: fastapi_lifespan_manager-0.1.4-py3-none-any.whl

Tags

Capabilities
fastapi lifespan managementmultiple fastapi startup handlersfastapi resource lifecyclefastapi database connection startupfastapi background task initializationfastapi cleanup on shutdownfastapi lifespan context manager
Topics
fastapi-ecosystemlifecycle-managementasync-resource-handling

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “fastapi lifespan management”

Give your agent the search over MCP, or paste the wish link into any chat.

More Application Frameworks packages

fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.

MITpure Python · 3.9+
456.2Mdownloads / mo
textual Worth it
PyPI · Application Frameworks · released Jun 2026

Textual is a Python framework for building cross-platform user interfaces that run in the terminal or web browser using a modern, component-based API.

Install it if you're developing CLI tools, dashboards, or interactive terminal applications.

MITpure Python
443.6Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.

Install it if you are building CLIs in Python.

MITpure Python · 3.10+
369.3Mdownloads / mo
mcp Worth it
PyPI · Application Frameworks · released Jul 2026

Build and connect to Model Context Protocol servers that expose tools, resources, and prompts to LLM applications over stdio, HTTP, or SSE transports.

Install it if you need to build or connect to servers.

MITpure Python · 3.10+
319.3Mdownloads / mo
Werkzeug Worth it
PyPI · Application Frameworks · released Apr 2026

Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.

BSD-3-Clausepure Python · 3.9+
268.1Mdownloads / mo

See also asgi-lifespan · fastapi-cache2 · starsessions · fastapi-utilities · fastapi-cli · fastapi-injectable · FastAPI-SQLAlchemy · taskiq-fastapi · nc-py-api · growthbook