diff --git a/mypy-requirements.txt b/mypy-requirements.txt index 8ce7a57c5321..1c372294383d 100644 --- a/mypy-requirements.txt +++ b/mypy-requirements.txt @@ -1,5 +1,4 @@ typing_extensions>=3.10 mypy_extensions>=0.4.3 -importlib_resources; python_version<'3.7' typed_ast>=1.4.0,<2; python_version<'3.8' tomli>=1.1.0; python_version<'3.11' diff --git a/mypy/modulefinder.py b/mypy/modulefinder.py index a97cc35248a6..74b415503c35 100644 --- a/mypy/modulefinder.py +++ b/mypy/modulefinder.py @@ -884,6 +884,6 @@ def parse_version(version: str) -> Tuple[int, int]: def typeshed_py_version(options: Options) -> Tuple[int, int]: """Return Python version used for checking whether module supports typeshed.""" - # Typeshed no longer covers Python 3.x versions before 3.6, so 3.6 is + # Typeshed no longer covers Python 3.x versions before 3.7, so 3.7 is # the earliest we can support. - return max(options.python_version, (3, 6)) + return max(options.python_version, (3, 7)) diff --git a/mypy/stubtest.py b/mypy/stubtest.py index ea59c3a48244..993dd1006178 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -1454,9 +1454,9 @@ def get_typeshed_stdlib_modules( stdlib_py_versions = mypy.modulefinder.load_stdlib_py_versions(custom_typeshed_dir) if version_info is None: version_info = sys.version_info[0:2] - # Typeshed's minimum supported Python 3 is Python 3.6 - if sys.version_info < (3, 6): - version_info = (3, 6) + # Typeshed's minimum supported Python 3 is Python 3.7 + if sys.version_info < (3, 7): + version_info = (3, 7) def exists_in_version(module: str) -> bool: assert version_info is not None diff --git a/mypy/test/teststubtest.py b/mypy/test/teststubtest.py index e004403ec776..bb20e335a035 100644 --- a/mypy/test/teststubtest.py +++ b/mypy/test/teststubtest.py @@ -1412,13 +1412,14 @@ def test_only_py(self) -> None: assert output_str == "Success: no issues found in 1 module\n" def test_get_typeshed_stdlib_modules(self) -> None: - stdlib = mypy.stubtest.get_typeshed_stdlib_modules(None, (3, 6)) + stdlib = mypy.stubtest.get_typeshed_stdlib_modules(None, (3, 7)) assert "builtins" in stdlib assert "os" in stdlib assert "os.path" in stdlib assert "asyncio" in stdlib assert "graphlib" not in stdlib assert "formatter" in stdlib + assert "contextvars" in stdlib # 3.7+ assert "importlib.metadata" not in stdlib stdlib = mypy.stubtest.get_typeshed_stdlib_modules(None, (3, 10)) diff --git a/mypy/util.py b/mypy/util.py index 358db7aa5678..95a8c4730e21 100644 --- a/mypy/util.py +++ b/mypy/util.py @@ -8,12 +8,7 @@ import shutil import sys import time - -try: - from importlib import resources as importlib_resources # type: ignore[attr-defined] -except ImportError: #