modern-di-fastapi 2.10.0 — adopt the modern-di integration kit
Maintenance release. No public API change — setup_di, 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.
This is the second of 13 planned adapter conversions across the modern-di
ecosystem (after
modern-di-starlette 2.2.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(request_container).FromDInow constructs
Dependency(integrations.Marker(dependency))— its own public signature
(dependency,use_cache) is unchanged.- Unlike
modern-di-starlette's conversion, this package is a native-DI
adapter (FastAPI's ownDependsdrives resolution): no@injectdecorator
to replace, noparse_markers/resolve_markersusage, and no imports
become dead.
Packaging
- Bumps the
modern-difloor to>=2.28.0,<3.
Downstream
No action needed — the public API (setup_di, FromDI, build_di_container,
fetch_di_container, fastapi_request_provider/fastapi_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. architecture/container-lifecycle.mdandarchitecture/dependency-resolution.md
updated to describe the new internals.- Built via
subagent-driven-development: 5 planned tasks, each with an
independent spec+quality review; a whole-branch review before merge.