redis 6.1.0__py3-none-any.whl → 6.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -576,11 +576,7 @@ class AbstractConnection:
576
576
  read_timeout = timeout if timeout is not None else self.socket_timeout
577
577
  host_error = self._host_error()
578
578
  try:
579
- if (
580
- read_timeout is not None
581
- and self.protocol in ["3", 3]
582
- and not HIREDIS_AVAILABLE
583
- ):
579
+ if read_timeout is not None and self.protocol in ["3", 3]:
584
580
  async with async_timeout(read_timeout):
585
581
  response = await self._parser.read_response(
586
582
  disable_decoding=disable_decoding, push_request=push_request
@@ -590,7 +586,7 @@ class AbstractConnection:
590
586
  response = await self._parser.read_response(
591
587
  disable_decoding=disable_decoding
592
588
  )
593
- elif self.protocol in ["3", 3] and not HIREDIS_AVAILABLE:
589
+ elif self.protocol in ["3", 3]:
594
590
  response = await self._parser.read_response(
595
591
  disable_decoding=disable_decoding, push_request=push_request
596
592
  )
@@ -868,7 +864,7 @@ class RedisSSLContext:
868
864
  cert_reqs: Optional[Union[str, ssl.VerifyMode]] = None,
869
865
  ca_certs: Optional[str] = None,
870
866
  ca_data: Optional[str] = None,
871
- check_hostname: bool = True,
867
+ check_hostname: bool = False,
872
868
  min_version: Optional[TLSVersion] = None,
873
869
  ciphers: Optional[str] = None,
874
870
  ):
