diff --git a/.github/workflows/test_and_build.yaml b/.github/workflows/test_and_build.yaml index e80acd6..6a1d890 100644 --- a/.github/workflows/test_and_build.yaml +++ b/.github/workflows/test_and_build.yaml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12.0-alpha.5"] + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3a283dc..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -os: linux -dist: bionic -language: python -cache: pip - -python: -- '3.7' -- '3.8' -- '3.9' -- '3.10' -- '3.11' -- '3.12-dev' - -install: -- make install - -script: -- make typing -- make lint -- make test - -after_success: -- bash <(curl -s https://codecov.io/bash) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48a31c6..fe1025d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +In Development +-------------- + +* Python 3.8 is now required. +* The email address argument to validate_email is now marked as positional-only to better reflect the documented usage using the new Python 3.8 feature. + 2.0.0 (April 15, 2023) ---------------------- diff --git a/README.md b/README.md index 60077ca..9f142f1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ email-validator: Validate Email Addresses ========================================= A robust email address syntax and deliverability validation library for -Python 3.7+ by [Joshua Tauberer](https://joshdata.me). +Python by [Joshua Tauberer](https://joshdata.me). This library validates that a string is of the form `name@example.com` and optionally checks that the domain name is set up to receive email. diff --git a/email_validator/syntax.py b/email_validator/syntax.py index abb4ea9..7287476 100644 --- a/email_validator/syntax.py +++ b/email_validator/syntax.py @@ -69,8 +69,7 @@ def validate_email_local_part(local: str, allow_smtputf8: bool = True, allow_emp # so if it was originally quoted (quoted_local_part is True) and this regex matches, # it's ok. # (RFC 5321 4.1.2 / RFC 5322 3.2.4). - m = DOT_ATOM_TEXT.match(local) - if m: + if DOT_ATOM_TEXT.match(local): # It's valid. And since it's just the permitted ASCII characters, # it's normalized and safe. If the local part was originally quoted, # the quoting was unnecessary and it'll be returned as normalized to @@ -89,8 +88,7 @@ def validate_email_local_part(local: str, allow_smtputf8: bool = True, allow_emp # RFC 6531 section 3.3. valid: Optional[str] = None requires_smtputf8 = False - m = DOT_ATOM_TEXT_INTL.match(local) - if m: + if DOT_ATOM_TEXT_INTL.match(local): # But international characters in the local part may not be permitted. if not allow_smtputf8: # Check for invalid characters against the non-internationalized @@ -347,8 +345,7 @@ def validate_email_domain_name(domain, test_environment=False, globally_delivera # Check the syntax of the string returned by idna.encode. # It should never fail. - m = DOT_ATOM_TEXT_HOSTNAME.match(ascii_domain) - if not m: + if not DOT_ATOM_TEXT_HOSTNAME.match(ascii_domain): raise EmailSyntaxError("The email address contains invalid characters after the @-sign after IDNA encoding.") # Check the length of the domain name in bytes. diff --git a/email_validator/validate_email.py b/email_validator/validate_email.py index 0d8f581..0d2e7a8 100644 --- a/email_validator/validate_email.py +++ b/email_validator/validate_email.py @@ -7,8 +7,8 @@ def validate_email( email: Union[str, bytes], - # /, # not supported in Python 3.6, 3.7 - *, + /, # prior arguments are positional-only + *, # subsequent arguments are keyword-only allow_smtputf8: Optional[bool] = None, allow_empty_local: bool = False, allow_quoted_local: Optional[bool] = None, @@ -58,8 +58,7 @@ def validate_email( # part if the local part is quoted. If the address is quoted, # split it at a non-escaped @-sign and unescape the escaping. quoted_local_part = False - m = QUOTED_LOCAL_PART_ADDR.match(email) - if m: + if m := QUOTED_LOCAL_PART_ADDR.match(email): quoted_local_part = True local_part, domain_part = m.groups() diff --git a/setup.cfg b/setup.cfg index d299498..85d227f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,7 +14,6 @@ classifiers = Intended Audience :: Developers License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 @@ -27,7 +26,7 @@ packages = find: install_requires = dnspython>=2.0.0 # optional if deliverability check isn't needed idna>=2.0.0 -python_requires = >=3.7 +python_requires = >=3.8 [options.package_data] * = py.typed diff --git a/test_requirements.txt b/test_requirements.txt index 5f11247..459c5d0 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,5 +1,5 @@ # This file was generated by running: -# sudo docker run --rm -it --network=host python:3.7-slim /bin/bash +# sudo docker run --rm -it --network=host python:3.8-slim /bin/bash # pip install dnspython idna # from setup.cfg # pip install pytest pytest-cov coverage flake8 mypy # pip freeze @@ -7,24 +7,20 @@ # the earliest Python version we support, and some exception # messages may depend on package versions, so we pin versions # for reproducible testing.) -attrs==22.2.0 -coverage==7.2.1 +coverage==7.2.7 dnspython==2.3.0 -exceptiongroup==1.1.0 -flake8==5.0.4 +exceptiongroup==1.1.1 +flake8==6.0.0 idna==3.4 -importlib-metadata==4.2.0 iniconfig==2.0.0 mccabe==0.7.0 -mypy==1.0.1 +mypy==1.4.1 mypy-extensions==1.0.0 -packaging==23.0 -pluggy==1.0.0 -pycodestyle==2.9.1 -pyflakes==2.5.0 -pytest==7.2.1 -pytest-cov==4.0.0 +packaging==23.1 +pluggy==1.2.0 +pycodestyle==2.10.0 +pyflakes==3.0.1 +pytest==7.4.0 +pytest-cov==4.1.0 tomli==2.0.1 -typed-ast==1.5.4 -typing_extensions==4.5.0 -zipp==3.15.0 +typing_extensions==4.7.0