mirror of https://github.com/pallets/flask.git
Initial typing support
This enables type checking in CI and marks the project as typed.
This commit is contained in:
parent
c791f6312b
commit
f405c6f19e
|
@ -31,6 +31,7 @@ jobs:
|
||||||
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
|
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
|
||||||
- {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36}
|
- {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36}
|
||||||
- {name: 'PyPy', python: pypy3, os: ubuntu-latest, tox: pypy3}
|
- {name: 'PyPy', python: pypy3, os: ubuntu-latest, tox: pypy3}
|
||||||
|
- {name: Typing, python: '3.9', os: ubuntu-latest, tox: typing}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v2
|
||||||
|
|
|
@ -7,4 +7,5 @@ graft docs
|
||||||
prune docs/_build
|
prune docs/_build
|
||||||
graft examples
|
graft examples
|
||||||
graft tests
|
graft tests
|
||||||
|
include src/flask/py.typed
|
||||||
global-exclude *.pyc
|
global-exclude *.pyc
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
mypy
|
|
@ -0,0 +1,14 @@
|
||||||
|
#
|
||||||
|
# This file is autogenerated by pip-compile
|
||||||
|
# To update, run:
|
||||||
|
#
|
||||||
|
# pip-compile requirements/typing.in
|
||||||
|
#
|
||||||
|
mypy-extensions==0.4.3
|
||||||
|
# via mypy
|
||||||
|
mypy==0.812
|
||||||
|
# via -r requirements/typing.in
|
||||||
|
typed-ast==1.4.3
|
||||||
|
# via mypy
|
||||||
|
typing-extensions==3.7.4.3
|
||||||
|
# via mypy
|
27
setup.cfg
27
setup.cfg
|
@ -85,3 +85,30 @@ max-line-length = 80
|
||||||
per-file-ignores =
|
per-file-ignores =
|
||||||
# __init__ module exports names
|
# __init__ module exports names
|
||||||
src/flask/__init__.py: F401
|
src/flask/__init__.py: F401
|
||||||
|
|
||||||
|
[mypy]
|
||||||
|
files = src/flask
|
||||||
|
python_version = 3.6
|
||||||
|
allow_redefinition = True
|
||||||
|
disallow_subclassing_any = True
|
||||||
|
# disallow_untyped_calls = True
|
||||||
|
# disallow_untyped_defs = True
|
||||||
|
# disallow_incomplete_defs = True
|
||||||
|
no_implicit_optional = True
|
||||||
|
local_partial_types = True
|
||||||
|
# no_implicit_reexport = True
|
||||||
|
strict_equality = True
|
||||||
|
warn_redundant_casts = True
|
||||||
|
warn_unused_configs = True
|
||||||
|
warn_unused_ignores = True
|
||||||
|
# warn_return_any = True
|
||||||
|
# warn_unreachable = True
|
||||||
|
|
||||||
|
[mypy-asgiref.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-blinker.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
||||||
|
[mypy-dotenv.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|
5
tox.ini
5
tox.ini
|
@ -2,6 +2,7 @@
|
||||||
envlist =
|
envlist =
|
||||||
py{39,38,37,36,py3}
|
py{39,38,37,36,py3}
|
||||||
style
|
style
|
||||||
|
typing
|
||||||
docs
|
docs
|
||||||
skip_missing_interpreters = true
|
skip_missing_interpreters = true
|
||||||
|
|
||||||
|
@ -24,6 +25,10 @@ deps = pre-commit
|
||||||
skip_install = true
|
skip_install = true
|
||||||
commands = pre-commit run --all-files --show-diff-on-failure
|
commands = pre-commit run --all-files --show-diff-on-failure
|
||||||
|
|
||||||
|
[testenv:typing]
|
||||||
|
deps = -r requirements/typing.txt
|
||||||
|
commands = mypy
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
deps =
|
deps =
|
||||||
-r requirements/docs.txt
|
-r requirements/docs.txt
|
||||||
|
|
Loading…
Reference in New Issue