Skip to content

Adopt the modern-di integration kit#9

Merged
lesnik512 merged 6 commits into
mainfrom
integration-kit-conversion
Jul 13, 2026
Merged

Adopt the modern-di integration kit#9
lesnik512 merged 6 commits into
mainfrom
integration-kit-conversion

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

modern-di 2.28.0 shipped modern_di.integrations — framework-agnostic primitives that formalize what this package's _di_middleware and @inject/FromDI already hand-roll. This swaps the hand-rolled internals for kit calls. No public-API change; zero test-file changes.

Fourth of 13 planned adapter conversions (after starlette 2.2.0, fastapi 2.10.0, litestar 2.13.0).

  • _di_middleware keeps its own can_prepare() handshake probe to pick between aiohttp_websocket_provider/aiohttp_request_provider (aiohttp is a documented outlier: both providers bind web.Request, so classify_connection's isinstance dispatch can't tell a WebSocket upgrade from a plain request). Once the provider is picked, integrations.bind(provider, request) derives scope/context, wrapped in Container's async with instead of manual try/finally: close_async().
  • _FromDI/_parse_inject_params/_resolve_di_params deleted; FromDI = integrations.from_di; inject now composes integrations.parse_markers/resolve_markers.
  • Dead imports (enum, dataclasses, T_co) removed.
  • Architecture docs (container-lifecycle.md, dependency-resolution.md, glossary.md) promoted to describe the new internals.
  • Bumps the modern-di floor to >=2.28.0,<3.

Test plan

  • just test-ci — 100% line coverage, all 10 tests passing, zero test-file changes
  • just lint-ci — ruff, ty, check-planning all clean
  • Per-task spec + quality review (5 tasks, all approved)
  • Whole-branch review (approved, no findings)

@lesnik512 lesnik512 merged commit d352802 into main Jul 13, 2026
6 checks passed
@lesnik512 lesnik512 deleted the integration-kit-conversion branch July 13, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant