From 225881c176517eb7807e1254e33642f08cc9a65e Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 4 Sep 2023 12:58:43 +0300 Subject: [PATCH 1/4] Drop typing_extensions dependency (not necessary when targeting Python 3.8+) --- redis/_parsers/hiredis.py | 4 +--- redis/asyncio/client.py | 3 ++- redis/asyncio/connection.py | 3 ++- redis/commands/cluster.py | 2 +- redis/commands/core.py | 2 +- redis/compat.py | 6 ------ redis/typing.py | 3 +-- setup.py | 1 - 8 files changed, 8 insertions(+), 16 deletions(-) delete mode 100644 redis/compat.py diff --git a/redis/_parsers/hiredis.py b/redis/_parsers/hiredis.py index b3247b71ec..d52654778d 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 acc89941f2..d3c0b52ce7 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, @@ -49,7 +51,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 77312211a9..babb0f0af5 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 14b8741443..83d810556b 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 e73553e47e..d2ed715af0 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -13,6 +13,7 @@ Iterable, Iterator, List, + Literal, Mapping, Optional, Sequence, @@ -21,7 +22,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 56a1e99ba7..b4cea9096f 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 f22d809d27..47606bbac8 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,6 @@ python_requires=">=3.7", 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=[ From 9c0fac3a70294d6af3b8fd79d9da5d9e2eff223a Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 4 Sep 2023 12:59:02 +0300 Subject: [PATCH 2/4] Bump python_requires to >=3.8, drop importlib-metadata shim dependency --- setup.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 47606bbac8..deca4ddb38 100644 --- a/setup.py +++ b/setup.py @@ -34,9 +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"', 'async-timeout>=4.0.2; python_full_version<="3.11.2"', ], classifiers=[ @@ -48,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", From 87329f7d39c554a03c191613580f2cf2b3b430fe Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 4 Sep 2023 12:59:09 +0300 Subject: [PATCH 3/4] Cease testing on Python 3.7 --- .github/workflows/integration.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 96b51fbafb..123382e689 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.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 From 78c06252c83b0ddbb258a64f3a9a0651887361e3 Mon Sep 17 00:00:00 2001 From: dvora-h <67596500+dvora-h@users.noreply.github.com> Date: Mon, 1 Jan 2024 13:24:48 +0200 Subject: [PATCH 4/4] Add 3.8 test --- .github/workflows/integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 123382e689..207d58fac7 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -111,7 +111,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.11'] + python-version: ['3.8', '3.11'] test-type: ['standalone', 'cluster'] connection-type: ['hiredis', 'plain'] protocol: ['3']