Skip to content

Commit

Permalink
Deps: replace aioredis with redis-py (#1177)
Browse files Browse the repository at this point in the history
  • Loading branch information
masipcat authored Oct 4, 2022
1 parent 64e7b6e commit e2f21a3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
CHANGELOG
=========

6.4.3 (unreleased)
6.5.0 (unreleased)
------------------

- Nothing changed yet.
- Deps: replace aioredis with redis-py
- Deps: updated flake8 so it won't depend on 'importlib-metadata<5'
[masipcat]


6.4.2 (2022-08-25)
Expand Down
4 changes: 2 additions & 2 deletions contrib-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
aioredis==2.0.0
redis==4.3.4
html2text==2019.8.11
aiosmtplib==1.1.4
pre-commit==1.18.2
flake8==3.9.2
flake8==5.0.4
codecov==2.0.15
mypy-zope==0.3.2
black==22.3.0
Expand Down
4 changes: 2 additions & 2 deletions docs/source/contrib/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ applications:
This option is not recommended as they are not invalidating the memory objects.
Its needed to add `aioredis` as a dependency on your project
Its needed to add `redis` as a dependency on your project

### Configuration

Expand All @@ -37,7 +37,7 @@ cache:

This option is the recommended one for more than one process running guillotina on the same DB.

Its needed to add `aioredis` as a dependency on your project
Its needed to add `redis` as a dependency on your project

### Configuration

Expand Down
4 changes: 2 additions & 2 deletions guillotina/contrib/catalog/pg/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def idx_name(self) -> str:
def get_index_sql(self, storage: IPostgresStorage) -> typing.List[str]:
return [
f"""CREATE INDEX CONCURRENTLY IF NOT EXISTS {sqlq(self.idx_name)}_{sqlq(storage.objects_table_name.replace('.', '_'))}
ON {sqlq(storage.objects_table_name)} ((json->>'{sqlq(self.name)}'));""",
ON {sqlq(storage.objects_table_name)} ((json->>'{sqlq(self.name)}'));""", # noqa: E501
f"""CREATE INDEX CONCURRENTLY IF NOT EXISTS {sqlq(self.idx_name)}_{sqlq(storage.objects_table_name.replace('.', '_'))}
ON {sqlq(storage.objects_table_name)} USING gin ((json->'{sqlq(self.name)}'))""",
ON {sqlq(storage.objects_table_name)} USING gin ((json->'{sqlq(self.name)}'))""", # noqa: E501
]

def where(self, value, operator="=") -> str:
Expand Down
8 changes: 4 additions & 4 deletions guillotina/contrib/redis/driver.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
try:
import aioredis
import redis.asyncio as aioredis
except ImportError:
print("If you add guillotina.contrib.redis you need to add aioredis on your requirements")
print("If you add guillotina.contrib.redis you need to add redis>4.2.0rc1 on your requirements")
raise

from aioredis.client import PubSub
from aioredis.exceptions import ConnectionError
from guillotina import app_settings
from guillotina import metrics
from guillotina.contrib.redis.exceptions import NoRedisConfigured
from redis.asyncio.client import PubSub
from redis.exceptions import ConnectionError
from typing import Dict
from typing import List
from typing import Optional
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ types-python-dateutil==0.1.6
types-pytz==2021.1.2
types-PyYAML==5.4.6
types-setuptools==57.0.2
types-toml==0.1.5
types-toml==0.1.5
types-redis==4.3.21
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
'aiohttp>=3.0.0,<3.6.0;python_version<"3.8"',
'aiohttp>=3.6.0,<4.0.0;python_version>="3.8"',
],
"redis": ['aioredis==2.0.0'],
"redis": ['redis>=4.3.0'],
"mailer": ["html2text>=2018.1.9", "aiosmtplib>=1.0.6"],
"memcached": ["emcache"],
"validation": ["pytz==2020.1"],
Expand Down

0 comments on commit e2f21a3

Please sign in to comment.