Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add static type annotations #259

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,19 @@ jobs:
cache-dependency-path: requirements*/*.txt
- run: pip install tox
- run: tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
typing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.x'
cache: pip
cache-dependency-path: requirements*/*.txt
- name: cache mypy
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ./.mypy_cache
key: mypy|${{ hashFiles('pyproject.toml') }}
- run: pip install tox
- run: tox run -e typing
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ classifiers = [
"Framework :: Flask",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Typing :: Typed",
]
requires-python = ">=3.8"
dependencies = [
Expand Down Expand Up @@ -50,6 +51,12 @@ show_error_codes = true
pretty = true
strict = true

[[tool.mypy.overrides]]
module = [
"sqlparse.*"
]
ignore_missing_imports = true

[tool.pyright]
pythonVersion = "3.8"
include = ["src/flask_debugtoolbar", "tests"]
Expand Down
24 changes: 23 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ babel==2.14.0
blinker==1.8.1
# via
# -r tests.txt
# -r typing.txt
# flask
cachetools==5.3.3
# via tox
Expand All @@ -33,6 +34,7 @@ charset-normalizer==3.3.2
click==8.1.7
# via
# -r tests.txt
# -r typing.txt
# flask
colorama==0.4.6
# via tox
Expand All @@ -54,9 +56,12 @@ filelock==3.14.0
flask==3.0.3
# via
# -r tests.txt
# -r typing.txt
# flask-sqlalchemy
flask-sqlalchemy==3.1.1
# via -r tests.txt
# via
# -r tests.txt
# -r typing.txt
identify==2.5.36
# via pre-commit
idna==3.7
Expand All @@ -71,6 +76,7 @@ importlib-metadata==7.1.0
# via
# -r docs.txt
# -r tests.txt
# -r typing.txt
# flask
# sphinx
iniconfig==2.0.0
Expand All @@ -81,17 +87,20 @@ iniconfig==2.0.0
itsdangerous==2.2.0
# via
# -r tests.txt
# -r typing.txt
# flask
jinja2==3.1.3
# via
# -r docs.txt
# -r tests.txt
# -r typing.txt
# flask
# sphinx
markupsafe==2.1.5
# via
# -r docs.txt
# -r tests.txt
# -r typing.txt
# jinja2
# werkzeug
mypy==1.10.0
Expand Down Expand Up @@ -190,6 +199,7 @@ sphinxcontrib-serializinghtml==1.1.5
sqlalchemy==2.0.29
# via
# -r tests.txt
# -r typing.txt
# flask-sqlalchemy
tomli==2.0.1
# via
Expand All @@ -201,6 +211,16 @@ tomli==2.0.1
# tox
tox==4.15.0
# via -r dev.in
types-docutils==0.21.0.20240423
# via
# -r typing.txt
# types-pygments
types-pygments==2.17.0.20240310
# via -r typing.txt
types-setuptools==69.5.0.20240423
# via
# -r typing.txt
# types-pygments
typing-extensions==4.11.0
# via
# -r tests.txt
Expand All @@ -218,11 +238,13 @@ virtualenv==20.26.1
werkzeug==3.0.2
# via
# -r tests.txt
# -r typing.txt
# flask
zipp==3.18.1
# via
# -r docs.txt
# -r tests.txt
# -r typing.txt
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
Expand Down
2 changes: 2 additions & 0 deletions requirements/typing.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mypy
pyright
pytest
types-pygments
flask-sqlalchemy
34 changes: 33 additions & 1 deletion requirements/typing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,28 @@
#
# pip-compile typing.in
#
blinker==1.8.1
# via flask
click==8.1.7
# via flask
exceptiongroup==1.2.1
# via pytest
flask==3.0.3
# via flask-sqlalchemy
flask-sqlalchemy==3.1.1
# via -r typing.in
importlib-metadata==7.1.0
# via flask
iniconfig==2.0.0
# via pytest
itsdangerous==2.2.0
# via flask
jinja2==3.1.3
# via flask
markupsafe==2.1.5
# via
# jinja2
# werkzeug
mypy==1.10.0
# via -r typing.in
mypy-extensions==1.0.0
Expand All @@ -22,12 +40,26 @@ pyright==1.1.360
# via -r typing.in
pytest==8.2.0
# via -r typing.in
sqlalchemy==2.0.29
# via flask-sqlalchemy
tomli==2.0.1
# via
# mypy
# pytest
types-docutils==0.21.0.20240423
# via types-pygments
types-pygments==2.17.0.20240310
# via -r typing.in
types-setuptools==69.5.0.20240423
# via types-pygments
typing-extensions==4.11.0
# via mypy
# via
# mypy
# sqlalchemy
werkzeug==3.0.2
# via flask
zipp==3.18.1
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
Loading