valkey-glide 1.3.5__pp39-pypy39_pp73-macosx_10_7_x86_64.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 (37) hide show
  1. glide/__init__.py +330 -0
  2. glide/async_commands/__init__.py +5 -0
  3. glide/async_commands/bitmap.py +311 -0
  4. glide/async_commands/cluster_commands.py +1294 -0
  5. glide/async_commands/command_args.py +102 -0
  6. glide/async_commands/core.py +7040 -0
  7. glide/async_commands/server_modules/ft.py +395 -0
  8. glide/async_commands/server_modules/ft_options/ft_aggregate_options.py +293 -0
  9. glide/async_commands/server_modules/ft_options/ft_constants.py +84 -0
  10. glide/async_commands/server_modules/ft_options/ft_create_options.py +409 -0
  11. glide/async_commands/server_modules/ft_options/ft_profile_options.py +108 -0
  12. glide/async_commands/server_modules/ft_options/ft_search_options.py +131 -0
  13. glide/async_commands/server_modules/glide_json.py +1255 -0
  14. glide/async_commands/server_modules/json_batch.py +790 -0
  15. glide/async_commands/sorted_set.py +402 -0
  16. glide/async_commands/standalone_commands.py +935 -0
  17. glide/async_commands/stream.py +442 -0
  18. glide/async_commands/transaction.py +5175 -0
  19. glide/config.py +590 -0
  20. glide/constants.py +120 -0
  21. glide/exceptions.py +62 -0
  22. glide/glide.pyi +36 -0
  23. glide/glide.pypy39-pp73-darwin.so +0 -0
  24. glide/glide_client.py +604 -0
  25. glide/logger.py +85 -0
  26. glide/protobuf/command_request_pb2.py +54 -0
  27. glide/protobuf/command_request_pb2.pyi +1164 -0
  28. glide/protobuf/connection_request_pb2.py +52 -0
  29. glide/protobuf/connection_request_pb2.pyi +292 -0
  30. glide/protobuf/response_pb2.py +32 -0
  31. glide/protobuf/response_pb2.pyi +101 -0
  32. glide/protobuf_codec.py +109 -0
  33. glide/py.typed +0 -0
  34. glide/routes.py +114 -0
  35. valkey_glide-1.3.5.dist-info/METADATA +125 -0
  36. valkey_glide-1.3.5.dist-info/RECORD +37 -0
  37. valkey_glide-1.3.5.dist-info/WHEEL +4 -0
