👽️ Ensure compatibility with Click 8.3.0 by restoring the original value_is_missing
function
#1333
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.
Yesterday's release of Click 8.3.0 has introduced a new internal variable
UNSET
to differentiate between (truly) unset values and user-providedNone
values. As a consequence, the methodParameter.value_is_missing
inclick.core
now checks for thisUNSET
value instead of forNone
.This results in bugs when using the current Typer with Click 8.3.0+, because a required, unset parameter would be
None
in Typer (and not the newUNSET
value) and would eventually get the default value instead of throwing an exception.For instance:
would result in a print
"Hello None"
when calling it without any arguments.Potential solutions
value_is_missing
function to revert it back to its functionality from before 8.3.0. This at least makes the test go green, and allows users to install Click 8.3.0+UNSET
value. This should also allow us to make different choices with respect to optional flags & flag values, cf 🗑️ Deprecate support foris_flag
andflag_value
parameters #987. Maybe with the new functionality in Click, we can restore some of that again. But it would require careful refactoring if we also want to continue support Click 8.2 and lower.Proposal
At this point in time (right before the weekend 🙃) I suggest to merge this PR (option 2), close #1336 (option 1) and continue working on option 3 in the next few weeks.