{"id":5550,"library":"valkey-glide","title":"Valkey GLIDE Async client","description":"Valkey GLIDE (General Language Independent Driver for the Enterprise) is an official open-source client library for Valkey and Redis OSS. Built with a Rust core and language-specific wrappers, it offers high-performance, reliability, and consistency across multiple languages. The Python client, currently at version 2.3.1, provides both asynchronous and synchronous interfaces and is regularly updated to support new Valkey features and best practices.","status":"active","version":"2.3.1","language":"en","source_language":"en","source_url":"https://github.com/valkey-io/valkey-glide","tags":["Valkey","Redis","client","async","cluster","database"],"install":[{"cmd":"pip install valkey-glide","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required Python version.","package":"python","version":">=3.9","optional":false},{"reason":"Required for asynchronous operations.","package":"anyio","optional":false},{"reason":"Dependency listed on PyPI.","package":"protobuf","optional":false},{"reason":"Dependency listed on PyPI.","package":"sniffio","optional":false},{"reason":"Dependency listed on PyPI.","package":"typing-extensions","optional":false}],"imports":[{"symbol":"GlideClient","correct":"from glide import GlideClient, NodeAddress"},{"symbol":"GlideClusterClient","correct":"from glide import GlideClusterClient, NodeAddress"},{"note":"For the synchronous client, import from `glide_sync`.","symbol":"GlideClient (sync)","correct":"from glide_sync import GlideClient, NodeAddress"},{"note":"For the synchronous cluster client, import from `glide_sync`.","symbol":"GlideClusterClient (sync)","correct":"from glide_sync import GlideClusterClient, NodeAddress"}],"quickstart":{"code":"import asyncio\nfrom glide import GlideClient, GlideClusterClient, NodeAddress\nimport os\n\nasync def main():\n    # Example for a standalone Valkey instance\n    # Ensure a Valkey server is running on localhost:6379 (e.g., via Docker)\n    # docker run -d --name valkey-server -p 6379:6379 valkey/valkey:latest\n    print(\"\\n--- Standalone Client Example ---\")\n    standalone_client = GlideClient([NodeAddress(\"localhost\", 6379)])\n    try:\n        pong_response = await standalone_client.ping()\n        print(f\"Standalone PING response: {pong_response}\")\n\n        await standalone_client.set(\"mykey\", \"myvalue\")\n        value = await standalone_client.get(\"mykey\")\n        print(f\"Standalone GET mykey: {value}\")\n    except Exception as e:\n        print(f\"Error with Standalone Client: {e}\")\n    finally:\n        await standalone_client.close()\n\n    # Example for a Valkey cluster instance\n    # Replace with actual cluster addresses\n    # For local testing, you might need a local Valkey cluster setup\n    print(\"\\n--- Cluster Client Example ---\")\n    cluster_addresses = [NodeAddress(os.environ.get('VALKEY_CLUSTER_HOST', 'localhost'), int(os.environ.get('VALKEY_CLUSTER_PORT', '7000')))]\n    cluster_client = GlideClusterClient(cluster_addresses)\n    try:\n        cluster_pong_response = await cluster_client.ping()\n        print(f\"Cluster PING response: {cluster_pong_response}\")\n\n        await cluster_client.set(\"cluster_key\", \"cluster_value\")\n        cluster_value = await cluster_client.get(\"cluster_key\")\n        print(f\"Cluster GET cluster_key: {cluster_value}\")\n    except Exception as e:\n        print(f\"Error with Cluster Client: {e}\")\n    finally:\n        await cluster_client.close()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates connecting to a standalone Valkey instance and a Valkey cluster using `valkey-glide`'s asynchronous clients. It performs a `PING` command to verify connection and `SET`/`GET` operations. For cluster mode, ensure `VALKEY_CLUSTER_HOST` and `VALKEY_CLUSTER_PORT` environment variables are set to your cluster's entry point, or adjust the default `localhost:7000` to a running cluster node."},"warnings":[{"fix":"Ensure OpenTelemetry configuration is set up once at application startup. For changes, restart the application.","message":"OpenTelemetry can only be initialized once per process. Attempting to re-initialize it will not apply new configurations and requires a full application restart for changes to take effect.","severity":"gotcha","affected_versions":"All versions with OpenTelemetry support (2.0+)"},{"fix":"Always explicitly set `use_tls=True` in `GlideClientConfiguration` or `GlideClusterClientConfiguration` when connecting to a TLS-enabled server. If using custom certificates, also provide the `root_certificates` parameter.","message":"Connecting to a TLS-enabled Valkey server without setting `use_tls=True` in the client configuration will result in connection timeouts.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use a supported Linux distribution (e.g., Ubuntu, Amazon Linux) or macOS. Monitor official documentation for future Alpine/MUSL support.","message":"Currently, Alpine Linux / MUSL is NOT officially supported for the Python client. Users on these platforms may encounter compilation or runtime issues.","severity":"gotcha","affected_versions":"All versions 2.x.x"},{"fix":"Avoid using client-side compression for commands such as `APPEND`, `SETRANGE`, `GETRANGE`, etc., where the server needs to interpret or modify string data directly. Consult documentation for a full list of incompatible commands.","message":"Automatic compression/decompression in Valkey GLIDE is NOT compatible with Valkey commands that manipulate string data on the server side.","severity":"gotcha","affected_versions":"All versions with compression support (Experimental)"},{"fix":"If these features are required, use the asynchronous client (from `glide`). For synchronous workflows requiring these features, consider using an `asyncio` event loop to run asynchronous client calls.","message":"The synchronous Python client (from `glide_sync`) introduced in version 2.1 does not yet support all features available in the asynchronous client, specifically: Pub/Sub, Cluster scan, configuring an In-flight request limit, and OpenTelemetry integration.","severity":"gotcha","affected_versions":">=2.1.0"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}