valkey-glide 1.3.4rc1__cp313-cp313-macosx_11_0_arm64.whl → 2.0.0rc6__cp313-cp313-macosx_11_0_arm64.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.

Potentially problematic release.


This version of valkey-glide might be problematic. Click here for more details.

Files changed (32) hide show
  1. glide/__init__.py +11 -7
  2. glide/async_commands/{transaction.py → batch.py} +1413 -987
  3. glide/async_commands/bitmap.py +94 -85
  4. glide/async_commands/cluster_commands.py +308 -123
  5. glide/async_commands/command_args.py +7 -6
  6. glide/async_commands/core.py +1304 -714
  7. glide/async_commands/server_modules/ft.py +83 -14
  8. glide/async_commands/server_modules/ft_options/ft_aggregate_options.py +15 -8
  9. glide/async_commands/server_modules/ft_options/ft_create_options.py +23 -11
  10. glide/async_commands/server_modules/ft_options/ft_profile_options.py +12 -7
  11. glide/async_commands/server_modules/ft_options/ft_search_options.py +12 -6
  12. glide/async_commands/server_modules/glide_json.py +134 -43
  13. glide/async_commands/server_modules/json_batch.py +157 -127
  14. glide/async_commands/sorted_set.py +39 -29
  15. glide/async_commands/standalone_commands.py +199 -95
  16. glide/async_commands/stream.py +94 -87
  17. glide/config.py +165 -105
  18. glide/constants.py +8 -4
  19. glide/glide.cpython-313-darwin.so +0 -0
  20. glide/glide_client.py +273 -94
  21. glide/logger.py +1 -1
  22. glide/protobuf/command_request_pb2.py +15 -15
  23. glide/protobuf/command_request_pb2.pyi +69 -46
  24. glide/protobuf/connection_request_pb2.py +15 -13
  25. glide/protobuf/connection_request_pb2.pyi +57 -29
  26. glide/protobuf/response_pb2.pyi +8 -9
  27. glide/protobuf_codec.py +7 -6
  28. glide/routes.py +41 -8
  29. {valkey_glide-1.3.4rc1.dist-info → valkey_glide-2.0.0rc6.dist-info}/METADATA +29 -8
  30. valkey_glide-2.0.0rc6.dist-info/RECORD +37 -0
  31. valkey_glide-1.3.4rc1.dist-info/RECORD +0 -37
  32. {valkey_glide-1.3.4rc1.dist-info → valkey_glide-2.0.0rc6.dist-info}/WHEEL +0 -0
@@ -10,6 +10,14 @@ from glide.constants import TEncodable
10
10
  class StreamTrimOptions(ABC):
11
11
  """
12
12
  Abstract base class for stream trim options.
13
+
14
+ Attributes:
15
+ exact (bool): If `true`, the stream will be trimmed exactly.
16
+ Otherwise the stream will be trimmed in a near-exact manner, which is more efficient.
17
+ threshold (Union[TEncodable, int]): Threshold for trimming.
18
+ method (str): Method for trimming (e.g., MINID, MAXLEN).
19
+ limit (Optional[int]): Max number of entries to be trimmed. Defaults to None.
20
+ Note: If `exact` is set to `True`, `limit` cannot be specified.
13
21
  """
14
22
 
15
23
  @abstractmethod
@@ -22,14 +30,6 @@ class StreamTrimOptions(ABC):
22
30
  ):
23
31
  """
24
32
  Initialize stream trim options.
25
-
26
- Args:
27
- exact (bool): If `true`, the stream will be trimmed exactly.
28
- Otherwise the stream will be trimmed in a near-exact manner, which is more efficient.
29
- threshold (Union[TEncodable, int]): Threshold for trimming.
30
- method (str): Method for trimming (e.g., MINID, MAXLEN).
31
- limit (Optional[int]): Max number of entries to be trimmed. Defaults to None.
32
- Note: If `exact` is set to `True`, `limit` cannot be specified.
33
33
  """
34
34
  if exact and limit:
