2.8.0
modern-di-fastapi 2.8.0 — modern-di 2.21.0 floor + internal cleanups
Maintenance release. No public API change — setup_di, FromDI, build_di_container, and the context providers keep their signatures and behavior. It raises the modern-di floor and cleans up two internals.
Internal refactors
- Connection-kind mapping single-sourced off the context providers.
build_di_containerno longer re-states each connection type and context key in anisinstanceladder; it walks the registered context providers (_CONNECTION_PROVIDERS), taking eachcontext_typeandscopefrom the provider.setup_diregisters from the same tuple. Adding a connection kind is adding a provider — behavior is unchanged. - Own the lifespan composition.
setup_dipreviously chained its lifespan via the privatefastapi.routing._merge_lifespan_context. It now uses a small_compose_lifespanbuilt on the publicapp.router.lifespan_context, dropping the FastAPI-internals dependency. The original lifespan stays the outer context, its startup/shutdown and yielded state pass through, and the root container still reopens across lifespan cycles.
Packaging
modern-difloor raised to>=2.21.0,<3(was>=2.19.0). The connection-mapping refactor relies on the publicContextProvider.context_typeadded in modern-di 2.21.0.- Enriched PyPI metadata (keywords, classifiers, project URLs).
Downstream
Requires modern-di>=2.21.0. There is no API change, so application code that uses setup_di / FromDI needs no edits — only the modern-di floor moves.
Internals
- 100% line coverage maintained;
ruff,ty, andeof-fixerclean. - Adopted the portable planning convention (
planning/) and seeded thearchitecture/truth home; releases are tag-driven.