Repository navigation
Reorder ParameterSource #2879
Copy link
Copy link
Closed
Labels
docsUpdates to documentation, readme, docstrings, typosUpdates to documentation, readme, docstrings, typosparsingParsing, parameters, commands, chaining, contextParsing, parameters, commands, chaining, context
Milestone
Description
Activity
I like the idea of having that natural order. Not necessarily to simplify the precedence code (although it might be a nice touch), but so the precedence policy of Click is diffused in the code itself.
As for extending this enum with
CONFIGFILEI was thinking of doing the same for a long time in my own Click Extra project. But nowadays I thinkDEFAULT_MAPis good enough and that's the way to go: have configuration files setting their values toDEFAULT_MAP.That's exactly what I am doing with Click Extra: https://github.com/kdeldycke/click-extra/blob/96719fdcd7916acb03ac2e13f0885aeb0c07d76c/click_extra/config.py#L1100-L1128
- added a commit that references this issue
on Mar 5, 2026 - addeddocsUpdates to documentation, readme, docstrings, typosUpdates to documentation, readme, docstrings, typos
on Mar 5, 2026 - added a commit that references this issue
on Mar 5, 2026 - added a commit that references this issue
on Mar 5, 2026 - added 4 commits that reference this issue
on Apr 8, 2026 A fix has been pushed to
stableand will be part of the 8.3.3 release.- linked a pull request that will close this issueReorder `ParameterSource` #3248
on Apr 16, 2026 - locked as resolved and limited conversation to collaborators
on May 1, 2026 - addedparsingParsing, parameters, commands, chaining, contextParsing, parameters, commands, chaining, contextand removed
on Aug 8, 2026
Metadata
Metadata
Assignees
Labels
docsUpdates to documentation, readme, docstrings, typosUpdates to documentation, readme, docstrings, typosparsingParsing, parameters, commands, chaining, contextParsing, parameters, commands, chaining, context
Please consider sorting ParameterSource in order of "explicitness", as this
would make it easier to test for how explicit a parameter is.
Currently, the values are:
If I want to test whether a parameter has been explicitly provided, I need to
test whether that is not
DEFAULTand notDEFAULT_MAP.Consider this order instead:
Now I can test
x < DEFAULT_MAP. And if #2878 goes anywhere,CONFIGFILEcould be slotted in beforeDEFAULT_MAP.