skillfed

valkey

Python client for Valkey forked from redis-py

valkey v6.1.1 5.9M downloads/30d#2,013 on PyPI278
Permissive license MIT Active released

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 valkey

uv

uv add valkey

poetry

poetry add valkey

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

valkey python clientkey-value store clientredis-compatible pythonvalkey connection librarypython database clientpub/sub messaging clientasync key-value store
key-value-storeasync-supportpub-sub

More Database packages