fix: make Click flag_value defaults work across Click 8.1-8.3#855
Merged
DavidMinarsch merged 1 commit intomainfrom Mar 9, 2026
Merged
fix: make Click flag_value defaults work across Click 8.1-8.3#855DavidMinarsch merged 1 commit intomainfrom
DavidMinarsch merged 1 commit intomainfrom
Conversation
Click <8.3 ignores default= on flag_value options and uses the last-applied decorator flag_value instead. Click >=8.3 honours default= but treats booleans literally. Use default=None with normalizing wrappers in registry_flag/remote_registry_flag to work across all supported Click versions (>=8.1.0,<8.4.0). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 tasks
LOCKhart07
approved these changes
Mar 9, 2026
Adamantios
approved these changes
Mar 9, 2026
OjusWiZard
approved these changes
Mar 9, 2026
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.
Proposed changes
Summary
Fix registry_flag() and remote_registry_flag() in click_utils.py to use default=None with functools.wraps normalizing wrappers, so the correct configured default is used regardless of Click version
Apply the same default=None + normalization pattern to update_package_versions.py and add comments to packages.py (which already used this pattern)
Add inline documentation explaining the workaround and when it can be removed (Click lower bound raised to >=8.3)
Context
Click <8.3 ignores default= on flag_value options and uses the last-applied decorator's flag_value instead. Click >=8.3 honours default= but treats booleans literally. Previous fixes (PR fetchai#839 using booleans, PR
fetchai#848 using string defaults) each only worked on one Click version. This fix works across the full supported range (>=8.1.0,<8.4.0).
Test plan
Verified registry_flag and remote_registry_flag tests pass on Click 8.1.0
Verified registry_flag and remote_registry_flag tests pass on Click 8.3.1
Verified aea init flag combinations work correctly on both versions
All linters pass (black, isort, flake8, mypy, pylint)
Hash checks pass
Types of changes
What types of changes does your code introduce to agents-aea?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply.mainbranch (left side). Also you should start your branch off ourmain.Further comments