Skip to content

Commit

Permalink
Initial typing support
Browse files Browse the repository at this point in the history
This enables type checking in CI and marks the project as typed.
  • Loading branch information
pgjones committed Apr 26, 2021
1 parent c791f63 commit f405c6f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
- {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
- {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36}
- {name: 'PyPy', python: pypy3, os: ubuntu-latest, tox: pypy3}
- {name: Typing, python: '3.9', os: ubuntu-latest, tox: typing}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ graft docs
prune docs/_build
graft examples
graft tests
include src/flask/py.typed
global-exclude *.pyc
1 change: 1 addition & 0 deletions requirements/typing.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mypy
14 changes: 14 additions & 0 deletions requirements/typing.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 27 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,30 @@ max-line-length = 80
per-file-ignores =
# __init__ module exports names
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
Empty file added src/flask/py.typed
Empty file.
5 changes: 5 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
envlist =
py{39,38,37,36,py3}
style
typing
docs
skip_missing_interpreters = true

Expand All @@ -24,6 +25,10 @@ deps = pre-commit
skip_install = true
commands = pre-commit run --all-files --show-diff-on-failure

[testenv:typing]
deps = -r requirements/typing.txt
commands = mypy

[testenv:docs]
deps =
-r requirements/docs.txt
Expand Down

0 comments on commit f405c6f

Please sign in to comment.