Skip to content
Myr

Merge pull request #3972 from ThiefMaster/click-7

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Allow using Click 7 with a DeprecationWarning

authored by David Lord · committed by GitHub · parents 1ccf063, 26a6cc0 · Browse files · 5 files+26 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+26 added−3 removed

  • tests:+10 added−0 removed
  • other:+16 added−3 removed

5 files+26 added−3 removed

modified:src/flask/cli.py+7 added
977 unmodified lines
978)979980981def main() -> None:982 if int(click.__version__[0]) < 8:983 warnings.warn(984 "Using the `flask` cli with Click 7 is deprecated and"985 " will not be supported starting with Flask 2.1."986 " Please upgrade to Click 8 as soon as possible.",987 DeprecationWarning,988 )989 # TODO omit sys.argv once https://github.com/pallets/click/issues/536 is fixed990 cli.main(args=sys.argv[1:])991992
2 unmodified lines
modified:tests/test_cli.py+10 added
3 unmodified lines
4import ssl5import sys6import types7from functools import partial8from unittest.mock import patch910import click11import pytest12from _pytest.monkeypatch import notset
8 unmodified lines
21from flask.cli import FlaskGroup22from flask.cli import get_version23from flask.cli import load_dotenv24from flask.cli import locate_app25from flask.cli import main as cli_main26from flask.cli import NoAppException27from flask.cli import prepare_import28from flask.cli import run_command29from flask.cli import ScriptInfo
631 unmodified lines
661 app.register_blueprint(bp)662663 result = app.test_cli_runner().invoke(args=["blue", "--help"])664 assert result.exit_code == 2, f"Unexpected success:\n\n{result.output}"665666667def test_click_7_deprecated():668 with patch("flask.cli.cli"):669 if int(click.__version__[0]) < 8:670 pytest.deprecated_call(cli_main, match=".* Click 7 is deprecated")671 else:672 cli_main()
modified:CHANGES.rst+4 added-1 removed
6 unmodified lines
78- Drop support for Python 2 and 3.5.9- Bump minimum versions of other Pallets projects: Werkzeug >= 2,10 Jinja2 >= 3, MarkupSafe >= 2, ItsDangerous >= 2, Click >= 8. Be sure11 to check the change logs for each project.11 to check the change logs for each project. For better compatibility12 with other applications (e.g. Celery) that still require Click 7,13 there is no hard dependency on Click 8 yet, but using Click 7 will14 trigger a DeprecationWarning and Flask 2.1 will depend on Click 8.15- JSON support no longer uses simplejson. To use another JSON module,16 override ``app.json_encoder`` and ``json_decoder``. :issue:`3555`17- The ``encoding`` option to JSON functions is deprecated. :pr:`3562`18- Passing ``script_info`` to app factory functions is deprecated. This
1080 unmodified lines
modified:setup.py+1 added-1 removed
5 unmodified lines
6 install_requires=[7 "Werkzeug>=2.0.0rc4",8 "Jinja2>=3.0.0rc1",9 "itsdangerous>=2.0.0rc2",10 "click>=8.0.0rc1",10 "click>=7.1.2",11 ],12 extras_require={13 "async": ["asgiref>=3.2"],14 "dotenv": ["python-dotenv"],
2 unmodified lines
modified:tox.ini+4 added-1 removed
1[tox]2envlist =3 py{39,38,37,36,py3}4 py39-click75 style6 typing7 docs8skip_missing_interpreters = true
5 unmodified lines
14 https://github.com/pallets/werkzeug/archive/master.tar.gz15 https://github.com/pallets/markupsafe/archive/master.tar.gz16 https://github.com/pallets/jinja/archive/master.tar.gz17 https://github.com/pallets/itsdangerous/archive/master.tar.gz17 https://github.com/pallets/click/archive/master.tar.gz1819 !click7: https://github.com/pallets/click/archive/master.tar.gz20 click7: click<82122 examples/tutorial[test]23 examples/javascript[test]24commands = pytest -v --tb=short --basetemp={envtmpdir} {posargs:tests examples}25
15 unmodified lines