Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aioredis is deprecated #11

Open
joliss opened this issue Oct 20, 2023 · 4 comments
Open

aioredis is deprecated #11

joliss opened this issue Oct 20, 2023 · 4 comments

Comments

@joliss
Copy link

joliss commented Oct 20, 2023

aioredis has been deprecated as it is now included in the official redis Python package. As aioredis fails to import on Python 3.11+, it prevents me from using openlimit, even if I don't use Redis at all. So it would be great to update the dependency to the official redis package, which hopefully doesn't suffer from this problem.

@skulltech
Copy link

Same happened here. Unable to use openlimit because of this.

@shaggy2626
Copy link

@joliss @skulltech I'm also experiencing this issue, thought I would check in with both of you to see if you found a work around to use openlimit

@vshulman
Copy link

vshulman commented Dec 20, 2023

@shaggy2626 if you aren't using Redis, I was able to make it work with the following changes based on this thread:

diff --git a/openlimit/buckets/redis_bucket.py b/openlimit/buckets/redis_bucket.py
index eb84428..67e64aa 100644
--- a/openlimit/buckets/redis_bucket.py
+++ b/openlimit/buckets/redis_bucket.py
@@ -4,9 +4,9 @@ import time
 import typing

 # Third party
-import aioredis
-import aioredis.client
-import aioredis.lock
+from redis import asyncio as aioredis

 ######
 # MAIN
diff --git a/openlimit/buckets/redis_buckets.py b/openlimit/buckets/redis_buckets.py
index e08653b..af49676 100644
--- a/openlimit/buckets/redis_buckets.py
+++ b/openlimit/buckets/redis_buckets.py
@@ -2,8 +2,8 @@ import asyncio
 from contextlib import AsyncExitStack, ExitStack
 from typing import Optional

-import aioredis
-import aioredis.client
+from redis import asyncio as aioredis

 from openlimit.buckets.redis_bucket import RedisBucket

diff --git a/openlimit/redis_rate_limiters.py b/openlimit/redis_rate_limiters.py
index 644160c..087b88f 100644
--- a/openlimit/redis_rate_limiters.py
+++ b/openlimit/redis_rate_limiters.py
@@ -2,7 +2,7 @@
 import asyncio

 # Third party
-import aioredis
+from redis import asyncio as aioredis

 # Local
 import openlimit.utilities as utils

This might also work with Redis, although I haven't tested it.

@shaggy2626
Copy link

@shaggy2626 if you aren't using Redis, I was able to make it work with the following changes based on this thread:

diff --git a/openlimit/buckets/redis_bucket.py b/openlimit/buckets/redis_bucket.py
index eb84428..67e64aa 100644
--- a/openlimit/buckets/redis_bucket.py
+++ b/openlimit/buckets/redis_bucket.py
@@ -4,9 +4,9 @@ import time
 import typing

 # Third party
-import aioredis
-import aioredis.client
-import aioredis.lock
+from redis import asyncio as aioredis

 ######
 # MAIN
diff --git a/openlimit/buckets/redis_buckets.py b/openlimit/buckets/redis_buckets.py
index e08653b..af49676 100644
--- a/openlimit/buckets/redis_buckets.py
+++ b/openlimit/buckets/redis_buckets.py
@@ -2,8 +2,8 @@ import asyncio
 from contextlib import AsyncExitStack, ExitStack
 from typing import Optional

-import aioredis
-import aioredis.client
+from redis import asyncio as aioredis

 from openlimit.buckets.redis_bucket import RedisBucket

diff --git a/openlimit/redis_rate_limiters.py b/openlimit/redis_rate_limiters.py
index 644160c..087b88f 100644
--- a/openlimit/redis_rate_limiters.py
+++ b/openlimit/redis_rate_limiters.py
@@ -2,7 +2,7 @@
 import asyncio

 # Third party
-import aioredis
+from redis import asyncio as aioredis

 # Local
 import openlimit.utilities as utils

This might also work with Redis, although I haven't tested it.

Thank you for the update. Im not using redis, would i still need to use this? openlimit/buckets/redis_bucket.py ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants