Skip to content

feat: support modern-di 4 - #67

Merged
lesnik512 merged 4 commits into
mainfrom
modern-di-4
Oct 9, 2026
Merged

lesnik512 merged 4 commits into
mainfrom
modern-di-4

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Refs modern-python/modern-di#579.

Summary

  • Widen the requirement to modern-di>=3,<5. The lower bound stays: the plugin uses no 4.0-only API.
  • tests/dependencies.py: the request and websocket helpers took Request[Any, Any, Any] | None = None. modern-di 4.0 ignores the parameter default for a context-backed argument, so the None default no longer means anything. They now take a bare litestar.Request / litestar.WebSocket, as the README example does, and the isinstance asserts go away.

I re-checked the code, tests, README, CONTEXT.md and the ADR for 3.x-only names (ContainerClosedWarning, use_lock, the registries, finalizer_errors, close resetting overrides). None are used. The lifespan comment about ContainerClosedError already describes 4.0 behaviour.

Verification

  • modern-di 3.6.0 (latest on PyPI): lint-ci clean, test-ci 15 passed, 100% coverage. Also 15 passed on the floors (modern-di 3.0.0, litestar 2.23.0).
  • modern-di 4.0 (wheel built from modern-di main f300c2e): ty check clean, 15 passed, 100% coverage.

Stays draft until modern-di 4.0.0 is on PyPI.

@lesnik512
lesnik512 marked this pull request as ready for review October 9, 2026 18:38
@lesnik512
lesnik512 merged commit e98b836 into main Oct 9, 2026
12 checks passed
@lesnik512
lesnik512 deleted the modern-di-4 branch October 9, 2026 18:39
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