Skip to content

Commit 1ce22c6

Browse files
authored
Python: remove async_timeout and typing_extensions dependencies f… (#2415)
Python: remove `async_timeout` and `typing_extensions` dependencies for Python 3.11 and higher (#2401) Signed-off-by: Jakob Keller <57402305+jakob-keller@users.noreply.github.com>
1 parent ff97ca5 commit 1ce22c6

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

python/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ build-backend = "maturin"
66
name = "valkey-glide"
77
requires-python = ">=3.8"
88
dependencies = [
9-
"async-timeout>=4.0.2",
10-
"typing-extensions>=4.8.0",
9+
"async-timeout>=4.0.2; python_version < '3.11'",
10+
"typing-extensions>=4.8.0; python_version < '3.11'",
1111
"protobuf>=3.20"
1212
]
1313
classifiers = [

python/python/glide/glide_client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import threading
66
from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast
77

8-
import async_timeout
98
from glide.async_commands.cluster_commands import ClusterCommands
109
from glide.async_commands.command_args import ObjectType
1110
from glide.async_commands.core import CoreCommands
@@ -27,7 +26,6 @@
2726
from glide.protobuf.response_pb2 import RequestErrorType, Response
2827
from glide.protobuf_codec import PartialMessageException, ProtobufCodec
2928
from glide.routes import Route, set_protobuf_route
30-
from typing_extensions import Self
3129

3230
from .glide import (
3331
DEFAULT_TIMEOUT_IN_MILLISECONDS,
@@ -38,6 +36,13 @@
3836
value_from_pointer,
3937
)
4038

39+
if sys.version_info >= (3, 11):
40+
import asyncio as async_timeout
41+
from typing import Self
42+
else:
43+
import async_timeout
44+
from typing_extensions import Self
45+
4146

4247
def get_request_error_class(
4348
error_type: Optional[RequestErrorType.ValueType],

python/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
async-timeout==4.0.2
1+
async-timeout==4.0.2;python_version<"3.11"
22
maturin==0.13.0
33
protobuf==3.20.*
44
pytest==7.1.2
55
pytest-asyncio==0.19.0
6-
typing_extensions==4.8.0
6+
typing_extensions==4.8.0;python_version<"3.11"
77
pytest-html

0 commit comments

Comments
 (0)