Getting Started
System Requirements
Section titled “System Requirements”The release of Valkey GLIDE was tested on the following platforms:
Linux:
- Ubuntu 20 (x86_64/amd64 and arm64/aarch64)
- Amazon Linux 2 (AL2) and 2023 (AL2023) (x86_64)
macOS:
- macOS 14.7 (Apple silicon/aarch_64)
- macOS 13.7 (x86_64/amd64)
Python Supported Versions
Section titled “Python Supported Versions”We currently support Python 3.9 to 3.13
Valkey GLIDE transparently supports both the asyncio and trio concurrency frameworks.
Installation and Setup
Section titled “Installation and Setup”The Python client is available in synchronous and asynchronous version:
pip3 install valkey-glidepip3 install valkey-glide-syncExamples: Async Client
Section titled “Examples: Async Client”Async Cluster Mode
Section titled “Async Cluster Mode”import asynciofrom glide import GlideClusterClientConfiguration, NodeAddress, GlideClusterClient
async def test_cluster_client(): addresses = [NodeAddress("address.example.com", 6379)] # It is recommended to set a timeout for your specific use case config = GlideClusterClientConfiguration(addresses, request_timeout=500) # 500ms timeout client = await GlideClusterClient.create(config) set_result = await client.set("foo", "bar") print(f"Set response is {set_result}") get_result = await client.get("foo") print(f"Get response is {get_result}")
asyncio.run(test_cluster_client())Async Standalone Mode
Section titled “Async Standalone Mode”import asynciofrom glide import GlideClientConfiguration, NodeAddress, GlideClient
async def test_standalone_client(): addresses = [ NodeAddress("server_primary.example.com", 6379), NodeAddress("server_replica.example.com", 6379) ] # It is recommended to set a timeout for your specific use case config = GlideClientConfiguration(addresses, request_timeout=500) # 500ms timeout client = await GlideClient.create(config) set_result = await client.set("foo", "bar") print(f"Set response is {set_result}") get_result = await client.get("foo") print(f"Get response is {get_result}")
asyncio.run(test_standalone_client())Examples: Sync Client
Section titled “Examples: Sync Client”Sync Cluster Mode
Section titled “Sync Cluster Mode”from glide_sync import GlideClusterClientConfiguration, NodeAddress, GlideClusterClient
def test_cluster_client(): addresses = [NodeAddress("address.example.com", 6379)] # It is recommended to set a timeout for your specific use case config = GlideClusterClientConfiguration(addresses, request_timeout=500) # 500ms timeout client = GlideClusterClient.create(config) set_result = client.set("foo", "bar") print(f"Set response is {set_result}") get_result = client.get("foo") print(f"Get response is {get_result}")
test_cluster_client()Sync Standalone Mode
Section titled “Sync Standalone Mode”from glide_sync import GlideClientConfiguration, NodeAddress, GlideClient
def test_standalone_client(): addresses = [ NodeAddress("server_primary.example.com", 6379), NodeAddress("server_replica.example.com", 6379) ] # It is recommended to set a timeout for your specific use case config = GlideClientConfiguration(addresses, request_timeout=500) # 500ms timeout client = GlideClient.create(config) set_result = client.set("foo", "bar") print(f"Set response is {set_result}") get_result = client.get("foo") print(f"Get response is {get_result}")
test_standalone_client()For complete examples with error handling, please refer to:
Building & Testing
Section titled “Building & Testing”Development instructions for local building & testing the package are in the developer section.