redis-py icon indicating copy to clipboard operation
redis-py copied to clipboard

Type hints for chained pipelines

Open leverage-analytics opened this issue 8 months ago • 1 comments

I'm using redis-py version 5.2.1.

The documentation shows that calls to a pipeline can be chained. Here's an example from the documentation:

pipe = r.pipeline()
pipe.set("a", "a value").set("b", "b value").get("a").execute()

The type hints appear to be set incorrectly on the methods to return the pipeline object.

It seems that since Pipeline inherits from Redis whichin turn inherts from RedisModuleCommands, CoreCommands, and SentinelCommands, the types for chained Pipeline commands aren't working because the inherited commands return their "normal" responses as typed.

The same thing is happening in the asyncio module.

leverage-analytics avatar Apr 23 '25 21:04 leverage-analytics

Hi @leverage-analytics, thank you for pointing this out! We'll have a look at this.

petyaslavova avatar Apr 25 '25 17:04 petyaslavova