{"id":3313,"library":"valkey-glide-sync","title":"Valkey GLIDE Sync Client","description":"Valkey GLIDE Sync is an official open-source Valkey client library for Python, designed to interact with Valkey and Redis OSS in a synchronous manner. It supports both standalone and cluster deployments, offering features like automatic topology discovery, read-from-replica options, and OpenTelemetry integration. The library is part of the Valkey organization and aims for high performance and reliability, currently at version 2.3.1.","status":"active","version":"2.3.1","language":"python","source_language":"en","source_url":"https://github.com/valkey-io/valkey-glide","tags":["database","Valkey","Redis","client","sync","data-store"],"install":[{"cmd":"pip install valkey-glide-sync","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The `glide` package is for the asynchronous client. The synchronous client classes are in `glide_sync`.","wrong":"from glide import GlideClient","symbol":"GlideClient","correct":"from glide_sync import GlideClient"},{"note":"The `glide` package is for the asynchronous client. The synchronous client classes are in `glide_sync`.","wrong":"from glide import GlideClusterClient","symbol":"GlideClusterClient","correct":"from glide_sync import GlideClusterClient"},{"symbol":"GlideClientConfiguration","correct":"from glide_sync import GlideClientConfiguration"},{"symbol":"NodeAddress","correct":"from glide_sync import NodeAddress"}],"quickstart":{"code":"import os\nfrom glide_sync import GlideClient, GlideClientConfiguration, NodeAddress\n\n# Configure connection details (e.g., from environment variables)\nHOST = os.environ.get('GLIDE_HOST', 'localhost')\nPORT = int(os.environ.get('GLIDE_PORT', '6379'))\nPASSWORD = os.environ.get('GLIDE_PASSWORD', '') # Optional\n\n# For Standalone client\nconfig = GlideClientConfiguration(\n    addresses=[NodeAddress(host=HOST, port=PORT)],\n    password=PASSWORD if PASSWORD else None # Set password only if provided\n)\n\n# Create and connect the client (sync method)\ntry:\n    client = GlideClient.create(config).get()\n    response = client.ping().get()\n    print(f\"Ping response: {response}\")\n    \n    client.set('mykey', 'myvalue').get()\n    value = client.get('mykey').get()\n    print(f\"Retrieved value for 'mykey': {value}\")\n    \nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    if 'client' in locals() and client:\n        client.close()\n","lang":"python","description":"This quickstart demonstrates how to connect to a standalone Valkey or Redis OSS instance using the synchronous Glide client, perform a simple PING, SET, and GET operation, and then close the client. It uses environment variables for host and port, falling back to localhost:6379 for local testing. Remember to use `.get()` to retrieve results from the synchronous client's future-like return values."},"warnings":[{"fix":"Update import statements from `from glide import ...` to `from glide_sync import ...` for synchronous client components.","message":"In version 2.1, the Python package structure underwent a significant change. Previously, core components might have been accessible directly under `glide`. Now, synchronous client classes are specifically under `glide_sync`, and shared components are under `glide_shared`. This change can break existing imports if not updated.","severity":"breaking","affected_versions":">=2.1.0"},{"fix":"Always use `pip install valkey-glide-sync` and `from glide_sync import ...` for synchronous operations, or `pip install valkey-glide` and `from glide import ...` for asynchronous operations.","message":"Valkey GLIDE offers both synchronous (`valkey-glide-sync`) and asynchronous (`valkey-glide`) Python clients. Ensure you install and import from the correct package (`glide_sync` for sync, `glide` for async) based on your application's concurrency model. Mixing them or using the wrong package can lead to unexpected behavior or `AttributeError`s.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Append `.get()` to all command calls to synchronously retrieve their results, e.g., `value = client.get('key').get()`.","message":"When executing commands with the synchronous client, the methods return a future-like object. You must explicitly call `.get()` on the result of a command (e.g., `client.ping().get()`) to retrieve the actual value or wait for completion. Failing to do so will result in an unawaited future object.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Instantiate `GlideClient` for standalone servers and `GlideClusterClient` for cluster environments, ensuring the configuration matches the deployment type.","message":"For cluster deployments, you must use `GlideClusterClient` and `GlideClusterClientConfiguration`. For standalone deployments, use `GlideClient` and `GlideClientConfiguration`. Using the wrong client type for your Redis/Valkey setup will result in connection or command execution errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Design your application to initialize OpenTelemetry tracing and metrics once at startup. For configuration changes, a process restart is required.","message":"OpenTelemetry configuration can only be initialized once per process. If you need to change OpenTelemetry settings, your application must be restarted to apply the new configuration.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'2.3.1':70 'aim':61 'automat':41 'client':4,15,74 'cluster':36 'current':67 'data':77 'data-stor':76 'databas':71 'deploy':37 'design':19 'discoveri':43 'featur':39 'glide':2,6 'high':63 'integr':51 'interact':21 'librari':16,53 'like':40 'manner':30 'offer':38 'offici':10 'open':12 'open-sourc':11 'opentelemetri':50 'option':48 'organ':59 'oss':26 'part':55 'perform':64 'python':18 'read':45 'read-from-replica':44 'redi':25,73 'reliabl':66 'replica':47 'sourc':13 'standalon':34 'store':78 'support':32 'sync':3,7,75 'synchron':29 'topolog':42 'valkey':1,5,14,23,58,72 'version':69","created_at":"2026-04-11T09:30:12.577134+00:00","updated_at":"2026-04-17T00:10:05.212779+00:00","problems":[{"fix":"Install the package using `pip install valkey-glide-sync` and ensure the import statement is `from valkey_glide_sync.client import ValkeyClient`.","cause":"The `valkey-glide-sync` package is either not installed in the current Python environment or there is a typo in the import statement.","error":"ModuleNotFoundError: No module named 'valkey_glide_sync'"},{"fix":"Verify that the Valkey/Redis server is actively running and accessible from the client's machine at the specified host and port. Check server logs and network configurations.","cause":"The Valkey or Redis server the client is attempting to connect to is not running, is configured on a different host/port, or a network firewall is preventing the connection.","error":"ConnectionRefusedError: [Errno 111] Connection refused"},{"fix":"Instantiate `ValkeyClient` by passing a `GlideClientConfiguration` object, for example: `from valkey_glide_sync.client import ValkeyClient, GlideClientConfiguration; config = GlideClientConfiguration(host='localhost', port=6379); client = ValkeyClient(config)`.","cause":"The `ValkeyClient` constructor requires an instance of `GlideClientConfiguration` to define connection parameters and client behavior.","error":"TypeError: ValkeyClient() missing 1 required positional argument: 'config'"},{"fix":"When connecting to a Valkey/Redis cluster, provide a list of multiple host-port tuples (seed nodes) to the `GlideClientConfiguration`, e.g., `config = GlideClientConfiguration(host=['host1:port1', 'host2:port2'], cluster_mode=True)`.","cause":"The client was initialized with `cluster_mode=True` or connected to a cluster port, but the configuration provided only a single host instead of a list of cluster seed nodes.","error":"glide.exceptions.GlideClientException: Cluster mode is enabled, but single host was provided."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.5.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/valkey-glide-sync/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}