[BUG] Package not working for python < 3.8 #98

Closed
opened 2022-10-26 11:29:54 +02:00 by jazzbah · 4 comments
  • I have read and understood the FAQ

Describe the bug

The latest version (1.0.7) can't be used on an environment with python < 3.8 due to an import error.

To Reproduce

  1. Set-up an environment with python 3.7.
  2. Run python -m pip install py3-validate-email
  3. Create a python file with code
from validate_email import validate_email
is_valid = validate_email(
    email_address='example@example.com',
    check_format=True,
    check_blacklist=True,
    check_dns=True,
    dns_timeout=10,
    check_smtp=True,
    smtp_timeout=10,
    smtp_helo_host='my.host.name',
    smtp_from_address='my@from.addr.ess',
    smtp_skip_tls=False,
    smtp_tls_context=None,
    smtp_debug=False,
   address_types=frozenset([IPv4Address, IPv6Address]))
  1. Execute the script

My debug output

from typing import List, Literal, FrozenSet, Union, Type
ImportError: cannot import name 'Literal' from 'typing' (/usr/local/lib/python3.7/typing.py)

Expected behavior

The script runs on python 3.6 & python 3.7

Please complete the following information:

  • OS: Linux
  • Your exact py3-validate-email module version: 1.0.7

Additional context

- [x] I have read and understood the [FAQ](https://gitea.ksol.io/karolyi/py3-validate-email/src/branch/master/FAQ.md) **Describe the bug** The latest version (1.0.7) can't be used on an environment with python < 3.8 due to an import error. **To Reproduce** 1. Set-up an environment with python 3.7. 2. Run `python -m pip install py3-validate-email` 3. Create a python file with code ``` from validate_email import validate_email is_valid = validate_email( email_address='example@example.com', check_format=True, check_blacklist=True, check_dns=True, dns_timeout=10, check_smtp=True, smtp_timeout=10, smtp_helo_host='my.host.name', smtp_from_address='my@from.addr.ess', smtp_skip_tls=False, smtp_tls_context=None, smtp_debug=False, address_types=frozenset([IPv4Address, IPv6Address])) ``` 4. Execute the script **My debug output** ``` from typing import List, Literal, FrozenSet, Union, Type ImportError: cannot import name 'Literal' from 'typing' (/usr/local/lib/python3.7/typing.py) ``` **Expected behavior** The script runs on python 3.6 & python 3.7 **Please complete the following information:** - OS: Linux - Your exact `py3-validate-email` module version: 1.0.7 **Additional context** - https://docs.python.org/3/library/typing.html#typing.Literal is only available in python 3.8
Owner

Damn, thanks for the report.

Is there a way for you to use a newer python version? I'd like to keep the Literal import and bump the minimum required version for python.

If not, I need to remove the import (or make it optional).

Damn, thanks for the report. Is there a way for you to use a newer python version? I'd like to keep the `Literal` import and bump the minimum required version for python. If not, I need to remove the import (or make it optional).
Owner

Another option would be to require typing_extensions for this project, which is kinda an overreach: https://pypi.org/project/typing-extensions/

Another option would be to require typing_extensions for this project, which is kinda an overreach: https://pypi.org/project/typing-extensions/
Author

For now we are using version 1.0.5, which does not have this import yet, thus works, but we won't be able to upgrade then...
We will upgrade to python >= 3.8 eventually, but not posible short term.

For now we are using version 1.0.5, which does not have this import yet, thus works, but we won't be able to upgrade then... We will upgrade to python >= 3.8 eventually, but not posible short term.
karolyi referenced this issue from a commit 2022-10-29 12:04:18 +02:00
Owner

py3-validate-email 1.0.8 is now available at your convenience.

Please consider upgrading your python version ASAP, since I plan to deprecate older python versions over time, as I can't guarantee keeping them supported in the future.

py3-validate-email 1.0.8 is now available at your convenience. Please consider upgrading your python version ASAP, since I plan to deprecate older python versions over time, as I can't guarantee keeping them supported in the future.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: karolyi/py3-validate-email#98
No description provided.