Skip to content

Commit

Permalink
Partial clean up of Python 3.7 compatibility (#2928)
Browse files Browse the repository at this point in the history
* 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 <67596500+dvora-h@users.noreply.github.com>
  • Loading branch information
akx and dvora-h committed Jan 1, 2024
1 parent 6046d5f commit aea5755
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions redis/_parsers/hiredis.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion redis/asyncio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
Mapping,
MutableMapping,
Optional,
Protocol,
Set,
Tuple,
Type,
TypedDict,
TypeVar,
Union,
cast,
Expand Down Expand Up @@ -55,7 +57,6 @@
AsyncSentinelCommands,
list_or_args,
)
from redis.compat import Protocol, TypedDict
from redis.credentials import CredentialProvider
from redis.exceptions import (
ConnectionError,
Expand Down
3 changes: 2 additions & 1 deletion redis/asyncio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
List,
Mapping,
Optional,
Protocol,
Set,
Tuple,
Type,
TypedDict,
TypeVar,
Union,
)
Expand All @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion redis/commands/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Iterable,
Iterator,
List,
Literal,
Mapping,
Optional,
Sequence,
Expand All @@ -20,7 +21,6 @@
Union,
)

from redis.compat import Literal
from redis.exceptions import ConnectionError, DataError, NoScriptError, RedisError
from redis.typing import (
AbsExpiryT,
Expand Down
6 changes: 0 additions & 6 deletions redis/compat.py

This file was deleted.

3 changes: 1 addition & 2 deletions redis/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[
Expand All @@ -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",
Expand Down

0 comments on commit aea5755

Please sign in to comment.