Skip to content

Adopt the modern-di integration kit#32

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

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

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

  • Composes modern_di.integrations (shipped in modern-di 2.28.0) instead of hand-rolling the same logic — zero change to public API or test behavior.
  • build_di_container's isinstance-over-tuple connection dispatch is replaced by integrations.classify_connection; the manual try/finally around the child container is replaced by Container's own async with protocol.
  • Dependency's field changes from a raw dependency to marker: integrations.Marker[T_co]; its __call__ becomes self.marker.resolve(request_container). FromDI constructs Dependency(integrations.Marker(dependency)) — its own public signature is unchanged.
  • pyproject.toml's modern-di floor bumped to >=2.28.0,<3.
  • architecture/container-lifecycle.md and architecture/dependency-resolution.md promoted to describe the new internals.

This is a native-DI adapter (FastAPI's own Depends drives resolution), so — unlike the just-shipped modern-di-starlette conversion (modern-di-starlette 2.2.0) — there's no @inject decorator to replace, no parse_markers/resolve_markers usage, and no dead imports result. Second of 13 planned adapter conversions.

Design background: planning/changes/2026-07-13.01-adopt-integration-kit.md.

Test plan

  • just test-ci — 8 passed, 100% line coverage
  • just lint-ci — ruff format/check, ty check, check-planning all clean
  • No test file touched anywhere in this branch — the existing suite is the regression check, and it passed unmodified after every task
  • Built via subagent-driven-development: 5 planned tasks, each with an independent spec+quality review; a whole-branch review before merge — verdict "Ready to merge: Yes", zero findings at any severity

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