Skip to content

Adopt the modern-di integration kit#27

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

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

Seventh of 13 planned adapter conversions (after starlette 2.2.0, fastapi 2.10.0, litestar 2.13.0, aiohttp 2.2.0, flask 2.1.0, faststream 2.10.0). First conversion where the kit's Layer 1 (bind/classify_connection) has nothing to attach to at all — a CLI invocation has no connection object analogous to a web Request or broker StreamMessage; the only per-invocation object is Click's own typer.Context, which @inject already threads through natively. This is a Layer-2-only conversion.

  • _FromDI deleted; FromDI = integrations.from_di.
  • _parse_inject_params keeps its hand-rolled typer.Context-detection scan (the kit has no equivalent for this typer-specific concern) but delegates marker-finding to integrations.parse_markers.
  • _resolve_di_params deleted; inject's wrapper calls integrations.resolve_markers directly.
  • Dead imports removed: dataclasses, providers (this repo has no module-level connection provider, unlike every prior web/broker conversion), T_co.
  • architecture/injection.md promoted; architecture/scopes.md deliberately left untouched (describes container hierarchy behaviorally, names none of the changed internals).
  • Bumps the modern-di floor to >=2.28.0,<3.

Test plan

  • just test-ci — 100% line coverage, all 11 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; one minor, practically-unreachable finding noted — the hand-rolled Context-detection scan doesn't explicitly skip a return type hint, only reachable if a command were annotated -> typer.Context, which no real Typer command does)

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