35
35
  raise ValueError(
@@ -60,18 +60,18 @@ class StreamTrimOptions(ABC):
60
60
  class TrimByMinId(StreamTrimOptions):
61
61
  """
62
62
  Stream trim option to trim by minimum ID.
63
+
64
+ Attributes:
65
+ exact (bool): If `true`, the stream will be trimmed exactly.
66
+ Otherwise the stream will be trimmed in a near-exact manner, which is more efficient.
67
+ threshold (TEncodable): Threshold for trimming by minimum ID.
68
+ limit (Optional[int]): Max number of entries to be trimmed. Defaults to None.
69
+ Note: If `exact` is set to `True`, `limit` cannot be specified.
63
70
  """
64
71
 
65
72
  def __init__(self, exact: bool, threshold: TEncodable, limit: Optional[int] = None):
66
73
  """
67
74
  Initialize trim option by minimum ID.
68
-
69
- Args:
70
- exact (bool): If `true`, the stream will be trimmed exactly.
71
- Otherwise the stream will be trimmed in a near-exact manner, which is more efficient.
72
- threshold (TEncodable): Threshold for trimming by minimum ID.
73
- limit (Optional[int]): Max number of entries to be trimmed. Defaults to None.
74
- Note: If `exact` is set to `True`, `limit` cannot be specified.
75
75
  """
76
76
  super().__init__(exact, threshold, "MINID", limit)
77
77
 
@@ -79,18 +79,18 @@ class TrimByMinId(StreamTrimOptions):
79
79
  class TrimByMaxLen(StreamTrimOptions):
80
80
  """
81
81
  Stream trim option to trim by maximum length.
82
+
83
+ Attributes:
84
+ exact (bool): If `true`, the stream will be trimmed exactly.
85
+ Otherwise the stream will be trimmed in a near-exact manner, which is more efficient.
86
+ threshold (int): Threshold for trimming by maximum length.
87
+ limit (Optional[int]): Max number of entries to be trimmed. Defaults to None.
88
+ Note: If `exact` is set to `True`, `limit` cannot be specified.
82
89
  """
83
90
 
84
91
  def __init__(self, exact: bool, threshold: int, limit: Optional[int] = None):
85
92
  """
86
93
  Initialize trim option by maximum length.
87
-
88
- Args:
89
- exact (bool): If `true`, the stream will be trimmed exactly.
90
- Otherwise the stream will be trimmed in a near-exact manner, which is more efficient.
91
- threshold (int): Threshold for trimming by maximum length.
92
- limit (Optional[int]): Max number of entries to be trimmed. Defaults to None.
93
- Note: If `exact` is set to `True`, `limit` cannot be specified.
94
94
  """
95
95
  super().__init__(exact, threshold, "MAXLEN", limit)
96
96
 
@@ -98,6 +98,13 @@ class TrimByMaxLen(StreamTrimOptions):
98
98
  class StreamAddOptions:
99
99
  """
100
100
  Options for adding entries to a stream.
101
+
102
+ Attributes:
103
+ id (Optional[TEncodable]): ID for the new entry. If set, the new entry will be added with this ID. If not
104
+ specified, '*' is used.
105
+ make_stream (bool, optional): If set to False, a new stream won't be created if no stream matches the given key.
106
+ trim (Optional[StreamTrimOptions]): If set, the add operation will also trim the older entries in the stream.
107
+ See `StreamTrimOptions`.
101
108
  """
102
109
 
103
110
  def __init__(
@@ -108,11 +115,6 @@ class StreamAddOptions:
108
115
  ):
109
116
  """
110
117
  Initialize stream add options.
111
-
112
- Args:
113
- id (Optional[TEncodable]): ID for the new entry. If set, the new entry will be added with this ID. If not specified, '*' is used.
114
- make_stream (bool, optional): If set to False, a new stream won't be created if no stream matches the given key.
115
- trim (Optional[StreamTrimOptions]): If set, the add operation will also trim the older entries in the stream. See `StreamTrimOptions`.
116
118
  """
117
119
  self.id = id
118
120
  self.make_stream = make_stream
@@ -178,6 +180,9 @@ class IdBound(StreamRangeBound):
178
180
  Inclusive (closed) stream ID boundary used to specify a range of IDs to search. Stream ID bounds can be complete
179
181
  with a timestamp and sequence number separated by a dash ("-"), for example "1526985054069-0". Stream ID bounds can
180
182
  also be incomplete, with just a timestamp.
183
+
184
+ Attributes:
185
+ stream_id (str): The stream ID.
181
186
  """
182
187
 
183
188
  @staticmethod
@@ -193,9 +198,6 @@ class IdBound(StreamRangeBound):
193
198
  def __init__(self, stream_id: TEncodable):
194
199
  """
195
200
  Creates a stream ID boundary for a range search.
196
-
197
- Args:
198
- stream_id (str): The stream ID.
199
201
  """
200
202
  self.stream_id = stream_id
201
203
 
@@ -210,6 +212,9 @@ class ExclusiveIdBound(StreamRangeBound):
210
212
  be incomplete, with just a timestamp.
211
213
 
212
214
  Since: Valkey version 6.2.0.
215
+
216
+ Attributes:
217
+ stream_id (TEncodable): The stream ID.
213
218
  """
214
219
 
215
220
  EXCLUSIVE_BOUND_VALKEY_API = "("
@@ -227,9 +232,6 @@ class ExclusiveIdBound(StreamRangeBound):
227
232
  def __init__(self, stream_id: TEncodable):
228
233
  """
229
234
  Creates a stream ID boundary for a range search.
230
-
231
- Args:
232
- stream_id (TEncodable): The stream ID.
233
235
  """
234
236
  if isinstance(stream_id, bytes):
235
237
  stream_id = stream_id.decode("utf-8")
@@ -240,18 +242,19 @@ class ExclusiveIdBound(StreamRangeBound):
240
242
 
241
243
 
242
244
  class StreamReadOptions:
245
+ """
246
+ Options for reading entries from streams. Can be used as an optional argument to `XREAD`.
247
+
248
+ Attributes:
249
+ block_ms (Optional[int]): If provided, the request will be blocked for the set amount of milliseconds or
250
+ until the server has the required number of entries. Equivalent to `BLOCK` in the Valkey API.
251
+ count (Optional[int]): The maximum number of elements requested. Equivalent to `COUNT` in the Valkey API.
252
+ """
253
+
243
254
  READ_COUNT_VALKEY_API = "COUNT"
244
255
  READ_BLOCK_VALKEY_API = "BLOCK"
245
256
 
246
257
  def __init__(self, block_ms: Optional[int] = None, count: Optional[int] = None):
247
- """
248
- Options for reading entries from streams. Can be used as an optional argument to `XREAD`.
249
-
250
- Args:
251
- block_ms (Optional[int]): If provided, the request will be blocked for the set amount of milliseconds or
252
- until the server has the required number of entries. Equivalent to `BLOCK` in the Valkey API.
253
- count (Optional[int]): The maximum number of elements requested. Equivalent to `COUNT` in the Valkey API.
254
- """
255
258
  self.block_ms = block_ms
256
259
  self.count = count
257
260
 
@@ -273,19 +276,20 @@ class StreamReadOptions:
273
276
 
274
277
 
275
278
  class StreamGroupOptions:
279
+ """
280
+ Options for creating stream consumer groups. Can be used as an optional argument to `XGROUP CREATE`.
281
+
282
+ Attributes:
283
+ make_stream (bool): If set to True and the stream doesn't exist, this creates a new stream with a
284
+ length of 0.
285
+ entries_read: (Optional[int]): A value representing the number of stream entries already read by the
286
+ group. This option can only be specified if you are using Valkey version 7.0.0 or above.
287
+ """
288
+
276
289
  MAKE_STREAM_VALKEY_API = "MKSTREAM"
277
290
  ENTRIES_READ_VALKEY_API = "ENTRIESREAD"
278
291
 
279
292
  def __init__(self, make_stream: bool = False, entries_read: Optional[int] = None):
280
- """
281
- Options for creating stream consumer groups. Can be used as an optional argument to `XGROUP CREATE`.
282
-
283
- Args:
284
- make_stream (bool): If set to True and the stream doesn't exist, this creates a new stream with a
285
- length of 0.
286
- entries_read: (Optional[int]): A value representing the number of stream entries already read by the
287
- group. This option can only be specified if you are using Valkey version 7.0.0 or above.
288
- """
289
293
  self.make_stream = make_stream
290
294
  self.entries_read = entries_read
291
295
 
@@ -307,22 +311,23 @@ class StreamGroupOptions:
307
311
 
308
312
 
309
313
  class StreamReadGroupOptions(StreamReadOptions):
314
+ """
315
+ Options for reading entries from streams using a consumer group. Can be used as an optional argument to
316
+ `XREADGROUP`.
317
+
318
+ Attributes:
319
+ no_ack (bool): If set, messages are not added to the Pending Entries List (PEL). This is equivalent to
320
+ acknowledging the message when it is read. Equivalent to `NOACK` in the Valkey API.
321
+ block_ms (Optional[int]): If provided, the request will be blocked for the set amount of milliseconds or
322
+ until the server has the required number of entries. Equivalent to `BLOCK` in the Valkey API.
323
+ count (Optional[int]): The maximum number of elements requested. Equivalent to `COUNT` in the Valkey API.
324
+ """
325
+
310
326
  READ_NOACK_VALKEY_API = "NOACK"
311
327
 
312
328
  def __init__(
313
329
  self, no_ack=False, block_ms: Optional[int] = None, count: Optional[int] = None
314
330
  ):
315
- """
316
- Options for reading entries from streams using a consumer group. Can be used as an optional argument to
317
- `XREADGROUP`.
318
-
319
- Args:
320
- no_ack (bool): If set, messages are not added to the Pending Entries List (PEL). This is equivalent to
321
- acknowledging the message when it is read. Equivalent to `NOACK` in the Valkey API.
322
- block_ms (Optional[int]): If provided, the request will be blocked for the set amount of milliseconds or
323
- until the server has the required number of entries. Equivalent to `BLOCK` in the Valkey API.
324
- count (Optional[int]): The maximum number of elements requested. Equivalent to `COUNT` in the Valkey API.
325
- """
326
331
  super().__init__(block_ms=block_ms, count=count)
327
332
  self.no_ack = no_ack
328
333
 
@@ -341,6 +346,15 @@ class StreamReadGroupOptions(StreamReadOptions):
341
346
 
342
347
 
343
348
  class StreamPendingOptions:
349
+ """
350
+ Options for `XPENDING` that can be used to filter returned items by minimum idle time and consumer name.
351
+
352
+ Attributes:
353
+ min_idle_time_ms (Optional[int]): Filters pending entries by their minimum idle time in milliseconds. This
354
+ option can only be specified if you are using Valkey version 6.2.0 or above.
355
+ consumer_name (Optional[TEncodable]): Filters pending entries by consumer name.
356
+ """
357
+
344
358
  IDLE_TIME_VALKEY_API = "IDLE"
345
359
 
346
360
  def __init__(
@@ -348,19 +362,30 @@ class StreamPendingOptions:
348
362
  min_idle_time_ms: Optional[int] = None,
349
363
  consumer_name: Optional[TEncodable] = None,
350
364
  ):
351
- """
352
- Options for `XPENDING` that can be used to filter returned items by minimum idle time and consumer name.
353
-
354
- Args:
355
- min_idle_time_ms (Optional[int]): Filters pending entries by their minimum idle time in milliseconds. This
356
- option can only be specified if you are using Valkey version 6.2.0 or above.
357
- consumer_name (Optional[TEncodable]): Filters pending entries by consumer name.
358
- """
359
365
  self.min_idle_time = min_idle_time_ms
360
366
  self.consumer_name = consumer_name
361
367
 
362
368
 
363
369
  class StreamClaimOptions:
370
+ """
371
+ Options for `XCLAIM`.
372
+
373
+ Attributes:
374
+ idle (Optional[int]): Set the idle time (last time it was delivered) of the message in milliseconds. If idle
375
+ is not specified, an idle of `0` is assumed, that is, the time count is reset because the message now has a
376
+ new owner trying to process it.
377
+ idle_unix_time (Optional[int]): This is the same as idle but instead of a relative amount of milliseconds,
378
+ it sets the idle time to a specific Unix time (in milliseconds). This is useful in order to rewrite the AOF
379
+ file generating `XCLAIM` commands.
380
+ retry_count (Optional[int]): Set the retry counter to the specified value. This counter is incremented every
381
+ time a message is delivered again. Normally `XCLAIM` does not alter this counter, which is just served to
382
+ clients when the `XPENDING` command is called: this way clients can detect anomalies, like messages that
383
+ are never processed for some reason after a big number of delivery attempts.
384
+ is_force (Optional[bool]): Creates the pending message entry in the PEL even if certain specified IDs are not
385
+ already in the PEL assigned to a different client. However, the message must exist in the stream, otherwise
386
+ the IDs of non-existing messages are ignored.
387
+ """
388
+
364
389
  IDLE_VALKEY_API = "IDLE"
365
390
  TIME_VALKEY_API = "TIME"
366
391
  RETRY_COUNT_VALKEY_API = "RETRYCOUNT"
@@ -374,24 +399,6 @@ class StreamClaimOptions:
374
399
  retry_count: Optional[int] = None,
375
400
  is_force: Optional[bool] = False,
376
401
  ):
377
- """
378
- Options for `XCLAIM`.
379
-
380
- Args:
381
- idle (Optional[int]): Set the idle time (last time it was delivered) of the message in milliseconds. If idle
382
- is not specified, an idle of `0` is assumed, that is, the time count is reset because the message now has a
383
- new owner trying to process it.
384
- idle_unix_time (Optional[int]): This is the same as idle but instead of a relative amount of milliseconds,
385
- it sets the idle time to a specific Unix time (in milliseconds). This is useful in order to rewrite the AOF
386
- file generating `XCLAIM` commands.
387
- retry_count (Optional[int]): Set the retry counter to the specified value. This counter is incremented every
388
- time a message is delivered again. Normally `XCLAIM` does not alter this counter, which is just served to
389
- clients when the `XPENDING` command is called: this way clients can detect anomalies, like messages that
390
- are never processed for some reason after a big number of delivery attempts.
391
- is_force (Optional[bool]): Creates the pending message entry in the PEL even if certain specified IDs are not
392
- already in the PEL assigned to a different client. However, the message must exist in the stream, otherwise
393
- the IDs of non-existing messages are ignored.
394
- """
395
402
  self.idle = idle
396
403
  self.idle_unix_time = idle_unix_time
397
404
  self.retry_count = retry_count