Use typing-extensions to ensure certbot dev environment is compatible with Python 3.6/3.7 (#8776)

Fixes #8773

I took option 2 from the issue mentionned above (importing `typing-extensions` on dev dependencies) to avoid modifying certbot runtime requirements given that what needs to be added is useful for mypy only.

I did not change the Python version used to execute the linting and mypy on the standard tests, given that the tox `docker_dev` target already checks if the development environment is working for Python < 3.8.
This commit is contained in:
Adrien Ferrand
2021-04-05 11:53:57 -07:00
committed by GitHub
parent 33f177b361
commit 0f9f902b6e
4 changed files with 11 additions and 8 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ from certbot.tests import acme_util
from certbot.tests import util as test_util
if typing.TYPE_CHECKING:
from typing import Protocol
from typing_extensions import Protocol
else:
Protocol = object # type: ignore
@@ -18,7 +18,7 @@ try:
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
if typing.TYPE_CHECKING:
from typing import Protocol
from typing_extensions import Protocol
else:
Protocol = object # type: ignore
+3
View File
@@ -77,6 +77,9 @@ dev_extras = [
'pytest',
'pytest-cov',
'pytest-xdist',
# typing-extensions is required to import typing.Protocol and make the mypy checks
# pass (along with pylint about non-existent objects) on Python 3.6 & 3.7
'typing-extensions',
'tox',
'twine',
'wheel',