Skip to content

Commit aea5755

Browse files
akxdvora-h
andauthored
Partial clean up of Python 3.7 compatibility (#2928)
* Drop typing_extensions dependency (not necessary when targeting Python 3.8+) * Bump python_requires to >=3.8, drop importlib-metadata shim dependency * Cease testing on Python 3.7 * Add 3.8 test --------- Co-authored-by: dvora-h <[email protected]>
1 parent 6046d5f commit aea5755

File tree

9 files changed

+12
-22
lines changed

9 files changed

+12
-22
lines changed

.github/workflows/integration.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
max-parallel: 15
5858
fail-fast: false
5959
matrix:
60-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9']
60+
python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.8', 'pypy-3.9']
6161
test-type: ['standalone', 'cluster']
6262
connection-type: ['hiredis', 'plain']
6363
env:
@@ -111,7 +111,7 @@ jobs:
111111
strategy:
112112
fail-fast: false
113113
matrix:
114-
python-version: ['3.7', '3.11']
114+
python-version: ['3.8', '3.11']
115115
test-type: ['standalone', 'cluster']
116116
connection-type: ['hiredis', 'plain']
117117
protocol: ['3']
@@ -160,7 +160,7 @@ jobs:
160160
strategy:
161161
fail-fast: false
162162
matrix:
163-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9']
163+
python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.8', 'pypy-3.9']
164164
steps:
165165
- uses: actions/checkout@v4
166166
- uses: actions/setup-python@v4

redis/_parsers/hiredis.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import asyncio
22
import socket
33
import sys
4-
from typing import Callable, List, Optional, Union
4+
from typing import Callable, List, Optional, TypedDict, Union
55

66
if sys.version_info.major >= 3 and sys.version_info.minor >= 11:
77
from asyncio import timeout as async_timeout
88
else:
99
from async_timeout import timeout as async_timeout
1010

11-
from redis.compat import TypedDict
12-
1311
from ..exceptions import ConnectionError, InvalidResponse, RedisError
1412
from ..typing import EncodableT
1513
from ..utils import HIREDIS_AVAILABLE

redis/asyncio/client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
Mapping,
1616
MutableMapping,
1717
Optional,
18+
Protocol,
1819
Set,
1920
Tuple,
2021
Type,
22+
TypedDict,
2123
TypeVar,
2224
Union,
2325
cast,
@@ -55,7 +57,6 @@
5557
AsyncSentinelCommands,
5658
list_or_args,
5759
)
58-
from redis.compat import Protocol, TypedDict
5960
from redis.credentials import CredentialProvider
6061
from redis.exceptions import (
6162
ConnectionError,

redis/asyncio/connection.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
List,
1818
Mapping,
1919
Optional,
20+
Protocol,
2021
Set,
2122
Tuple,
2223
Type,
24+
TypedDict,
2325
TypeVar,
2426
Union,
2527
)
@@ -34,7 +36,6 @@
3436

3537
from redis.asyncio.retry import Retry
3638
from redis.backoff import NoBackoff
37-
from redis.compat import Protocol, TypedDict
3839
from redis.connection import DEFAULT_RESP_VERSION
3940
from redis.credentials import CredentialProvider, UsernamePasswordCredentialProvider
4041
from redis.exceptions import (

redis/commands/cluster.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
Iterable,
88
Iterator,
99
List,
10+
Literal,
1011
Mapping,
1112
NoReturn,
1213
Optional,
1314
Union,
1415
)
1516

16-
from redis.compat import Literal
1717
from redis.crc import key_slot
1818
from redis.exceptions import RedisClusterException, RedisError
1919
from redis.typing import (

redis/commands/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Iterable,
1313
Iterator,
1414
List,
15+
Literal,
1516
Mapping,
1617
Optional,
1718
Sequence,
@@ -20,7 +21,6 @@
2021
Union,
2122
)
2223

23-
from redis.compat import Literal
2424
from redis.exceptions import ConnectionError, DataError, NoScriptError, RedisError
2525
from redis.typing import (
2626
AbsExpiryT,

redis/compat.py

-6
This file was deleted.

redis/typing.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
Awaitable,
88
Iterable,
99
Mapping,
10+
Protocol,
1011
Type,
1112
TypeVar,
1213
Union,
1314
)
1415

15-
from redis.compat import Protocol
16-
1716
if TYPE_CHECKING:
1817
from redis._parsers import Encoder
1918
from redis.asyncio.connection import ConnectionPool as AsyncConnectionPool

setup.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@
3434
},
3535
author="Redis Inc.",
3636
author_email="[email protected]",
37-
python_requires=">=3.7",
37+
python_requires=">=3.8",
3838
install_requires=[
39-
'importlib-metadata >= 1.0; python_version < "3.8"',
40-
'typing-extensions; python_version<"3.8"',
4139
'async-timeout>=4.0.2; python_full_version<="3.11.2"',
4240
],
4341
classifiers=[
@@ -49,7 +47,6 @@
4947
"Programming Language :: Python",
5048
"Programming Language :: Python :: 3",
5149
"Programming Language :: Python :: 3 :: Only",
52-
"Programming Language :: Python :: 3.7",
5350
"Programming Language :: Python :: 3.8",
5451
"Programming Language :: Python :: 3.9",
5552
"Programming Language :: Python :: 3.10",

0 commit comments

Comments
 (0)