glide/routes.py ADDED
@@ -0,0 +1,114 @@
1
+ # Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
2
+
3
+ from enum import Enum
4
+ from typing import Optional
5
+
6
+ from glide.exceptions import RequestError
7
+ from glide.protobuf.command_request_pb2 import CommandRequest, SimpleRoutes
8
+ from glide.protobuf.command_request_pb2 import SlotTypes as ProtoSlotTypes
9
+
10
+
11
+ class SlotType(Enum):
12
+ PRIMARY = 1
13
+ # `REPLICA` overrides the `read_from_replica` configuration. If it's used the request
14
+ # will be routed to a replica, even if the strategy is `ALWAYS_FROM_MASTER`.
15
+ REPLICA = 2
16
+
17
+
18
+ class Route:
19
+ def __init__(self) -> None:
20
+ pass
21
+
22
+
23
+ # cluster routes
24
+
25
+
26
+ class AllNodes(Route):
27
+ """
28
+ Route request to all nodes.
29
+ Warning:
30
+ Don't use it with write commands, they could be routed to a replica (RO) node and fail.
31
+ """
32
+
33
+ pass
34
+
35
+
36
+ class AllPrimaries(Route):
37
+ pass
38
+
39
+
40
+ class RandomNode(Route):
41
+ """
42
+ Route request to a random node.
43
+ Warning:
44
+ Don't use it with write commands, because they could be randomly routed to a replica (RO) node and fail.
45
+ """
46
+
47
+ pass
48
+
49
+
50
+ class SlotKeyRoute(Route):
51
+ def __init__(self, slot_type: SlotType, slot_key: str) -> None:
52
+ super().__init__()
53
+ self.slot_type = slot_type
54
+ self.slot_key = slot_key
55
+
56
+
57
+ class SlotIdRoute(Route):
58
+ def __init__(self, slot_type: SlotType, slot_id: int) -> None:
59
+ super().__init__()
60
+ self.slot_type = slot_type
61
+ self.slot_id = slot_id
62
+
63
+
64
+ class ByAddressRoute(Route):
65
+ def __init__(self, host: str, port: Optional[int] = None) -> None:
66
+ """Routes a request to a node by its address
67
+
68
+ Args:
69
+ host (str): The endpoint of the node. If `port` is not provided, should be in the f"{address}:{port}" format, where `address` is the preferred endpoint as shown in the output of the `CLUSTER SLOTS` command.
70
+ port (Optional[int]): The port to access on the node. If port is not provided, `host` is assumed to be in the format f"{address}:{port}".
71
+ """
72
+ super().__init__()
73
+ if port is None:
74
+ split = host.split(":")
75
+ if len(split) < 2:
76
+ raise RequestError(
77
+ "No port provided, expected host to be formatted as {hostname}:{port}`. Received "
78
+ + host
79
+ )
80
+ self.host = split[0]
81
+ self.port = int(split[1])
82
+ else:
83
+ self.host = host
84
+ self.port = port
85
+
86
+
87
+ def to_protobuf_slot_type(slot_type: SlotType) -> ProtoSlotTypes.ValueType:
88
+ return (
89
+ ProtoSlotTypes.Primary
90
+ if slot_type == SlotType.PRIMARY
91
+ else ProtoSlotTypes.Replica
92
+ )
93
+
94
+
95
+ def set_protobuf_route(request: CommandRequest, route: Optional[Route]) -> None:
96
+ if route is None:
97
+ return
98
+ elif isinstance(route, AllNodes):
99
+ request.route.simple_routes = SimpleRoutes.AllNodes
100
+ elif isinstance(route, AllPrimaries):
101
+ request.route.simple_routes = SimpleRoutes.AllPrimaries
102
+ elif isinstance(route, RandomNode):
103
+ request.route.simple_routes = SimpleRoutes.Random
104
+ elif isinstance(route, SlotKeyRoute):
105
+ request.route.slot_key_route.slot_type = to_protobuf_slot_type(route.slot_type)
106
+ request.route.slot_key_route.slot_key = route.slot_key
107
+ elif isinstance(route, SlotIdRoute):
108
+ request.route.slot_id_route.slot_type = to_protobuf_slot_type(route.slot_type)
109
+ request.route.slot_id_route.slot_id = route.slot_id
110
+ elif isinstance(route, ByAddressRoute):
111
+ request.route.by_address_route.host = route.host
112
+ request.route.by_address_route.port = route.port
113
+ else:
114
+ raise RequestError(f"Received invalid route type: {type(route)}")
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.1
2
+ Name: valkey-glide
3
+ Version: 1.3.5
4
+ Classifier: Topic :: Database
5
+ Classifier: Topic :: Utilities
6
+ Classifier: License :: OSI Approved :: Apache Software License
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: Topic :: Software Development
9
+ Classifier: Programming Language :: Rust
10
+ Classifier: Programming Language :: Python :: Implementation :: CPython
11
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
12
+ Requires-Dist: async-timeout>=4.0.2; python_version < '3.11'
13
+ Requires-Dist: typing-extensions>=4.8.0; python_version < '3.11'
14
+ Requires-Dist: protobuf>=3.20
15
+ Summary: An open source Valkey client library that supports Valkey and Redis open source 6.2, 7.0, 7.2 and 8.0.
16
+ Author: Valkey GLIDE Maintainers
17
+ License: Apache-2.0
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
20
+
21
+ # Valkey GLIDE
22
+
23
+ Valkey General Language Independent Driver for the Enterprise (GLIDE), is an open-source Valkey client library. Valkey GLIDE is one of the official client libraries for Valkey, and it supports all Valkey commands. Valkey GLIDE supports Valkey 7.2 and above, and Redis open-source 6.2, 7.0 and 7.2. Application programmers use Valkey GLIDE to safely and reliably connect their applications to Valkey- and Redis OSS- compatible services. Valkey GLIDE is designed for reliability, optimized performance, and high-availability, for Valkey and Redis OSS based applications. It is sponsored and supported by AWS, and is pre-configured with best practices learned from over a decade of operating Redis OSS-compatible services used by hundreds of thousands of customers. To help ensure consistency in application development and operations, Valkey GLIDE is implemented using a core driver framework, written in Rust, with language specific extensions. This design ensures consistency in features across languages and reduces overall complexity.
24
+
25
+ ## Supported Engine Versions
26
+
27
+ Refer to the [Supported Engine Versions table](https://github.com/valkey-io/valkey-glide/blob/main/README.md#supported-engine-versions) for details.
28
+
29
+ # Getting Started - Python Wrapper
30
+
31
+ ## System Requirements
32
+
33
+ The release of Valkey GLIDE was tested on the following platforms:
34
+
35
+ Linux:
36
+
37
+ - Ubuntu 22.04.1 (x86_64 and aarch64)
38
+ - Amazon Linux 2023 (AL2023) (x86_64)
39
+
40
+ macOS:
41
+
42
+ - macOS (Apple silicon/aarch_64 and Intel/x86_64)
43
+ Testing are being done on macOS arm64 platforms.
44
+ Please note that the package is not tested on macOS intel platforms, only minimal testing is done during CD.
45
+
46
+ ## Python Supported Versions
47
+
48
+ | Python Version |
49
+ |----------------|
50
+ | 3.9 |
51
+ | 3.10 |
52
+ | 3.11 |
53
+ | 3.12 |
54
+ | 3.13 |
55
+
56
+ ## Installation and Setup
57
+
58
+ ### Installing via Package Manager (pip)
59
+
60
+ To install Valkey GLIDE using `pip`, follow these steps:
61
+
62
+ 1. Open your terminal.
63
+ 2. Execute the command below:
64
+ ```bash
65
+ $ pip install valkey-glide
66
+ ```
67
+ 3. After installation, confirm the client is accessible by running:
68
+ ```bash
69
+ $ python3
70
+ >>> import glide
71
+ ```
72
+
73
+ ## Basic Examples
74
+
75
+ #### Cluster Mode:
76
+
77
+ ```python:
78
+ >>> import asyncio
79
+ >>> from glide import GlideClusterClientConfiguration, NodeAddress, GlideClusterClient
80
+ >>> async def test_cluster_client():
81
+ ... addresses = [NodeAddress("address.example.com", 6379)]
82
+ ... config = GlideClusterClientConfiguration(addresses)
83
+ ... client = await GlideClusterClient.create(config)
84
+ ... set_result = await client.set("foo", "bar")
85
+ ... print(f"Set response is {set_result}")
86
+ ... get_result = await client.get("foo")
87
+ ... print(f"Get response is {get_result}")
88
+ ...
89
+ >>> asyncio.run(test_cluster_client())
90
+ Set response is OK
91
+ Get response is bar
92
+ ```
93
+
94
+ #### Standalone Mode:
95
+
96
+ ```python:
97
+ >>> import asyncio
98
+ >>> from glide import GlideClientConfiguration, NodeAddress, GlideClient
99
+ >>> async def test_standalone_client():
100
+ ... addresses = [
101
+ ... NodeAddress("server_primary.example.com", 6379),
102
+ ... NodeAddress("server_replica.example.com", 6379)
103
+ ... ]
104
+ ... config = GlideClientConfiguration(addresses)
105
+ ... client = await GlideClient.create(config)
106
+ ... set_result = await client.set("foo", "bar")
107
+ ... print(f"Set response is {set_result}")
108
+ ... get_result = await client.get("foo")
109
+ ... print(f"Get response is {get_result}")
110
+ ...
111
+ >>> asyncio.run(test_standalone_client())
112
+ Set response is OK
113
+ Get response is bar
114
+ ```
115
+
116
+ For complete examples with error handling, please refer to the [cluster example](https://github.com/valkey-io/valkey-glide/blob/main/examples/python/cluster_example.py) and the [standalone example](https://github.com/valkey-io/valkey-glide/blob/main/examples/python/standalone_example.py).
117
+
118
+ ## Documentation
119
+
120
+ Visit our [wiki](https://github.com/valkey-io/valkey-glide/wiki/Python-wrapper) for examples and further details on TLS, Read strategy, Timeouts and various other configurations.
121
+
122
+ ### Building & Testing
123
+
124
+ Development instructions for local building & testing the package are in the [DEVELOPER.md](https://github.com/valkey-io/valkey-glide/blob/main/python/DEVELOPER.md#build-from-source) file.
125
+
@@ -0,0 +1,37 @@
1
+ valkey_glide-1.3.5.dist-info/METADATA,sha256=qyLsphqAtRf6Y93JnP9RPOcCi7slKawgNy-LlmAWZys,5116
2
+ valkey_glide-1.3.5.dist-info/WHEEL,sha256=p99NWwcjJuNqiQFdVZaMhdRHjtoUBT0X2w8hBl2qIME,112
3
+ glide/config.py,sha256=5kpn5OKkuzNHaRe7kpmLxlJNZ3D8V_H2t3k4DnVqAEQ,27648
4
+ glide/protobuf_codec.py,sha256=3tQnc3L-y1VoNLggN6FyYFR4POkgZLfu-xYAKE2dN8M,3623
5
+ glide/constants.py,sha256=B_mMzUS48ulnpQhv4h_NecRNTTENl6CuEl6OuJURYEI,4346
6
+ glide/async_commands/sorted_set.py,sha256=swS10R7AwEY8cNI3XlxUkfvlV_R9kx9fvN2encofmUg,11384
7
+ glide/async_commands/transaction.py,sha256=f3U5e3qtppXvsXLdIlwYCZFckyxtsVowQlCZjjBWHxE,222911
8
+ glide/async_commands/__init__.py,sha256=_tbTAFATlzp4L2qe-H77PpAQK-16VsV-y7uKNUKLC_o,136
9
+ glide/async_commands/core.py,sha256=9M09GMvxCIcyN9c93_qUwG_gFi6O-bn5J9Cro-74Fec,308681
10
+ glide/async_commands/server_modules/glide_json.py,sha256=JAoPqjtJH0XDWCKVigHwwghMJGYTTSYKTLT80W89WWw,61278
11
+ glide/async_commands/server_modules/json_batch.py,sha256=wBGOplaOp9ALJsAUJkTlrTmvO2ZWu044_4LKJqQd7Cg,36786
12
+ glide/async_commands/server_modules/ft.py,sha256=ysNIKNSU69j2pbl-_lWWxznklId2_4G88_bX4UyeUiQ,15507
13
+ glide/async_commands/server_modules/ft_options/ft_search_options.py,sha256=PN1m9gJ1V6CZrFLb3Espoa7THr6puk1J8H-lH_yEUeI,4759
14
+ glide/async_commands/server_modules/ft_options/ft_aggregate_options.py,sha256=No9LxyQ25-x7943guocs0vrwnzx-ruq8Oi7GWAlezww,9849
15
+ glide/async_commands/server_modules/ft_options/ft_create_options.py,sha256=9VCsI47tyyG5ai4Gy1mOl3HCha8AMK7mI1GMGCfJkeM,13529
16
+ glide/async_commands/server_modules/ft_options/ft_profile_options.py,sha256=s4XSiKpjFjBbtC5oCf6ddNYImf6ag7KvFcgOk2dNbYs,4185
17
+ glide/async_commands/server_modules/ft_options/ft_constants.py,sha256=r9uLAExg2qThjwOBC8LxqXBITF0fwa5xfnD7EXnyPrw,1704
18
+ glide/async_commands/stream.py,sha256=U7n2HPmHpcK1mmbI68szphZqjAoGPJTLOZscgw0WEK0,15791
19
+ glide/async_commands/standalone_commands.py,sha256=RrumL-O2rt6yPYS9QtftY1rebAcqxoshLsQvf_8GCMo,34742
20
+ glide/async_commands/cluster_commands.py,sha256=JjYuJbIkipQGllzwSJGvWzM88frFQenk1LTFY2qJueI,54315
21
+ glide/async_commands/command_args.py,sha256=Lz-Rl9pXtEcQ4hhcRns23x0dVPQ0shpqQw1a0vxFGAI,2561
22
+ glide/async_commands/bitmap.py,sha256=eYKfA1Xuikr7nXxCVGRsZ9RFKJOU_QN4nLXXTRtBSgU,10325
23
+ glide/__init__.py,sha256=2YpdncnGRo9mHjXVPBvLn2MuvllaMp7-HemVgQYmbA0,7328
24
+ glide/glide.pyi,sha256=K2CeC-F0E8vlr-rbko-E0PofzFoWl4da-xUQSuvuFDo,1105
25
+ glide/glide_client.py,sha256=g_HK93WjNYTJn1H_q1T5t6Cvym2Av5z2aCdYLXQsWLA,24356
26
+ glide/logger.py,sha256=zP_ENonH15lEvXlAYo1yg0QoJmHyZgEkI8H2-kO_QuY,3804
27
+ glide/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ glide/exceptions.py,sha256=ZI_LwIduoR-1jHm9-6jWZkx90AqCJLRtjbv4iESIEEA,1194
29
+ glide/protobuf/response_pb2.pyi,sha256=1US9ekAXkanJnzwArqHzj4NezV8TJl36QADmiAFqlKg,4076
30
+ glide/protobuf/connection_request_pb2.pyi,sha256=uwyWm81mAjtKnGGJFUoJVGr9_ou0xAxYd_ERgM7OXTw,12391
31
+ glide/protobuf/command_request_pb2.py,sha256=7BYmHeBKF76Yk911Nmeq5jwEGzjiOaHFnka08L6DOkI,18481
32
+ glide/protobuf/connection_request_pb2.py,sha256=LcB4WVCmhQEJ7n7Rx6VZyr6dIAh3zdF0PuYga6EeQBA,5221
33
+ glide/protobuf/command_request_pb2.pyi,sha256=QnRKhSy1jPbPBtHJsdbQyFWYGQkNZ8CVyG1IsZBYPBk,49860
34
+ glide/protobuf/response_pb2.py,sha256=r3_OFhf8HZvEmBSigSyBzG7S7kWl7CCgVMog4HgMFXM,2025
35
+ glide/routes.py,sha256=riaUkzI36tq4Lhsn11H7uSBdx7HfSvdT9YXxNabMNKk,3699
36
+ glide/glide.pypy39-pp73-darwin.so,sha256=Yfl_HDxJpDWV2fJmZ3Uhg99irhKfTJ63TR7LmnMlKas,4547544
37
+ valkey_glide-1.3.5.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (0.14.17)
3
+ Root-Is-Purelib: false
4
+ Tag: pp39-pypy39_pp73-macosx_10_7_x86_64