Skip to content

Adopt the modern-di integration kit#3

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

Adopt the modern-di integration kit#3
lesnik512 merged 5 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 _enter_request and @inject/FromDI/auto_inject already hand-roll. This swaps the hand-rolled internals for kit calls. No public-API change; zero test-file changes.

Fifth of 13 planned adapter conversions (after starlette 2.2.0, fastapi 2.10.0, litestar 2.13.0, aiohttp 2.2.0). The simplest conversion so far: Flask has exactly one connection type and is fully synchronous, so _enter_request derives scope/context via integrations.bind(flask_request_provider, connection) directly — no classify_connection dispatch (nothing to dispatch across) and no Container context-manager block is introduced (Flask's before_request/teardown_appcontext stay two separate hooks, unchanged in shape).

  • _FromDI/_parse_inject_params deleted; FromDI = integrations.from_di; inject composes integrations.parse_markers/resolve_markers.
  • The three hand-written "__modern_di_injected__" string-attribute touch points become integrations.is_injected/integrations.mark_injected.
  • Dead imports (dataclasses, T_co) removed.
  • architecture/dependency-injection.md promoted to describe the new internals.
  • Bumps the modern-di floor to >=2.28,<3.

Test plan

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

@lesnik512 lesnik512 merged commit 7619468 into main Jul 13, 2026
6 checks passed
@lesnik512 lesnik512 deleted the integration-kit-conversion branch July 13, 2026 14:24
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