Adopt the modern-di integration kit#3
Merged
Conversation
…lve_markers/is_injected/mark_injected in main.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
modern-di2.28.0 shippedmodern_di.integrations— framework-agnostic primitives that formalize what this package's_enter_requestand@inject/FromDI/auto_injectalready 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_requestderives scope/context viaintegrations.bind(flask_request_provider, connection)directly — noclassify_connectiondispatch (nothing to dispatch across) and noContainercontext-manager block is introduced (Flask'sbefore_request/teardown_appcontextstay two separate hooks, unchanged in shape)._FromDI/_parse_inject_paramsdeleted;FromDI = integrations.from_di;injectcomposesintegrations.parse_markers/resolve_markers."__modern_di_injected__"string-attribute touch points becomeintegrations.is_injected/integrations.mark_injected.dataclasses,T_co) removed.architecture/dependency-injection.mdpromoted to describe the new internals.modern-difloor to>=2.28,<3.Test plan
just test-ci— 100% line coverage, all 9 tests passing, zero test-file changesjust lint-ci— ruff, ty, check-planning all clean