modern-di-starlette 2.2.0 — adopt the modern-di integration kit
Internal refactor, no API change. Swaps this package's hand-rolled
connection-dispatch loop and FromDI/parse/resolve triad for the shared
primitives in modern_di.integrations,
shipped in
modern-di 2.28.0.
This is the first of 13 planned adapter conversions across the modern-di
ecosystem.
Internal
_DIMiddleware's isinstance-over-tuple connection dispatch is now
integrations.classify_connection.- The child container's manual
try/finally: await child_container.close_async()
is nowContainer's ownasync with— entering an already-open container
is a no-op; exiting closes it, including on the exception path. _FromDI,_parse_inject_params, and_resolve_di_paramsare gone.
FromDIis now a direct re-export (FromDI = integrations.from_di);
injectcallsintegrations.parse_markers/integrations.resolve_markers.architecture/container-lifecycle.md,architecture/dependency-resolution.md,
andarchitecture/glossary.mdupdated to describe the new internals.
Packaging
- Bumps the
modern-difloor to>=2.28.0,<3.
Downstream
No action needed — the public API (setup_di, FromDI, @inject,
fetch_di_container, starlette_request_provider/starlette_websocket_provider)
is unchanged, and no test in this package's own suite needed to change.
Upgrading only requires modern-di>=2.28.0.
Internals
- 100% line coverage;
ruff,tyclean across Python 3.10–3.14. - Built via
subagent-driven-development: 5 planned tasks, each with an
independent spec+quality review; a whole-branch review before merge.