modern-di-litestar 2.13.0 — adopt the modern-di integration kit
Maintenance release. No public API change — ModernDIPlugin, FromDI,
build_di_container, fetch_di_container, and the context providers keep
their signatures and behavior. Swaps this package's hand-rolled connection
dispatch and marker resolution for the shared primitives in
modern_di.integrations,
shipped in
modern-di 2.28.0.
Third of 13 planned adapter conversions across the modern-di ecosystem
(after
modern-di-starlette 2.2.0
and
modern-di-fastapi 2.10.0).
Internal refactors
build_di_container's isinstance-over-tuple connection dispatch is now
integrations.classify_connection.- The child container's manual
try/finally: await 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. _Dependency's field changes from a rawdependencyto
marker: integrations.Marker[T_co];__call__becomes
self.marker.resolve(di_container).FromDInow constructs
Provide(dependency=_Dependency(integrations.Marker(dependency)), use_cache=False)— its own public signature (dependency) is unchanged.- Like
modern-di-fastapi, this package is a native-DI adapter
(Litestar's ownProvidedrives resolution): no@injectdecorator to
replace, noparse_markers/resolve_markersusage, and no imports
become dead. - Internal test coverage: two tests that construct
_Dependencydirectly
(bypassingFromDI) now pass anintegrations.Marker— required by the
field rename above, verified to still exercise real resolution rather than
a coincidentally-passing shortcut.
Packaging
- Bumps the
modern-difloor to>=2.28.0,<3.
Downstream
No action needed — the public API (ModernDIPlugin, FromDI,
build_di_container, fetch_di_container,
litestar_request_provider/litestar_websocket_provider) is unchanged.
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: 4 planned tasks, each with an
independent spec+quality review; a whole-branch review before merge.