Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Some arguments missing in API comparing to redis-py and Redis commands #1260

Open
1 task done
wodny opened this issue Jan 2, 2022 · 2 comments · May be fixed by #1156
Open
1 task done

Some arguments missing in API comparing to redis-py and Redis commands #1260

wodny opened this issue Jan 2, 2022 · 2 comments · May be fixed by #1156
Labels

Comments

@wodny
Copy link

wodny commented Jan 2, 2022

Describe the bug

I have noticed it by lack of LT/GT for ZADD available since Redis 6.2. Quick comparison:

$ ./compare-redis.py
acl_genpass {'bits'}
bgsave {'schedule'}
client_kill_filter {'laddr', 'user'}
client_list {'client_id'}
client_pause {'all'}
geoadd {'ch', 'nx', 'xx'}
georadius {'any'}
georadiusbymember {'any'}
lpop {'count'}
lpushx {'value', 'values'}
module_load {'args'}
restore {'frequency', 'idletime'}
rpop {'count'}
script_flush {'sync_type'}
set {'exat', 'get', 'pxat'}
xadd {'minid', 'limit', 'nomkstream'}
xinfo_stream {'full'}
xpending_range {'idle'}
xtrim {'minid', 'limit'}
zadd {'lt', 'gt'}
zrange {'num', 'offset', 'byscore', 'bylex'}

as output by the following code:

#!/usr/bin/env python3

import inspect
import aioredis
import redis.commands.core as core
import redis.commands.sentinel as sentinel

class Commands(
    core.CoreCommands,
    core.DataAccessCommands,
    core.ManagementCommands,
    core.PubSubCommands,
    sentinel.SentinelCommands,
):
    pass

for name, func in inspect.getmembers(aioredis.Redis, inspect.isfunction):
    if name.startswith("_"):
        continue
    try:
        rc = getattr(Commands, name)
        rc = inspect.signature(rc).parameters.keys()
        aio = inspect.signature(func).parameters.keys()
        diff = (set(rc) ^ set(aio)) - set(["kwargs"])
        if diff:
            print(name, diff)
    except Exception as e:
        pass

If it's a proper observation I could probably implement missing parts and make a PR. Unless there is some ongoing refactoring I would be messing with.

To Reproduce

Run the attached code or try to call API with missing arguments.

Expected behavior

API in sync with redis-py.

Logs/tracebacks

As attached.

Python Version

3.7 in my case but any really

aioredis Version

2.0.1

Additional context

aioredis 2.0.1
hiredis  2.0.0
redis    4.1.0

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@wodny wodny added the bug label Jan 2, 2022
@Andrew-Chen-Wang
Copy link
Collaborator

Andrew-Chen-Wang commented Jan 2, 2022

@wodny we are currently refactoring to be more up to date with redis-py. Sorry for the delay. I should have time this week as school starts up again.

@Andrew-Chen-Wang
Copy link
Collaborator

Heads up #1156 will be merged soon. It should fix your core.Commands mixin. I would love some help with #1267 to be more up to date with Redis. I have a fairly jam packed school schedule this semester, so #1267 needs as much love as possible! Thanks!

@Andrew-Chen-Wang Andrew-Chen-Wang linked a pull request Jan 12, 2022 that will close this issue
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants