Skip to content

Fix type hinting of zrange and zrangestore#253

Open
aveao wants to merge 1 commit into
valkey-io:mainfrom
aveao:fix/252-zrange-type-hinting
Open

Fix type hinting of zrange and zrangestore#253
aveao wants to merge 1 commit into
valkey-io:mainfrom
aveao:fix/252-zrange-type-hinting

Conversation

@aveao

@aveao aveao commented Dec 9, 2025

Copy link
Copy Markdown

Pull Request check-list

  • Do tests and lints pass with this change?
    • locally tested, yes
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
    • Yes
  • Is the new or changed code fully tested?
    • Runs fine, and this is only typing changes
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
    • Unsure if I see any related documentation, the docstring was already correct.
  • Is there an example added to the examples folder (if applicable)?
    • Not applicable

Description of change

Fixes #252

start/end are type hinted as int only, whereas when bylex (or byscore) is set to True, the value is expected to be prepended with [ or (, as stated both in the function's docstring and redis docs.

This can only be done if start/end are passed as a string or as bytes.

Equivalent to redis/redis-py#3872

@aveao aveao force-pushed the fix/252-zrange-type-hinting branch 3 times, most recently from 5d23440 to 156322e Compare December 9, 2025 15:58
@mkmkme

mkmkme commented Dec 9, 2025

Copy link
Copy Markdown
Collaborator

Hey! Thanks for your PR. I'm currently working on the bigger change related to typing system in the repo. It's quite a mess at this point. My changes will make your changes obsolete. We can of course merge this one, but there won't be a lot of sense to keep it soon

mkmkme added a commit that referenced this pull request Mar 21, 2026
Fixes #252 and closes #253

Signed-off-by: Mikhail Koviazin <github@mkmk.aleeas.com>
Signed-off-by: Ave Özkal <non_bots_send_instead_to_githubhuman_at_ave_zone@ave.zone>
@mkmkme mkmkme force-pushed the fix/252-zrange-type-hinting branch from 156322e to 3556792 Compare May 2, 2026 08:04
@mkmkme

mkmkme commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Hey! I've landed quite a large change recently to valkey/commands/core.py, and now these changes should be also propagated to the Sync and Async overload of those functions. That's nothing major -- your changes simply need to be applied at the same file in several other places.

Do you want to do it yourself in your PR or do you want me to do it separately?

Anyways thanks for calling this out, that's a good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Type hinting of zrange command incompatible with bylex argument

2 participants