Changes
Async Cluster PubSub & Keyspace Notifications
This release introduces full asyncio Cluster PubSub support, bringing shard-channel capabilities (SSUBSCRIBE, SUNSUBSCRIBE, SPUBLISH) to the async RedisCluster client. The new ClusterPubSub class in redis.asyncio.cluster automatically routes shard-channel subscriptions to the correct cluster node based on key-slot hashing, manages per-node PubSub connections, and supports round-robin message retrieval across nodes. Users can create a cluster pubsub instance via RedisCluster.pubsub() and use ssubscribe(), sunsubscribe(), and get_sharded_message() just as they would with the sync cluster client.
Alongside this, Redis Keyspace Notifications are now supported for both standalone and cluster deployments, in both sync and async modes. New classes—KeyspaceNotifications, ClusterKeyspaceNotifications, AsyncKeyspaceNotifications, and AsyncClusterKeyspaceNotifications—provide a high-level API for subscribing to keyspace and keyevent channels. In cluster mode, notifications are automatically subscribed across all primary nodes (since each node only emits notifications for keys it owns), with built-in topology-change handling. Convenience methods like subscribe_keyspace(), subscribe_keyevent(), and channel classes (KeyspaceChannel, KeyeventChannel) simplify common subscription patterns. Both sync run_in_thread() and async listen() workflows are supported.
Type Hints Improvements (breaking changes)
The @overload pattern has been applied systematically across core commands (core.py), VectorSet commands, and module commands (Search, JSON, TimeSeries, Bloom filters) to provide distinct return types for sync and async clients. Previously, methods returned a combined ResponseT (i.e., Union[Awaitable[Any], Any]), which caused static analysis tools like mypy and Pyright to flag false positives. Now, sync clients see concrete return types (e.g., int, bool, list[str]) while async clients see Awaitable[...] wrappers. This is a breaking change for type-checking only—runtime behavior is unchanged, but code relying on the old union return types in type annotations may need updates. Two new protocol types, SyncClientProtocol and AsyncClientProtocol, are used in overload signatures to enable this distinction.
🚀 New Features
- Support Cluster PubSub in asyncio (#3736)
- Add Redis Keyspace Notifications Support for Redis Cluster (#3962)
🔥 Breaking changes
- Type hints improvements - fixing static code analyses issues related to combined sync and async return types(vectorsets + commands in core.py) (#3991)
- Type hints improvements - fixing static code analyses issues related to combined sync and async return types - modules (#4005)
- Add Redis Keyspace Notifications Support for Redis Cluster (#3962)
🐛 Bug Fixes
- fix: guard disconnect() against RuntimeError on Python 3.13+ (#3856) (#4013)
- Fix CacheProxyConnection hang when invalidation arrives on another connection (#3600) (#4014)
- fix: handle scientific notation in score_cast_func for RESP2 (#4016)
- Fix TypeError in CacheProxyConnection when cached response is non-bytes (#4017)
⚠️ Deprecations
- Align deprecation of lib_name/lib_version in async cluster (#3995)
🧰 Maintenance
- Adding unstable 8.8 build to pipeline test matrix. Updating the lib version in master. (#4004)
- Fix type hints for register_script to support RedisCluster (#3876)
- Updating dependencies to fix reported vulnerabilities (#4012)
- Bump release-drafter/release-drafter from 6 to 7 (#4019)
- Bump rojopolis/spellcheck-github-actions from 0.58.0 to 0.60.0 (#4018)
We'd like to thank all the contributors who worked on this release!
@abersheeran @alisaifee @majiayu000 @dmaier-redislabs @vladvildanov @petyaslavova