valkey
Python client for Valkey forked from redis-py
What it is and what it does
Valkey is a Python client library that provides a complete interface to the Valkey key-value store, a fork of Redis. It exposes all standard Valkey commands through native Python methods, handles connection pooling automatically, and supports both synchronous and asynchronous workflows. The library includes built-in support for advanced features like pipelining (batching commands to reduce round-trip overhead), pub/sub messaging, and RESP3 protocol negotiation.
The package is designed as a drop-in replacement for redis-py, with backward-compatible aliases available for a smooth migration path. It depends only on async-timeout for its core functionality and optionally integrates a compiled response parser (libvalkey) for improved performance when available. The library supports modern Python versions (3.9 through 3.13) and runs on both CPython and PyPy.
Use it for:
- Build a session store or cache layer for web applications using synchronous or async connection pools.
- Implement real-time messaging or event distribution using pub/sub channels.
- Batch multiple database operations into a single round-trip using pipelines to reduce latency.
- Migrate existing redis-py code to Valkey with minimal changes using provided compatibility aliases.
- Store and retrieve structured data (strings, hashes, lists, sets) in a high-performance key-value store.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python client library for connecting to and executing commands against a Valkey key-value store, with support for connection pooling, pipelining, pub/sub messaging, and both synchronous and asynchronous operations.
Yes. Valkey-py is actively maintained, has no known vulnerabilities, installs with minimal friction, and provides a complete, production-stable Python interface to Valkey. It is the appropriate choice for any Python application that needs to interact with a Valkey server, whether for caching, sessions, pub/sub, or general key-value operations. The MIT license poses no restrictions.
Install
valkey on PyPI
pip
pip install valkeyuv
uv add valkeypoetry
poetry add valkeyInstalling valkey
Before you install
Low install friction with a single lightweight runtime dependency (async-timeout). Active maintenance with recent commits and stable production status across Python 3.9–3.13.
License in practice
MIT license permits commercial and private use with minimal restrictions; no copyleft obligations.
Quickstart
pip install valkey
import valkey
r = valkey.Valkey(host='localhost', port=6379, db=0)
r.set('foo', 'bar')
print(r.get('foo'))
Requires a running Valkey server (e.g., via Docker or local installation) accessible on the specified host and port.
Verify before relying
- Whether the optional libvalkey compiled parser (libvalkey >= 2.3.2) is automatically detected and used when installed.
- Performance characteristics and overhead of the async-timeout dependency under high concurrency.
- Compatibility guarantees with Valkey server versions beyond what the documentation states.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — async-timeout |
| Maintenance | actively maintained — 368 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,914,004/month — #2,013 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: valkey-6.1.1-py3-none-any.whl
Keywords: Valkey, key-value store, database
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
libvalkeylibvalkey is a Python C extension that…
permissive · top 5,000 on PyPI
valkey-glideValkey GLIDE is an official async and sync…
permissive · top 5,000 on PyPI
django-valkeyProvides a Valkey cache and session backend for…
permissive · top 15,000 on PyPI
redisliteRedislite embeds a self-contained Redis server…
permissive · top 15,000 on PyPI
py-key-value-aioProvides an async-only, pluggable key-value…
permissive · top 1,000 on PyPI
opentelemetry-python-contrib-external-valkeyAdds OpenTelemetry tracing to the Valkey Python…
permissive · top 15,000 on PyPI
aioredisAn asyncio-based Redis client library providing…
permissive · top 5,000 on PyPI
fakeredisfakeredis provides an in-memory, pure-Python…
permissive · top 1,000 on PyPI
redis-cliProvides a lightweight wrapper around redis-py…
permissive · top 15,000 on PyPI