redis/client.py CHANGED
@@ -58,7 +58,6 @@ from redis.exceptions import (
58
58
  from redis.lock import Lock
59
59
  from redis.retry import Retry
60
60
  from redis.utils import (
61
- HIREDIS_AVAILABLE,
62
61
  _set_info_logger,
63
62
  deprecated_args,
64
63
  get_lib_version,
@@ -369,6 +368,8 @@ class Redis(RedisModuleCommands, CoreCommands, SentinelCommands):
369
368
  ]:
370
369
  raise RedisError("Client caching is only supported with RESP version 3")
371
370
 
371
+ # TODO: To avoid breaking changes during the bug fix, we have to keep non-reentrant lock.
372
+ # TODO: Remove this before next major version (7.0.0)
372
373
  self.single_connection_lock = threading.Lock()
373
374
  self.connection = None
374
375
  self._single_connection_client = single_connection_client
@@ -774,6 +775,9 @@ class PubSub:
774
775
  self._event_dispatcher = EventDispatcher()
775
776
  else:
776
777
  self._event_dispatcher = event_dispatcher
778
+
779
+ # TODO: To avoid breaking changes during the bug fix, we have to keep non-reentrant lock.
780
+ # TODO: Remove this before next major version (7.0.0)
777
781
  self._lock = threading.Lock()
778
782
  if self.encoder is None:
779
783
  self.encoder = self.connection_pool.get_encoder()
@@ -861,7 +865,7 @@ class PubSub:
861
865
  # register a callback that re-subscribes to any channels we
862
866
  # were listening to when we were disconnected
863
867
  self.connection.register_connect_callback(self.on_connect)
864
- if self.push_handler_func is not None and not HIREDIS_AVAILABLE:
868
+ if self.push_handler_func is not None:
865
869
  self.connection._parser.set_pubsub_push_handler(self.push_handler_func)
866
870
  self._event_dispatcher.dispatch(
867
871
  AfterPubSubConnectionInstantiationEvent(
redis/cluster.py CHANGED
@@ -51,7 +51,6 @@ from redis.exceptions import (
51
51
  from redis.lock import Lock
52
52
  from redis.retry import Retry
53
53
  from redis.utils import (
54
- HIREDIS_AVAILABLE,
55
54
  deprecated_args,
56
55
  dict_merge,
57
56
  list_keys_to_dict,
@@ -710,7 +709,7 @@ class RedisCluster(AbstractRedisCluster, RedisClusterCommands):
710
709
  self.result_callbacks = CaseInsensitiveDict(self.__class__.RESULT_CALLBACKS)
711
710
 
712
711
  self.commands_parser = CommandsParser(self)
713
- self._lock = threading.Lock()
712
+ self._lock = threading.RLock()
714
713
 
715
714
  def __enter__(self):
716
715
  return self
@@ -1474,7 +1473,7 @@ class NodesManager:
1474
1473
  self.connection_kwargs = kwargs
1475
1474
  self.read_load_balancer = LoadBalancer()
1476
1475
  if lock is None:
1477
- lock = threading.Lock()
1476
+ lock = threading.RLock()
1478
1477
  self._lock = lock
1479
1478
  if event_dispatcher is None:
1480
1479
  self._event_dispatcher = EventDispatcher()
@@ -1999,7 +1998,7 @@ class ClusterPubSub(PubSub):
1999
1998
  # register a callback that re-subscribes to any channels we
2000
1999
  # were listening to when we were disconnected
2001
2000
  self.connection.register_connect_callback(self.on_connect)
2002
- if self.push_handler_func is not None and not HIREDIS_AVAILABLE:
2001
+ if self.push_handler_func is not None:
2003
2002
  self.connection._parser.set_pubsub_push_handler(self.push_handler_func)
2004
2003
  self._event_dispatcher.dispatch(
2005
2004
  AfterPubSubConnectionInstantiationEvent(
@@ -2178,7 +2177,7 @@ class ClusterPipeline(RedisCluster):
2178
2177
  kwargs.get("decode_responses", False),
2179
2178
  )
2180
2179
  if lock is None:
2181
- lock = threading.Lock()
2180
+ lock = threading.RLock()
2182
2181
  self._lock = lock
2183
2182
  self.parent_execute_command = super().execute_command
2184
2183
  self._execution_strategy: ExecutionStrategy = (
redis/connection.py CHANGED
@@ -636,7 +636,7 @@ class AbstractConnection(ConnectionInterface):
636
636
  host_error = self._host_error()
637
637
 
638
638
  try:
639
- if self.protocol in ["3", 3] and not HIREDIS_AVAILABLE:
639
+ if self.protocol in ["3", 3]:
640
640
  response = self._parser.read_response(
641
641
  disable_decoding=disable_decoding, push_request=push_request
642
642
  )
@@ -820,7 +820,7 @@ class CacheProxyConnection(ConnectionInterface):
820
820
  self.credential_provider = conn.credential_provider
821
821
  self._pool_lock = pool_lock
822
822
  self._cache = cache
823
- self._cache_lock = threading.Lock()
823
+ self._cache_lock = threading.RLock()
824
824
  self._current_command_cache_key = None
825
825
  self._current_options = None
826
826
  self.register_connect_callback(self._enable_tracking_callback)
@@ -1420,8 +1420,16 @@ class ConnectionPool:
1420
1420
  # object of this pool. subsequent threads acquiring this lock
1421
1421
  # will notice the first thread already did the work and simply
1422
1422
  # release the lock.
1423
- self._fork_lock = threading.Lock()
1424
- self._lock = threading.Lock()
1423
+
1424
+ self._fork_lock = threading.RLock()
1425
+
1426
+ if self.cache is None:
1427
+ self._lock = threading.RLock()
1428
+ else:
1429
+ # TODO: To avoid breaking changes during the bug fix, we have to keep non-reentrant lock.
1430
+ # TODO: Remove this before next major version (7.0.0)
1431
+ self._lock = threading.Lock()
1432
+
1425
1433
  self.reset()
1426
1434
 
1427
1435
  def __repr__(self) -> (str, str):
redis/typing.py CHANGED
@@ -15,8 +15,6 @@ from typing import (
15
15
 
16
16
  if TYPE_CHECKING:
17
17
  from redis._parsers import Encoder
18
- from redis.asyncio.connection import ConnectionPool as AsyncConnectionPool
19
- from redis.connection import ConnectionPool
20
18
 
21
19
 
22
20
  Number = Union[int, float]
@@ -52,8 +50,6 @@ ExceptionMappingT = Mapping[str, Union[Type[Exception], Mapping[str, Type[Except
52
50
 
53
51
 
54
52
  class CommandsProtocol(Protocol):
55
- connection_pool: Union["AsyncConnectionPool", "ConnectionPool"]
56
-
57
53
  def execute_command(self, *args, **options) -> ResponseT: ...
58
54
 
59
55
 
redis/utils.py CHANGED
@@ -12,9 +12,12 @@ try:
12
12
  import hiredis # noqa
13
13
 
14
14
  # Only support Hiredis >= 3.0:
15
- HIREDIS_AVAILABLE = int(hiredis.__version__.split(".")[0]) >= 3
15
+ hiredis_version = hiredis.__version__.split(".")
16
+ HIREDIS_AVAILABLE = int(hiredis_version[0]) > 3 or (
17
+ int(hiredis_version[0]) == 3 and int(hiredis_version[1]) >= 2
18
+ )
16
19
  if not HIREDIS_AVAILABLE:
17
- raise ImportError("hiredis package should be >= 3.0.0")
20
+ raise ImportError("hiredis package should be >= 3.2.0")
18
21
  except ImportError:
19
22
  HIREDIS_AVAILABLE = False
20
23
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: redis
3
- Version: 6.1.0
3
+ Version: 6.2.0
4
4
  Summary: Python client for Redis database and key-value store
5
5
  Project-URL: Changes, https://github.com/redis/redis-py/releases
6
6
  Project-URL: Code, https://github.com/redis/redis-py
@@ -19,7 +19,6 @@ Classifier: Operating System :: OS Independent
19
19
  Classifier: Programming Language :: Python
20
20
  Classifier: Programming Language :: Python :: 3
21
21
  Classifier: Programming Language :: Python :: 3 :: Only
22
- Classifier: Programming Language :: Python :: 3.8
23
22
  Classifier: Programming Language :: Python :: 3.9
24
23
  Classifier: Programming Language :: Python :: 3.10
25
24
  Classifier: Programming Language :: Python :: 3.11
@@ -27,10 +26,10 @@ Classifier: Programming Language :: Python :: 3.12
27
26
  Classifier: Programming Language :: Python :: 3.13
28
27
  Classifier: Programming Language :: Python :: Implementation :: CPython
29
28
  Classifier: Programming Language :: Python :: Implementation :: PyPy
30
- Requires-Python: >=3.8
29
+ Requires-Python: >=3.9
31
30
  Requires-Dist: async-timeout>=4.0.3; python_full_version < '3.11.3'
32
31
  Provides-Extra: hiredis
33
- Requires-Dist: hiredis>=3.0.0; extra == 'hiredis'
32
+ Requires-Dist: hiredis>=3.2.0; extra == 'hiredis'
34
33
  Provides-Extra: jwt
35
34
  Requires-Dist: pyjwt>=2.9.0; extra == 'jwt'
36
35
  Provides-Extra: ocsp
@@ -55,7 +54,7 @@ The Python interface to the Redis key-value store.
55
54
  ---------------------------------------------
56
55
 
57
56
  **Note:** redis-py 5.0 will be the last version of redis-py to support Python 3.7, as it has reached [end of life](https://devguide.python.org/versions/). redis-py 5.1 will support Python 3.8+.
58
-
57
+ **Note:** redis-py 6.1.0 will be the last version of redis-py to support Python 3.8, as it has reached [end of life](https://devguide.python.org/versions/). redis-py 6.2.0 will support Python 3.9+.
59
58
  ---------------------------------------------
60
59
 
61
60
  ## How do I Redis?
@@ -75,14 +74,13 @@ The Python interface to the Redis key-value store.
75
74
  Start a redis via docker (for Redis versions >= 8.0):
76
75
 
77
76
  ``` bash
78
- $ docker run -p 6379:6379 -it redis:latest
77
+ docker run -p 6379:6379 -it redis:latest
79
78
  ```
80
79
 
81
80
  Start a redis via docker (for Redis versions < 8.0):
82
81
 
83
82
  ``` bash
84
- $ docker run -p 6379:6379 -it redis/redis-stack:latest
85
- ```
83
+ docker run -p 6379:6379 -it redis/redis-stack:latest
86
84
 
87
85
  To install redis-py, simply:
88
86
 
@@ -1,9 +1,9 @@
1
- redis/__init__.py,sha256=-M8cA3QGivn45l9qd2LkwAid1y9uT_dj_qFBByBDkBI,2088
1
+ redis/__init__.py,sha256=h5BepEwJtNeHNFaMJ0VdpbtFFTC8QcY5s9wqAnYG8TE,2060
2
2
  redis/backoff.py,sha256=2zR-ik5enJDsC2n2AWmE3ALSONgDLtyO4k096ZT6Txo,5275
3
3
  redis/cache.py,sha256=68rJDNogvNwgdgBel6zSX9QziL11qsKIMhmvQvHvznM,9549
4
- redis/client.py,sha256=ZGKGLJdRwwgY4w01Ag4MOh6bI8g7pP9NYZn7-OamzOU,62486
5
- redis/cluster.py,sha256=DvB9HMqXWziH99SJhxyCxBrrGNUWKebkVl-Jyp5avuM,123808
6
- redis/connection.py,sha256=4ibOCqygzOSn77d-vpLORDg9TZEKV_ME13Kt4kE2ySM,66666
4
+ redis/client.py,sha256=BrYjhRBWw7Sw3LKPNbdW0UzaQsd-y-wPR70SMgDTeEc,62758
5
+ redis/cluster.py,sha256=_Pi_u8U9meq-WcTHV0j4u0lgOQVqmALj37wU1qekWcE,123762
6
+ redis/connection.py,sha256=z1m1-maULRuw4KeiuKXmzL_DtFxcXiqMbKFJm_3V7ao,66905
7
7
  redis/crc.py,sha256=Z3kXFtkY2LdgefnQMud1xr4vG5UYvA9LCMqNMX1ywu4,729
8
8
  redis/credentials.py,sha256=GOnO3-LSW34efHaIrUbS742Mw8l70mRzF6UrKiKZsMY,1828
9
9
  redis/event.py,sha256=urOK241IdgmCQ3fq7GqXRstZ2vcXRV14bBBMdN3latk,12129
@@ -13,21 +13,21 @@ redis/ocsp.py,sha256=teYSmKnCtk6B3jJLdNYbZN4OE0mxgspt2zUPbkIQzio,11452
13
13
  redis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  redis/retry.py,sha256=qJPRTARm3TYQPRNnzyjUUjGohbwtMz5KoDphCtHJ44Y,2902
15
15
  redis/sentinel.py,sha256=DBphu6uNp6ZCSaVDSVC8nFhSxG93a12DnzgGWpyeh64,14757
16
- redis/typing.py,sha256=k7F_3Vtsexeb7mUl6txlwrY1veGDLEhtcHe9FwIJOOo,2149
17
- redis/utils.py,sha256=XD4ySRo9JzLIMMpQY_q9MsxUIdEPee1d7rAq7xhmSwM,8268
18
- redis/_parsers/__init__.py,sha256=qkfgV2X9iyvQAvbLdSelwgz0dCk9SGAosCvuZC9-qDc,550
19
- redis/_parsers/base.py,sha256=WtCbM2CaOgHk7uxwWXA2KXDlZqfYA1EJrVX_NvdOZNk,7801
16
+ redis/typing.py,sha256=z5JQjGkNzejEzb2y7TXct7tS5yzAfLQod9o37Mh1_Ug,1953
17
+ redis/utils.py,sha256=q7tQJs6Tj5M91QypOwZtGnFXs2Bcji3eTt9VEwLYOeA,8386
18
+ redis/_parsers/__init__.py,sha256=gyf5dp918NuJAkWFl8sX1Z-qAvbX_40-_7YCTM6Rvjc,693
19
+ redis/_parsers/base.py,sha256=k6n7-oTmmzAUiiZpaB6Vfjzlj_torwBsaPBEYdOTDak,9908
20
20
  redis/_parsers/commands.py,sha256=pmR4hl4u93UvCmeDgePHFc6pWDr4slrKEvCsdMmtj_M,11052
21
21
  redis/_parsers/encoders.py,sha256=X0jvTp-E4TZUlZxV5LJJ88TuVrF1vly5tuC0xjxGaSc,1734
22
22
  redis/_parsers/helpers.py,sha256=X5wkGDtuzseeCz23_t3FJpzy1ltIvh7zO1uD3cypiOs,29184
23
- redis/_parsers/hiredis.py,sha256=qL1iCkWlxI63PiP99u_MY5-V6zKaesW2fD-IMNtc0QI,8189
23
+ redis/_parsers/hiredis.py,sha256=iUjLT5OEgD4zqF_tg3Szmg1c_73RozXyjjAFsVYKCWM,10893
24
24
  redis/_parsers/resp2.py,sha256=f22kH-_ZP2iNtOn6xOe65MSy_fJpu8OEn1u_hgeeojI,4813
25
- redis/_parsers/resp3.py,sha256=JgLDeryCAqx75ghM78mAvxumzWBMEWupmFpaRoL6Xqo,11129
25
+ redis/_parsers/resp3.py,sha256=tiZRbyJAnObqll2LQJ57Br-3jxwQcMocV4GQE_LpC6g,9883
26
26
  redis/_parsers/socket.py,sha256=CKD8QW_wFSNlIZzxlbNduaGpiv0I8wBcsGuAIojDfJg,5403
27
27
  redis/asyncio/__init__.py,sha256=uoDD8XYVi0Kj6mcufYwLDUTQXmBRx7a0bhKF9stZr7I,1489
28
- redis/asyncio/client.py,sha256=xZNHB8SEWe_CrDOrNoKUEZMW4Aw_zKF0iygD7MOsujI,61954
29
- redis/asyncio/cluster.py,sha256=190gM2GMnvrOhOI1I6t2ogS9UkMeokqe-uiFOtHk_1M,67891
30
- redis/asyncio/connection.py,sha256=TpqWKA-MSiK1P0xCMivp438YCZY1CeOKfec6vH9txU4,48943
28
+ redis/asyncio/client.py,sha256=6a5-txYcRMtObkb7Bfi08MKQQY01oy5NKpHAlfhIFNM,61905
29
+ redis/asyncio/cluster.py,sha256=LNEXjBJKr9M13jGnN52BQgYX6PbojCcxT_Jix9W2k0Y,90121
30
+ redis/asyncio/connection.py,sha256=32MXfAoa5bOj2rNw-8YKJad6kpDmcOBNz2qsZd4Ty6Q,48828
31
31
  redis/asyncio/lock.py,sha256=GxgV6EsyKpMjh74KtaOPxh4fNPuwApz6Th46qhvrAws,12801
32
32
  redis/asyncio/retry.py,sha256=8carxJLme2f0frB9Z0wU3mHqKzwqzGAGb2TMEtaaMvo,2482
33
33
  redis/asyncio/sentinel.py,sha256=H7N_hvdATojwY06aH1AawFV-05AImqtOSAq0xKElbbk,14636
@@ -72,7 +72,7 @@ redis/commands/timeseries/utils.py,sha256=NLwSOS5Dz9N8dYQSzEyBIvrItOWwfQ0xgDj8un
72
72
  redis/commands/vectorset/__init__.py,sha256=_fM0UdYjuzs8YWIUjQGH9QX5FwI0So8_D-5ALWWrWFc,1322
73
73
  redis/commands/vectorset/commands.py,sha256=7CvQNFvkXuG3XPhHJ82y_oBYJwewRFz84aEi3OCH4Rw,12495
74
74
  redis/commands/vectorset/utils.py,sha256=N-x0URyg76XC39CNfBym6FkFCVgm5NthzWKBnc2H0Xc,2981
75
- redis-6.1.0.dist-info/METADATA,sha256=RJYbOKZYAVABc_B3-eouMHIHk7v-6gL8c01wl_N7Mkc,10644
76
- redis-6.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
77
- redis-6.1.0.dist-info/licenses/LICENSE,sha256=pXslClvwPXr-VbdAYzE_Ktt7ANVGwKsUmok5gzP-PMg,1074
78
- redis-6.1.0.dist-info/RECORD,,
75
+ redis-6.2.0.dist-info/METADATA,sha256=nU7-kjJL_I8KHMRNFmLBeS9tWPwTPOw2_oQ8dEBfSPM,10783
76
+ redis-6.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
77
+ redis-6.2.0.dist-info/licenses/LICENSE,sha256=pXslClvwPXr-VbdAYzE_Ktt7ANVGwKsUmok5gzP-PMg,1074
78
+ redis-6.2.0.dist-info/RECORD,,
File without changes