Repository navigation
Warn for deprecated hookimpl arguments with defaults - #743
Merged
Merged
Conversation
bluetech
approved these changes
Sep 27, 2026
| @@ -0,0 +1 @@ | |||
| Fixed ``warn_on_impl_args`` to warn when a hook implementation requests a deprecated argument with a default. | |||
Member
There was a problem hiding this comment.
We don't need a changelog since it hasn't been released yet (I'll remove it).
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
Make
warn_on_impl_argsinspect hook implementation parameters that have defaults as well as required parameters.Motivation
HookImplstores required parameters inargnamesand defaulted parameters inkwargnames. The current warning check only scansargnames, so a plugin that keeps a deprecated argument working by giving it a default receives no deprecation warning. This contradicts the documented contract that any implementation requesting a configured deprecated argument triggers its warning.Changes
hookimpl.kwargnamesin the warning lookup.This intentionally starts emitting warnings for the previously silent defaulted-argument case, which is the documented purpose of
warn_on_impl_args.Testing
origin/mainwith the new regression: failed because no warning was emitted.uv run pytest: 202 passed.uv run pre-commit run -a: all hooks passed.A towncrier fragment will be added after the PR number is assigned.