rasterio has the following code:
@click.option('--all', 'allmd', callback=all_handler, flag_value='like',
is_eager=True, default=False,
help="Copy all metadata items from the template file.")
With click 8.2.1, this produced allmd=False (i.e., a boolean value) when called without argument, but in 8.2.2 is produces allmd='False' (i.e., a string).
I have whittled it down to the following minimal example:
import click
@click.command('edit-info', short_help="Edit dataset metadata.")
@click.option('--all', 'allmd', flag_value='like', default=False)
def edit(allmd):
print(f'HERE is allmd: {allmd!r}')
if __name__ == '__main__':
edit()
That is, specifying flag_value as a string and default=False together produced a string now, but a boolean a release ago.
A bisection points to 9caedb9 as the first bad commit. I have tested against main (i.e., with #3030 merged) as well, but it is not fixed there.
Environment:
- Python version: 3.13.3
- Click version: 8.2.2 and
main (10b77f9)
rasterio has the following code:
With click 8.2.1, this produced
allmd=False(i.e., a boolean value) when called without argument, but in 8.2.2 is producesallmd='False'(i.e., a string).I have whittled it down to the following minimal example:
That is, specifying
flag_valueas a string anddefault=Falsetogether produced a string now, but a boolean a release ago.A bisection points to 9caedb9 as the first bad commit. I have tested against
main(i.e., with #3030 merged) as well, but it is not fixed there.Environment:
main(10b77f9)