Skip to content

Commit

Permalink
Add Async Support (#1899)
Browse files Browse the repository at this point in the history
Co-authored-by: Chayim I. Kirshen <c@kirshen.com>
Co-authored-by: dvora-h <dvora.heller@redis.com>
  • Loading branch information
3 people authored Feb 22, 2022
1 parent e3c989d commit d56baeb
Show file tree
Hide file tree
Showing 43 changed files with 8,773 additions and 638 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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.6','3.7', '3.8', '3.9', '3.10', 'pypy-3.7']
test-type: ['standalone', 'cluster']
connection-type: ['hiredis', 'plain']
env:
Expand All @@ -50,6 +50,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: run tests
run: |
pip install -U setuptools wheel
pip install -r dev_requirements.txt
tox -e ${{matrix.test-type}}-${{matrix.connection-type}}
- name: Upload codecov coverage
Expand Down Expand Up @@ -79,7 +80,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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vagrant/.vagrant
env
venv
coverage.xml
.venv
.venv*
*.xml
.coverage*
docker/stunnel/keys
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
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ You can see the logging output of a containers like this:
`$ docker logs -f <service>`

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

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

Here, the flag `-e py36` runs tests against the Python 3.6 tox
Here, the flag `-e py39` runs tests against the Python 3.9 tox
environment. And note from the example that whenever you run tests like
this, instead of using make test, you need to pass
`-- --redis-url=redis://master:6379/9`. This points the tests at the
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ The Python interface to the Redis key-value store.

---------------------------------------------

## Python Notice

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.

---------------------------

## Installation

Expand Down Expand Up @@ -51,7 +56,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,12 +2,15 @@ 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.16.0
tox==3.24.4
tox-docker==3.1.0
invoke==1.6.0
pytest-cov>=3.0.0
vulture>=2.3.0
ujson>=4.2.0
wheel>=0.30.0
uvloop
12 changes: 11 additions & 1 deletion docs/connections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,14 @@ Connection Pools
.. autoclass:: redis.connection.ConnectionPool
:members:

More connection examples can be found `here <examples/connection_examples.html>`_.
More connection examples can be found `here <examples/connection_examples.html>`_.

Async Client
************

This client is used for communicating with Redis, asynchronously.

.. autoclass:: redis.asyncio.connection.Connection
:members:

More connection examples can be found `here <examples/asyncio_examples.html>`_
1 change: 1 addition & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ Examples

examples/connection_examples
examples/ssl_connection_examples
examples/asyncio_examples
examples/search_json_examples
examples/set_and_get_examples
Loading

0 comments on commit d56baeb

Please sign in to comment.