Skip to content

Commit

Permalink
Python: remove async_timeout and typing_extensions dependencies f… (
Browse files Browse the repository at this point in the history
#2415)

Python: remove `async_timeout` and `typing_extensions` dependencies for Python 3.11 and higher (#2401)

Signed-off-by: Jakob Keller <[email protected]>
  • Loading branch information
jakob-keller authored Oct 10, 2024
1 parent ff97ca5 commit 1ce22c6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ build-backend = "maturin"
name = "valkey-glide"
requires-python = ">=3.8"
dependencies = [
"async-timeout>=4.0.2",
"typing-extensions>=4.8.0",
"async-timeout>=4.0.2; python_version < '3.11'",
"typing-extensions>=4.8.0; python_version < '3.11'",
"protobuf>=3.20"
]
classifiers = [
Expand Down
9 changes: 7 additions & 2 deletions python/python/glide/glide_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import threading
from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast

import async_timeout
from glide.async_commands.cluster_commands import ClusterCommands
from glide.async_commands.command_args import ObjectType
from glide.async_commands.core import CoreCommands
Expand All @@ -27,7 +26,6 @@
from glide.protobuf.response_pb2 import RequestErrorType, Response
from glide.protobuf_codec import PartialMessageException, ProtobufCodec
from glide.routes import Route, set_protobuf_route
from typing_extensions import Self

from .glide import (
DEFAULT_TIMEOUT_IN_MILLISECONDS,
Expand All @@ -38,6 +36,13 @@
value_from_pointer,
)

if sys.version_info >= (3, 11):
import asyncio as async_timeout
from typing import Self
else:
import async_timeout
from typing_extensions import Self


def get_request_error_class(
error_type: Optional[RequestErrorType.ValueType],
Expand Down
4 changes: 2 additions & 2 deletions python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
async-timeout==4.0.2
async-timeout==4.0.2;python_version<"3.11"
maturin==0.13.0
protobuf==3.20.*
pytest==7.1.2
pytest-asyncio==0.19.0
typing_extensions==4.8.0
typing_extensions==4.8.0;python_version<"3.11"
pytest-html

0 comments on commit 1ce22c6

Please sign in to comment.