redis-py is the Python interface to Redis key-value stores. It connects to standalone, Sentinel-managed, or cluster deployments and exposes Redis commands with pools, pipelines, and pub/sub helpers.
Overview
redis-py lets Python programs talk to Redis over the wire protocol, set and get keys, and use the full command surface with naming adapted where Python reserves words. Responses default to bytes unless decode_responses is enabled.
Recent releases default to RESP3 on the wire while keeping legacy response shapes unless you opt into unified shapes. Connection pools manage sockets per client instance, and dedicated classes cover async clients, clusters, Sentinel failover, and multi-database Active-Active failover for Redis Software or Cloud setups.
Pipelines batch commands to cut round trips; PubSub holds a connection for subscribe and listen flows separate from normal command mode. Module commands for search, JSON, time series, and similar features need explicit protocol settings when proxies lack HELLO support.
Install via pip and point the client at localhost or remote hosts. Documentation covers authentication, parsers, unified response migration, and bulk hash ingestion helpers added for newer Redis releases.
Key features
- Full Redis command coverage
- Connection pooling
- Pipeline and transaction batches
- PubSub subscriber helper
- Redis Cluster and Sentinel clients
- Async and async cluster clients
- RESP3 with RESP2 fallback
- Multi-database failover client
Use cases
- Application caching layers
- Session and rate-limit storage
- Pub/sub messaging in Python
- Cluster-aware backend services
- Sentinel-managed primary access