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

Tenth 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, typer 2.3.0, grpc 2.1.0, celery 2.1.0). Like typer/celery, arq has no connection/context object — its per-job ctx is a bare dict — so this is a Layer-2-only conversion. Unlike celery, arq has no double-wrap guard either: inject isn't swept, and the existing _WRAPPED_MARKER protects a different concern (a second setup_di call), left untouched.

  • _FromDI deleted; FromDI = integrations.from_di.
  • inject calls integrations.parse_markers directly (_parse_inject_params deleted entirely — its body was an exact duplicate); resolves via integrations.resolve_markers(child, di_params).
  • The task-specific mechanism (the *args/**kwargs decoration-time TypeError guard, by-name signature binding, functools.wraps, and the async def wrapper shape) is preserved exactly unchanged.
  • Dead imports removed: dataclasses, providers, T_co.
  • setup_di and all four lifecycle-hook wrappers are untouched.
  • 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 14 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 ab3f478 into main Jul 13, 2026
6 checks passed
@lesnik512 lesnik512 deleted the integration-kit-conversion branch July 13, 2026 20:30
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