Allow using Click 7 with a DeprecationWarning

As long as popular libraries (e.g. Celery) require click 7, depending
on Click 8 in Flask makes it hard to test the latest version (and its
other dependencies) in existing applications.
This commit is contained in:
Adrian Moennich 2021-04-24 20:01:09 +02:00
parent 1a8549debb
commit 26a6cc0f94
5 changed files with 26 additions and 3 deletions

View file

@ -979,6 +979,13 @@ debug mode.
def main() -> None:
if int(click.__version__[0]) < 8:
warnings.warn(
"Using the `flask` cli with Click 7 is deprecated and"
" will not be supported starting with Flask 2.1."
" Please upgrade to Click 8 as soon as possible.",
DeprecationWarning,
)
# TODO omit sys.argv once https://github.com/pallets/click/issues/536 is fixed
cli.main(args=sys.argv[1:])