Skip to content

Commit d56baeb

Browse files
Andrew-Chen-Wangchayimdvora-h
authored
Add Async Support (#1899)
Co-authored-by: Chayim I. Kirshen <[email protected]> Co-authored-by: dvora-h <[email protected]>
1 parent e3c989d commit d56baeb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+8773
-638
lines changed

.github/workflows/integration.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
strategy:
3737
max-parallel: 15
3838
matrix:
39-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
39+
python-version: ['3.6','3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
4040
test-type: ['standalone', 'cluster']
4141
connection-type: ['hiredis', 'plain']
4242
env:
@@ -50,6 +50,7 @@ jobs:
5050
python-version: ${{ matrix.python-version }}
5151
- name: run tests
5252
run: |
53+
pip install -U setuptools wheel
5354
pip install -r dev_requirements.txt
5455
tox -e ${{matrix.test-type}}-${{matrix.connection-type}}
5556
- name: Upload codecov coverage
@@ -79,7 +80,7 @@ jobs:
7980
runs-on: ubuntu-latest
8081
strategy:
8182
matrix:
82-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
83+
python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
8384
steps:
8485
- uses: actions/checkout@v2
8586
- name: install python ${{ matrix.python-version }}

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ vagrant/.vagrant
1414
env
1515
venv
1616
coverage.xml
17-
.venv
17+
.venv*
1818
*.xml
1919
.coverage*
2020
docker/stunnel/keys

.mypy.ini

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[mypy]
2+
#, docs/examples, tests
3+
files = redis
4+
check_untyped_defs = True
5+
follow_imports_for_stubs asyncio.= True
6+
#disallow_any_decorated = True
7+
disallow_subclassing_any = True
8+
#disallow_untyped_calls = True
9+
disallow_untyped_decorators = True
10+
#disallow_untyped_defs = True
11+
implicit_reexport = False
12+
no_implicit_optional = True
13+
show_error_codes = True
14+
strict_equality = True
15+
warn_incomplete_stub = True
16+
warn_redundant_casts = True
17+
warn_unreachable = True
18+
warn_unused_ignores = True
19+
disallow_any_unimported = True
20+
#warn_return_any = True
21+
22+
[mypy-redis.asyncio.lock]
23+
# TODO: Remove once locks has been rewritten
24+
ignore_errors = True

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ You can see the logging output of a containers like this:
112112
`$ docker logs -f <service>`
113113

114114
The command make test runs all tests in all tested Python
115-
environments. To run the tests in a single environment, like Python 3.6,
115+
environments. To run the tests in a single environment, like Python 3.9,
116116
use a command like this:
117117

118-
`$ docker-compose run test tox -e py36 -- --redis-url=redis://master:6379/9`
118+
`$ docker-compose run test tox -e py39 -- --redis-url=redis://master:6379/9`
119119

120-
Here, the flag `-e py36` runs tests against the Python 3.6 tox
120+
Here, the flag `-e py39` runs tests against the Python 3.9 tox
121121
environment. And note from the example that whenever you run tests like
122122
this, instead of using make test, you need to pass
123123
`-- --redis-url=redis://master:6379/9`. This points the tests at the

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ The Python interface to the Redis key-value store.
1313

1414
---------------------------------------------
1515

16+
## Python Notice
17+
18+
redis-py 4.2.x will be the last generation of redis-py to support python 3.6 as it has been [End of Life'd](https://www.python.org/dev/peps/pep-0494/#schedule-last-security-only-release). Async support was introduced in redis-py 4.2.x thanks to [aioredis](https://github.com/aio-libs/aioredis-py), which necessitates this change. We will continue to maintain 3.6 support as long as possible - but the plan is for redis-py version 5+ to offically remove 3.6.
19+
20+
---------------------------
1621

1722
## Installation
1823

@@ -51,7 +56,7 @@ contributing](https://github.com/redis/redis-py/blob/master/CONTRIBUTING.md).
5156

5257
## Getting Started
5358

54-
redis-py supports Python 3.6+.
59+
redis-py supports Python 3.7+.
5560

5661
``` pycon
5762
>>> import redis

dev_requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ black==21.11b1
22
flake8==4.0.1
33
flynt~=0.69.0
44
isort==5.10.1
5+
mock==4.0.3
56
pytest==6.2.5
67
pytest-timeout==2.0.1
8+
pytest-asyncio>=0.16.0
79
tox==3.24.4
810
tox-docker==3.1.0
911
invoke==1.6.0
1012
pytest-cov>=3.0.0
1113
vulture>=2.3.0
1214
ujson>=4.2.0
1315
wheel>=0.30.0
16+
uvloop

docs/connections.rst

+11-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,14 @@ Connection Pools
4242
.. autoclass:: redis.connection.ConnectionPool
4343
:members:
4444

45-
More connection examples can be found `here <examples/connection_examples.html>`_.
45+
More connection examples can be found `here <examples/connection_examples.html>`_.
46+
47+
Async Client
48+
************
49+
50+
This client is used for communicating with Redis, asynchronously.
51+
52+
.. autoclass:: redis.asyncio.connection.Connection
53+
:members:
54+
55+
More connection examples can be found `here <examples/asyncio_examples.html>`_

docs/examples.rst

+1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ Examples
77

88
examples/connection_examples
99
examples/ssl_connection_examples
10+
examples/asyncio_examples
1011
examples/search_json_examples
1112
examples/set_and_get_examples

0 commit comments

Comments
 (0)