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

Add Async Support #1899

Merged
merged 28 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4d1cfc5
Initial aioredis import
Andrew-Chen-Wang Jan 24, 2022
76cccc9
Add asyncio test suite and remove Py3.6 support
Andrew-Chen-Wang Jan 25, 2022
6e629ad
Lint
Andrew-Chen-Wang Jan 25, 2022
b90d7d9
Abstract Redis and fix CI
Andrew-Chen-Wang Jan 25, 2022
3080960
moved async-timeout to package requirements
chayim Jan 27, 2022
833e385
Merge branch 'master' into async
dvora-h Feb 9, 2022
66a0efd
PR discussion, test removal
chayim Feb 10, 2022
ba541e7
Mark tests as onlynoncluster
dvora-h Feb 10, 2022
6690caf
fixing linters
chayim Feb 10, 2022
c8d7a22
Merge branch 'async' of github.com:Andrew-Chen-Wang/redis-py into async
dvora-h Feb 10, 2022
cdf7ce8
Fix asyncio SentinelCommands
Andrew-Chen-Wang Feb 12, 2022
90e129c
Add aio-libs/aioredis-py#1256 & aio-libs/aioredis-py#1284
Andrew-Chen-Wang Feb 12, 2022
5639363
Add asyncio example to docs
Andrew-Chen-Wang Feb 12, 2022
63f9430
Merge branch 'master' into async
Andrew-Chen-Wang Feb 12, 2022
c2f0af4
Drop Python 3.6 from tox
Andrew-Chen-Wang Feb 13, 2022
d1abb6c
black, to python 3.6
chayim Feb 15, 2022
a4d791f
python 3.6
chayim Feb 15, 2022
e49f9e7
requirements
chayim Feb 15, 2022
b50b265
uvloop
chayim Feb 15, 2022
0a2713b
3.6 trove
chayim Feb 15, 2022
ba024cb
Add back Python 3.6 support
Andrew-Chen-Wang Feb 15, 2022
8640954
Add support to Python 3.6 in setup.py
Andrew-Chen-Wang Feb 15, 2022
f8a119c
python 3.6 fixes
chayim Feb 17, 2022
c81f3a2
Merge branch 'master' into async
dvora-h Feb 17, 2022
f1c60c9
standalone fix
chayim Feb 17, 2022
f4c062b
fixing 3.6 tests, and cluster tests
chayim Feb 22, 2022
f4a6955
vulture whitelist
chayim Feb 22, 2022
d688f55
linter: black
chayim Feb 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
strategy:
max-parallel: 15
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
test-type: ['standalone', 'cluster']
connection-type: ['hiredis', 'plain']
env:
Expand All @@ -48,6 +48,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: run tests
run: |
pip install -U setuptools wheel
pip install -r dev_requirements.txt
bash docker/stunnel/create_certs.sh
tox -e ${{matrix.test-type}}-${{matrix.connection-type}}
Expand Down Expand Up @@ -78,7 +79,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
steps:
- uses: actions/checkout@v2
- name: install python ${{ matrix.python-version }}
Expand Down
24 changes: 24 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[mypy]
#, docs/examples, tests
files = redis
check_untyped_defs = True
follow_imports_for_stubs asyncio.= True
#disallow_any_decorated = True
disallow_subclassing_any = True
#disallow_untyped_calls = True
disallow_untyped_decorators = True
#disallow_untyped_defs = True
implicit_reexport = False
no_implicit_optional = True
show_error_codes = True
strict_equality = True
warn_incomplete_stub = True
warn_redundant_casts = True
warn_unreachable = True
warn_unused_ignores = True
disallow_any_unimported = True
#warn_return_any = True

[mypy-redis.asyncio.lock]
# TODO: Remove once locks has been rewritten
ignore_errors = True
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ contributing](https://github.com/redis/redis-py/blob/master/CONTRIBUTING.md).

## Getting Started

redis-py supports Python 3.6+.
redis-py supports Python 3.7+.

``` pycon
>>> import redis
Expand Down
3 changes: 3 additions & 0 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ black==21.11b1
flake8==4.0.1
flynt~=0.69.0
isort==5.10.1
mock==4.0.3
pytest==6.2.5
pytest-timeout==2.0.1
pytest-asyncio==0.17.2
tox==3.24.4
tox-docker==3.1.0
tox-run-before==0.1
invoke==1.6.0
pytest-cov>=3.0.0
vulture>=2.3.0
ujson>=4.2.0
uvloop>=0.16.0
wheel>=0.30.0
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Welcome to redis-py's documentation!
Getting Started
****************

`redis-py <https://pypi.org/project/redis>`_ requires a running Redis server, and Python 3.6+. See the `Redis
`redis-py <https://pypi.org/project/redis>`_ requires a running Redis server, and Python 3.7+. See the `Redis
quickstart <https://redis.io/topics/quickstart>`_ for Redis installation instructions.

redis-py can be installed using pip via ``pip install redis``.
Expand Down
10 changes: 5 additions & 5 deletions redis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import sys

if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata

from redis.client import Redis, StrictRedis
from redis.cluster import RedisCluster
from redis.connection import (
Expand Down Expand Up @@ -37,6 +32,11 @@
)
from redis.utils import from_url

if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata


def int_or_str(value):
try:
Expand Down
58 changes: 58 additions & 0 deletions redis/asyncio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from redis.asyncio.client import Redis, StrictRedis
from redis.asyncio.connection import (
BlockingConnectionPool,
Connection,
ConnectionPool,
SSLConnection,
UnixDomainSocketConnection,
)
from redis.asyncio.sentinel import (
Sentinel,
SentinelConnectionPool,
SentinelManagedConnection,
SentinelManagedSSLConnection,
)
from redis.asyncio.utils import from_url
from redis.exceptions import (
AuthenticationError,
AuthenticationWrongNumberOfArgsError,
BusyLoadingError,
ChildDeadlockedError,
ConnectionError,
DataError,
InvalidResponse,
PubSubError,
ReadOnlyError,
RedisError,
ResponseError,
TimeoutError,
WatchError,
)

__all__ = [
"AuthenticationError",
"AuthenticationWrongNumberOfArgsError",
"BlockingConnectionPool",
"BusyLoadingError",
"ChildDeadlockedError",
"Connection",
"ConnectionError",
"ConnectionPool",
"DataError",
"from_url",
"InvalidResponse",
"PubSubError",
"ReadOnlyError",
"Redis",
"RedisError",
"ResponseError",
"Sentinel",
"SentinelConnectionPool",
"SentinelManagedConnection",
"SentinelManagedSSLConnection",
"SSLConnection",
"StrictRedis",
"TimeoutError",
"UnixDomainSocketConnection",
"WatchError",
]
Loading