Fix DeviceGroup compatibility with click >= 8.2.0#2078
Merged
Conversation
click 8.2.0 inserted a new 'commands' positional parameter into MultiCommand.__init__, shifting all subsequent positional args by one. This caused 'chain' (False) to land as 'subcommand_metavar', resulting in a TypeError when click tried to join format pieces. Fix by passing all arguments as keyword args, which is stable across click versions since the parameter names haven't changed. Fixes #2031
82bc1dc to
4ca008f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2078 +/- ##
==========================================
+ Coverage 83.48% 83.49% +0.01%
==========================================
Files 199 199
Lines 19519 19519
Branches 1058 1058
==========================================
+ Hits 16295 16297 +2
+ Misses 3038 3036 -2
Partials 186 186 ☔ View full report in Codecov by Harness. |
rytilahti
approved these changes
Jun 27, 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.
Summary
commandspositional parameter intoMultiCommand.__init__, shifting all subsequent positional args by one slotchain=Falseto be passed assubcommand_metavar, making click try to" ".join([..., False, ...])→TypeErrorDeviceGroup.__init__— parameter names are unchanged across click versions, so this is fully backwards-compatibleFixes #2031
Test plan
miiocli fanshows help without error with click 8.1.8miiocli fanshows help without error with click 8.2.0+