diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 55d7f84..35c5a55 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml @@ -21,4 +21,6 @@ jobs: python -m pip install --upgrade pip pip install tox tox-gh-actions - name: Test with tox - run: tox \ No newline at end of file + run: tox + - name: Test with pytest + run: pytest tests \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index df9a0e5..a0b8c04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,4 +29,5 @@ - Fixed some broken test cases. - Added some more test cases. - Fixed the Variable name issue at `config.ConnectionConfig` class. -- Now the users are allowed to create custom headers for attachments. \ No newline at end of file +- Now the users are allowed to create custom headers for attachments. +- Fixed Literal import for Python 3.6 and 3.7 \ No newline at end of file diff --git a/Makefile b/Makefile index 7b1fba3..695a051 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ format: black $(sources) tests # lint: -# flake8 $(sources) tests +# pylint $(sources) tests unittest: pytest diff --git a/README.md b/README.md index 1a19605..29708e0 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,6 @@ Flask-Mailing adds SMTP mail sending to your Flask applications **Flask_Mail** is dead now. This is the time to migrate a fully asynchronous based mailer library to send emails while using a Flask based application. Now Flask 2.0 supports the asynchronous view function then who is stopping you to use __Flask-Mailing__ ? -Flask-Mailing is a fork of `Sabuhi's` Fastapi-Mail package, providing similar functionality. 99% of the work was done by him, and the fork was made mainly provide the same features and the apis for the Flask Microframework. - __The key features are:__ - Most of the Apis are very familiar with `Flask-Mail` module. @@ -97,6 +95,7 @@ Thanks goes to these wonderful people ([🚧]):
Aniket Sarkar

💬 👀 🚧

Joshua Kinslow

+
Alexandre Gramfort

diff --git a/flask_mailing/mail.py b/flask_mailing/mail.py index 1db2265..6737624 100644 --- a/flask_mailing/mail.py +++ b/flask_mailing/mail.py @@ -50,7 +50,8 @@ def _record(message): class Mail(_MailMixin): """ - Fastapi mail system sending mails(individual, bulk) attachments(individual, bulk) + Fastapi mail system sending mails(individual, bulk) + attachments(individual, bulk). :param config: Connection config to be passed diff --git a/flask_mailing/msg.py b/flask_mailing/msg.py index 7e7714a..97a7e46 100644 --- a/flask_mailing/msg.py +++ b/flask_mailing/msg.py @@ -44,31 +44,7 @@ def _mimetext(self, text, subtype="plain"): return MIMEText(text, _subtype=subtype, _charset=self.charset) - # async def attach_file(self, message, attachment: t.List["FileStorage"]): - # for file in attachment: - - # part = MIMEBase(_maintype="application", _subtype="octet-stream") - - # part.set_payload(file.read()) - # encode_base64(part) - - # filename = file.filename - - # try: - # filename and filename.encode("ascii") - # except UnicodeEncodeError: - # if not PY3: - # filename = filename.encode("utf8") - - # filename = ("UTF8", "", filename) - # disposition: str = getattr(file, "disposition", "attachment") - # part.add_header("Content-Disposition", disposition, filename=filename) - - # self.message.attach(part) - - # file.close() # close the file stream - - async def attach_file(self, message, attachment): + async def attach_file(self, message, attachment: t.List["FileStorage"]): """Creates a MIMEBase object""" for file, file_meta in attachment: if file_meta and "mime_type" in file_meta and "mime_subtype" in file_meta: diff --git a/flask_mailing/schemas.py b/flask_mailing/schemas.py index 751db29..6698531 100644 --- a/flask_mailing/schemas.py +++ b/flask_mailing/schemas.py @@ -1,6 +1,6 @@ -import sys import io import os +import sys from enum import Enum from mimetypes import MimeTypes from typing import Dict, List, Optional, Union @@ -10,7 +10,6 @@ else: from typing_extensions import Literal - from pydantic import BaseModel, EmailStr, validator from werkzeug.datastructures import FileStorage diff --git a/tests/requirements.testing.txt b/tests/requirements.testing.txt index 60ca11a..7c80312 100644 --- a/tests/requirements.testing.txt +++ b/tests/requirements.testing.txt @@ -12,5 +12,4 @@ pytest>=6.2.5 pytest-asyncio>=0.16.0 anyio>=3.3.1 black -isort -flake8 \ No newline at end of file +isort \ No newline at end of file diff --git a/tests/test_connection.py b/tests/test_connection.py index ad1beb0..49f52e5 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1,4 +1,4 @@ -import os as os +import os import typing as t import pytest as pt