Skip to content

Commit

Permalink
redis-py replaces aioredis
Browse files Browse the repository at this point in the history
  • Loading branch information
madkote committed Sep 19, 2022
1 parent d2c9a59 commit c4e8d94
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Changes
## 0.11.0 (2022-09-19)
- `[feature]` `redis-py` replaces `aioredis`
## 0.10.0 (2022-07-07)
- `[feature]` Update `aioredis` to `2.x.x`
- `[feature]` Add `fakeredis` optionally for development purpose
Expand Down
2 changes: 1 addition & 1 deletion alt_requirements/requirements_redis.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-r requirements_core.txt
aioredis[hiredis]>=2.0.*
redis[hiredis]>=4.3.*
8 changes: 4 additions & 4 deletions fastapi_plugins/_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import enum
import typing

import aioredis # @UnusedImport
import aioredis.sentinel
import fastapi
import pydantic
import redis.asyncio as aioredis
import redis.asyncio.sentinel as aioredis_sentinel
import starlette.requests
import tenacity

Expand Down Expand Up @@ -117,7 +117,7 @@ class RedisPlugin(Plugin, ControlHealthMixin):
DEFAULT_CONFIG_CLASS = RedisSettings

def _on_init(self) -> None:
self.redis: typing.Union[aioredis.Redis, aioredis.sentinel.Sentinel] = None # noqa E501
self.redis: typing.Union[aioredis.Redis, aioredis_sentinel.Sentinel] = None # noqa E501

async def _on_call(self) -> typing.Any:
if self.redis is None:
Expand Down Expand Up @@ -177,7 +177,7 @@ async def init(self):
method = fakeredis.aioredis.FakeRedis.from_url
elif self.config.redis_type == RedisType.sentinel:
address = self.config.get_sentinels()
method = aioredis.sentinel.Sentinel
method = aioredis_sentinel.Sentinel
else:
raise NotImplementedError(
'Redis type %s is not implemented' % self.config.redis_type
Expand Down
2 changes: 1 addition & 1 deletion fastapi_plugins/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from __future__ import absolute_import

VERSION = (0, 10, 0)
VERSION = (0, 11, 0)

__all__ = []
__author__ = 'madkote <madkote(at)bluewin.ch>'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _read():
'tenacity>=8.0.*'
]
REQUIRES_INSTALL += ['python-json-logger>=2.0.*']
REQUIRES_INSTALL += ['aioredis[hiredis]>=2.0.*']
REQUIRES_INSTALL += ['redis[hiredis]>=4.3.*']
REQUIRES_INSTALL += ['aiojobs>=1.0.*']

REQUIRES_FAKEREDIS = ['fakeredis[lua]>=1.8.*']
Expand Down
2 changes: 1 addition & 1 deletion tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import uuid

import aiojobs
import aioredis
import redis.asyncio as aioredis
import fastapi
import pytest
import starlette.testclient
Expand Down

0 comments on commit c4e8d94

Please sign in to comment.