|
| 1 | +# modern-di-litestar 2.12.0 — adopt modern-di 2.25 integration seams |
| 2 | + |
| 3 | +Maintenance release. **No public API change** — `ModernDIPlugin`, `FromDI`, |
| 4 | +`build_di_container`, and the context providers keep their signatures and |
| 5 | +behavior. It raises the `modern-di` floor and single-sources onto the new |
| 6 | +blessed integration seams from modern-di 2.25 |
| 7 | +([modern-python/modern-di#283](https://github.com/modern-python/modern-di/pull/283)). |
| 8 | + |
| 9 | +## Internal refactors |
| 10 | + |
| 11 | +- **`container.add_providers()` replaces the `providers_registry` reach-in.** |
| 12 | + `ModernDIPlugin.on_app_init` registers `_CONNECTION_PROVIDERS` through the |
| 13 | + new blessed `Container.add_providers()` instead of reaching two attributes |
| 14 | + deep into `container.providers_registry.add_providers()`. Same semantics, |
| 15 | + less surface touched. |
| 16 | +- **`container.resolve_dependency()` replaces the `isinstance` dispatch.** |
| 17 | + `_Dependency.__call__` no longer branches on |
| 18 | + `isinstance(self.dependency, providers.AbstractProvider)` to choose between |
| 19 | + `resolve_provider` and `resolve` — it calls the new |
| 20 | + `Container.resolve_dependency()`, which does the same dispatch in core. As a |
| 21 | + side effect its return type tightens from `T_co | None` to `T_co`: the |
| 22 | + `None` case was never reachable (both underlying resolve paths raise rather |
| 23 | + than return `None` on failure), so this fixes a type-only false negative, |
| 24 | + not a runtime one. |
| 25 | + |
| 26 | +## Packaging |
| 27 | + |
| 28 | +- **`modern-di` floor raised to `>=2.25.0,<3`** (was `>=2.21.0`). The refactor |
| 29 | + relies on `Container.add_providers()` and `Container.resolve_dependency()`, |
| 30 | + added in `modern-di` 2.25.0. |
| 31 | + |
| 32 | +## Upgrade |
| 33 | + |
| 34 | +Bump `modern-di-litestar` to `2.12.0`; `pip`/`uv` will pull `modern-di>=2.25.0`. |
| 35 | +No code changes required. |
| 36 | + |
| 37 | +## Internals |
| 38 | + |
| 39 | +- 100% line coverage across Python 3.10–3.14; `ruff` and `ty` clean. |
0 commit comments