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 #221

Merged
merged 1 commit into from
May 23, 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 @@ -36,3 +36,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@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- 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
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ Unreleased
- Use `pyproject.toml` for packaging metadata.
- Use `flit_core` as build backend.
- Apply code formatting and linting tools.
- Add static type annotations.
- Deprecate the `__version__` attribute. Use feature detection or
`importlib.metadata.version("flask-mail")` instead.
- Indicate that the deprecated `is_bad_headers` will be removed in the next
version.
- Fix the `email_dispatched` signal to pass the current app as the sender and
`message` as an argument, rather than the other way around.
- `Attachment.data` may not be `None`.
- `Attachment.content_type` will be detected based on `filename` and `data`
and will not be `None`.


## Version 0.9.1
Expand Down
2 changes: 1 addition & 1 deletion 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 @@ -75,7 +76,6 @@ select = [
"UP", # pyupgrade
"W", # pycodestyle warning
]
ignore-init-module-imports = true

[tool.ruff.lint.isort]
force-single-line = true
Expand Down
56 changes: 0 additions & 56 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@
#
# pip-compile dev.in
#
blinker==1.8.2
# via
# -r typing.txt
# flask
cachetools==5.3.3
# via tox
cfgv==3.4.0
# via pre-commit
chardet==5.2.0
# via tox
click==8.1.7
# via
# -r typing.txt
# flask
colorama==0.4.6
# via tox
distlib==0.3.8
Expand All @@ -31,38 +23,13 @@ filelock==3.14.0
# via
# tox
# virtualenv
flask==3.0.3
# via
# -r typing.txt
# flask-sqlalchemy
flask-sqlalchemy==3.1.1
# via -r typing.txt
identify==2.5.36
# via pre-commit
importlib-metadata==7.1.0
# via
# -r typing.txt
# flask
iniconfig==2.0.0
# via
# -r tests.txt
# -r typing.txt
# pytest
itsdangerous==2.2.0
# via
# -r typing.txt
# flask
jinja2==3.1.4
# via
# -r typing.txt
# flask
markupsafe==2.1.5
# via
# -r typing.txt
# jinja2
# werkzeug
mock==5.1.0
# via -r tests.txt
mypy==1.10.0
# via -r typing.txt
mypy-extensions==1.0.0
Expand Down Expand Up @@ -105,10 +72,6 @@ pyyaml==6.0.1
# via pre-commit
speaklater==1.3
# via -r tests.txt
sqlalchemy==2.0.30
# via
# -r typing.txt
# flask-sqlalchemy
tomli==2.0.1
# via
# -r tests.txt
Expand All @@ -119,33 +82,14 @@ 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.18.0.20240506
# via -r typing.txt
types-setuptools==69.5.0.20240522
# via
# -r typing.txt
# types-pygments
typing-extensions==4.11.0
# via
# -r typing.txt
# mypy
# sqlalchemy
virtualenv==20.26.2
# via
# pre-commit
# tox
werkzeug==3.0.3
# via
# -r typing.txt
# flask
zipp==3.18.2
# via
# -r typing.txt
# importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
1 change: 0 additions & 1 deletion requirements/tests.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pytest
speaklater
2 changes: 0 additions & 2 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ pluggy==1.5.0
# via pytest
pytest==8.2.1
# via -r tests.in
speaklater==1.3
# via -r tests.in
tomli==2.0.1
# via pytest
Loading