GeezerVison is showing github.com — Deprecate parameter names that are: not a Python identifier, or a Python Keyword, or not lower-cased by kdeldycke · Pull Request #3866 · pallets/click
Conversation
kdeldycke
commented
Sep 11, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
This PR prepares the ground for #3827, which is going to refuse parameter names that are not valid Python identifiers.
This add DeprecationWarning that detect when Parameter, Argument or Option gets a name that will be not allowed in the future 9.0.0 release:
- a parameter that is not a Python identifier (check against
str.identifier)
- a parameter that is a Python keyword (check against
keyword.iskeyword)
- an option name that is nor lower-cased
This PR also copy the majority of tests that were originally proposed in #3827, so the behavior of the name is locked down and frozen. This will prevent tweaking or introducing regressions during the full 8.x cycle.
This PR also inaugurate the 8.6.0 release on main.
Historical details
Of course, I fucked-up the same way I fucked-up 2 months ago with #3701 , when juggling between main and stable branches made me push to stable. 😫
So:
- I pushed by mistake e2bddbc
- I reverted my mistake on
stable with d036881
- And this PR is what it should have been all along
Anyway, this was resolved by resyncing both branches with #3876 .
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
What do you think, should we also check keyword.iskeyword? Might be good to warn about it and see if anything comes up.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
What do you think, should we also check keyword.iskeyword? Might be good to warn about it and see if anything comes up.
Ah. That might be a good idea: test drive that check during a long 8.x cycle and see if it show up... If I implement this, what kind of severity should it triggers? A DeprecationWarning like non-Python-IDs ?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Deprecation seems fine. Like I said in the other thread, it could be more disruptive, but it also seems to match the intention of the str.isidentifier check.
|
kdeldycke reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Just implemented the double isidentifier() / iskeyword() deprecation check in a common _check_name_is_usable() internal function. The later is maybe a bit too verbose as I distinguished the 2 cases and reused the deprecation explanation from docs/upgrade-guides.md. Can make it way smaller if you want to.
This is ready to be reviewed for eventual merge.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
kdeldycke
changed the title
Deprecate a parameter name that is not a Python identifier
Deprecate parameter names that are: not a Python identifier, or a Python Keyword, or not lower-cased
Sep 21, 2026
|
@kdeldycke this should merge into main. I don't we should issue new deprecations on bug fix versions.
|
davidism reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
@kdeldycke this should merge into main. I don't we should issue new deprecations on bug fix versions.
OK make sense. So I retargeted the main branch, added a new commit in this PR to inaugurate the 8.6.0 release and updated the doc to target that release. And this time I hope I did not made any mistake juggling with the two branches... 🫣
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
davidism
Awaiting requested review from davidism
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
parsing
Parsing, parameters, commands, chaining, context
tests
Click's own test suite and CI workflows
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|