Skip to content

2.10.0

Latest

Choose a tag to compare

@github-actions github-actions released this 26 Jun 08:54
· 3 commits to main since this release
355a8ca

modern-di-litestar 2.10.0 — autowire inherited providers

Fixes a KeyError when autowiring a Group that inherits providers, and
deepens the autowiring into a directly-testable internal module. Requires
modern-di>=2.20.0.

Fix

  • Inherited providers are now autowired. ModernDIPlugin(..., autowired_groups=[...])
    raised KeyError at app construction when a group inherited a provider from a
    base Group: provider names were recovered from the subclass __dict__ only,
    while the provider list walked the full MRO. Names now come from
    modern_di.Group.get_named_providers() (MRO-aware), so inherited providers are
    registered under their declared attribute names like any other.

Internal refactors

  • _autowired_dependencies. The autowiring loop in on_app_init is replaced
    by a module-level _autowired_dependencies(groups, *, existing) that returns
    the name→Provide mapping and owns duplicate-name detection. No public-API or
    behavior change beyond the fix: the UserWarning message, its attribution
    frame, last-write-wins overwrite, and both collision classes (group-vs-group
    and group-vs-already-registered) are preserved.

Packaging

  • modern-di>=2.20.0,<3 (was >=2.19.0). The fix consumes
    Group.get_named_providers(), added in modern-di 2.20.0.

Upgrade

Bump modern-di-litestar to 2.10.0; pip/uv will pull modern-di>=2.20.0.
No code changes required. If you autowire groups that use inheritance, they now
work instead of raising at startup.

Internals

  • 100% line coverage across Python 3.10–3.14; ruff and ty clean.
  • Adopted the portable lesnik512/planning-convention (1.0.0) — planning/
    bundles and the architecture/ truth-home; no runtime impact.