fix: mark repository handler parameters with NamedDependency - #48
Merged
Merged
Conversation
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
Litestar 2.23+ emits a
LitestarDeprecationWarningfor every dependency parameter that is resolved by name without an explicit marker ("Inferred dependencies will stop working in Litestar 3.0"). The test suite printed 216 of these: 8 handlers times 27 app builds.decks_repository/cards_repositoryhandler parameters inapp/api/decks.pyandapp/api/cards.pywithlitestar.di.NamedDependency[...](Litestar 2.24.0, as pinned inuv.lock). The dependency registration inapp/application.pyviamodern_di_litestar.FromDIis unchanged;NamedDependencyonly marks the parameter as injected by name.TCrules globally instead of per-file / inlinenoqa: TC00x. Litestar resolves handler annotations at runtime and modern-di reads creator annotations, so moving those imports intoTYPE_CHECKINGblocks (whichruff --fixwith unsafe fixes would do) breaks app startup. This replaces theapp/resources/*.pyper-file ignore and the six inlinenoqacomments inapp/api/.Test plan
just test: 31 passed, 0 warnings (was 31 passed, 216 warnings)just lint: ruff and ty clean