Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冰.封万里
flask
提交
77db3d5e
F
flask
项目概览
冰.封万里
/
flask
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
flask
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
77db3d5e
编写于
4月 27, 2021
作者:
D
David Lord
提交者:
GitHub
4月 27, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3972 from ThiefMaster/click-7
Allow using Click 7 with a DeprecationWarning
上级
1ccf063f
26a6cc0f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
3 deletion
+26
-3
CHANGES.rst
CHANGES.rst
+4
-1
setup.py
setup.py
+1
-1
src/flask/cli.py
src/flask/cli.py
+7
-0
tests/test_cli.py
tests/test_cli.py
+10
-0
tox.ini
tox.ini
+4
-1
未找到文件。
CHANGES.rst
浏览文件 @
77db3d5e
...
...
@@ -8,7 +8,10 @@ Unreleased
- Drop support for Python 2 and 3.5.
- Bump minimum versions of other Pallets projects: Werkzeug >= 2,
Jinja2 >= 3, MarkupSafe >= 2, ItsDangerous >= 2, Click >= 8. Be sure
to check the change logs for each project.
to check the change logs for each project. For better compatibility
with other applications (e.g. Celery) that still require Click 7,
there is no hard dependency on Click 8 yet, but using Click 7 will
trigger a DeprecationWarning and Flask 2.1 will depend on Click 8.
- JSON support no longer uses simplejson. To use another JSON module,
override ``app.json_encoder`` and ``json_decoder``. :issue:`3555`
- The ``encoding`` option to JSON functions is deprecated. :pr:`3562`
...
...
setup.py
浏览文件 @
77db3d5e
...
...
@@ -7,7 +7,7 @@ setup(
"Werkzeug>=2.0.0rc4"
,
"Jinja2>=3.0.0rc1"
,
"itsdangerous>=2.0.0rc2"
,
"click>=
8.0.0rc1
"
,
"click>=
7.1.2
"
,
],
extras_require
=
{
"async"
:
[
"asgiref>=3.2"
],
...
...
src/flask/cli.py
浏览文件 @
77db3d5e
...
...
@@ -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
:])
...
...
tests/test_cli.py
浏览文件 @
77db3d5e
...
...
@@ -5,6 +5,7 @@ import ssl
import
sys
import
types
from
functools
import
partial
from
unittest.mock
import
patch
import
click
import
pytest
...
...
@@ -21,6 +22,7 @@ from flask.cli import FlaskGroup
from
flask.cli
import
get_version
from
flask.cli
import
load_dotenv
from
flask.cli
import
locate_app
from
flask.cli
import
main
as
cli_main
from
flask.cli
import
NoAppException
from
flask.cli
import
prepare_import
from
flask.cli
import
run_command
...
...
@@ -660,3 +662,11 @@ def test_cli_empty(app):
result
=
app
.
test_cli_runner
().
invoke
(
args
=
[
"blue"
,
"--help"
])
assert
result
.
exit_code
==
2
,
f
"Unexpected success:
\n\n
{
result
.
output
}
"
def
test_click_7_deprecated
():
with
patch
(
"flask.cli.cli"
):
if
int
(
click
.
__version__
[
0
])
<
8
:
pytest
.
deprecated_call
(
cli_main
,
match
=
".* Click 7 is deprecated"
)
else
:
cli_main
()
tox.ini
浏览文件 @
77db3d5e
[tox]
envlist
=
py{39,38,37,36,py3}
py39-click7
style
typing
docs
...
...
@@ -14,7 +15,9 @@ deps =
https://github.com/pallets/markupsafe/archive/master.tar.gz
https://github.com/pallets/jinja/archive/master.tar.gz
https://github.com/pallets/itsdangerous/archive/master.tar.gz
https://github.com/pallets/click/archive/master.tar.gz
!click7:
https://github.com/pallets/click/archive/master.tar.gz
click7:
click<8
examples/tutorial
[test]
examples/javascript
[test]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录