diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 96b51fbafb..207d58fac7 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -57,7 +57,7 @@ jobs: max-parallel: 15 fail-fast: false matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9'] + python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.8', 'pypy-3.9'] test-type: ['standalone', 'cluster'] connection-type: ['hiredis', 'plain'] env: @@ -111,7 +111,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.7', '3.11'] + python-version: ['3.8', '3.11'] test-type: ['standalone', 'cluster'] connection-type: ['hiredis', 'plain'] protocol: ['3'] @@ -160,7 +160,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9'] + python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.8', 'pypy-3.9'] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 diff --git a/redis/_parsers/hiredis.py b/redis/_parsers/hiredis.py index 1919d3658e..a52dbbd013 100644 --- a/redis/_parsers/hiredis.py +++ b/redis/_parsers/hiredis.py @@ -1,15 +1,13 @@ import asyncio import socket import sys -from typing import Callable, List, Optional, Union +from typing import Callable, List, Optional, TypedDict, Union if sys.version_info.major >= 3 and sys.version_info.minor >= 11: from asyncio import timeout as async_timeout else: from async_timeout import timeout as async_timeout -from redis.compat import TypedDict - from ..exceptions import ConnectionError, InvalidResponse, RedisError from ..typing import EncodableT from ..utils import HIREDIS_AVAILABLE diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py index eea9612f4a..79689fcb5e 100644 --- a/redis/asyncio/client.py +++ b/redis/asyncio/client.py @@ -15,9 +15,11 @@ Mapping, MutableMapping, Optional, + Protocol, Set, Tuple, Type, + TypedDict, TypeVar, Union, cast, @@ -55,7 +57,6 @@ AsyncSentinelCommands, list_or_args, ) -from redis.compat import Protocol, TypedDict from redis.credentials import CredentialProvider from redis.exceptions import ( ConnectionError, diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py index 39f75a5f13..df2bd20f9f 100644 --- a/redis/asyncio/connection.py +++ b/redis/asyncio/connection.py @@ -17,9 +17,11 @@ List, Mapping, Optional, + Protocol, Set, Tuple, Type, + TypedDict, TypeVar, Union, ) @@ -34,7 +36,6 @@ from redis.asyncio.retry import Retry from redis.backoff import NoBackoff -from redis.compat import Protocol, TypedDict from redis.connection import DEFAULT_RESP_VERSION from redis.credentials import CredentialProvider, UsernamePasswordCredentialProvider from redis.exceptions import ( diff --git a/redis/commands/cluster.py b/redis/commands/cluster.py index af3a717c27..8dd463ed18 100644 --- a/redis/commands/cluster.py +++ b/redis/commands/cluster.py @@ -7,13 +7,13 @@ Iterable, Iterator, List, + Literal, Mapping, NoReturn, Optional, Union, ) -from redis.compat import Literal from redis.crc import key_slot from redis.exceptions import RedisClusterException, RedisError from redis.typing import ( diff --git a/redis/commands/core.py b/redis/commands/core.py index 8fbd0d9104..5d7b774dc3 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -12,6 +12,7 @@ Iterable, Iterator, List, + Literal, Mapping, Optional, Sequence, @@ -20,7 +21,6 @@ Union, ) -from redis.compat import Literal from redis.exceptions import ConnectionError, DataError, NoScriptError, RedisError from redis.typing import ( AbsExpiryT, diff --git a/redis/compat.py b/redis/compat.py deleted file mode 100644 index e478493467..0000000000 --- a/redis/compat.py +++ /dev/null @@ -1,6 +0,0 @@ -# flake8: noqa -try: - from typing import Literal, Protocol, TypedDict # lgtm [py/unused-import] -except ImportError: - from typing_extensions import Literal # lgtm [py/unused-import] - from typing_extensions import Protocol, TypedDict diff --git a/redis/typing.py b/redis/typing.py index d1cd5568a3..a5d1369d63 100644 --- a/redis/typing.py +++ b/redis/typing.py @@ -7,13 +7,12 @@ Awaitable, Iterable, Mapping, + Protocol, Type, TypeVar, Union, ) -from redis.compat import Protocol - if TYPE_CHECKING: from redis._parsers import Encoder from redis.asyncio.connection import ConnectionPool as AsyncConnectionPool diff --git a/setup.py b/setup.py index 8979b29b23..89aa2e6658 100644 --- a/setup.py +++ b/setup.py @@ -34,10 +34,8 @@ }, author="Redis Inc.", author_email="oss@redis.com", - python_requires=">=3.7", + python_requires=">=3.8", install_requires=[ - 'importlib-metadata >= 1.0; python_version < "3.8"', - 'typing-extensions; python_version<"3.8"', 'async-timeout>=4.0.2; python_full_version<="3.11.2"', ], classifiers=[ @@ -49,7 +47,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10",