diff --git a/docs/main/changelog.rst b/docs/main/changelog.rst index ebe593b8..eb6214ac 100644 --- a/docs/main/changelog.rst +++ b/docs/main/changelog.rst @@ -14,6 +14,7 @@ Development version - Update CI/CD to ``actions/checkout@v3``, ``actions/setup-python@v4``, ``actions/upload-artifact@v3``, ``pypa/cibuildwheel@v2.11.3``, and ``actions/download-artifact@v3``. - Fix install crash on non-utf8 systems `#644 `_. +- Update FastAPI Redis example to use ``aioredis`` version 2 `#613 `_. - Regenerate C sources using Cython 0.29.32. 4.40.0 diff --git a/examples/miniapps/fastapi-redis/Dockerfile b/examples/miniapps/fastapi-redis/Dockerfile index 932c3d6c..8b7ce3bc 100644 --- a/examples/miniapps/fastapi-redis/Dockerfile +++ b/examples/miniapps/fastapi-redis/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-buster +FROM python:3.10-buster ENV PYTHONUNBUFFERED=1 diff --git a/examples/miniapps/fastapi-redis/README.rst b/examples/miniapps/fastapi-redis/README.rst index 931cfbed..1ef75b31 100644 --- a/examples/miniapps/fastapi-redis/README.rst +++ b/examples/miniapps/fastapi-redis/README.rst @@ -24,35 +24,26 @@ The output should be something like: .. code-block:: - redis_1 | 1:C 04 Jan 2022 02:42:14.115 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo - redis_1 | 1:C 04 Jan 2022 02:42:14.115 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=1, just started - redis_1 | 1:C 04 Jan 2022 02:42:14.115 # Configuration loaded - redis_1 | 1:M 04 Jan 2022 02:42:14.116 * Running mode=standalone, port=6379. - redis_1 | 1:M 04 Jan 2022 02:42:14.116 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. - redis_1 | 1:M 04 Jan 2022 02:42:14.116 # Server initialized - redis_1 | 1:M 04 Jan 2022 02:42:14.117 * Loading RDB produced by version 6.0.9 - redis_1 | 1:M 04 Jan 2022 02:42:14.117 * RDB age 1 seconds - redis_1 | 1:M 04 Jan 2022 02:42:14.117 * RDB memory usage when created 0.77 Mb - redis_1 | 1:M 04 Jan 2022 02:42:14.117 * DB loaded from disk: 0.000 seconds - redis_1 | 1:M 04 Jan 2022 02:42:14.117 * Ready to accept connections - redis_1 | 1:signal-handler (1609728137) Received SIGTERM scheduling shutdown... - redis_1 | 1:M 04 Jan 2022 02:42:17.984 # User requested shutdown... - redis_1 | 1:M 04 Jan 2022 02:42:17.984 # Redis is now ready to exit, bye bye... - redis_1 | 1:C 04 Jan 2022 02:42:22.035 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo - redis_1 | 1:C 04 Jan 2022 02:42:22.035 # Redis version=6.0.9, bits=64, commit=00000000, modified=0, pid=1, just started - redis_1 | 1:C 04 Jan 2022 02:42:22.035 # Configuration loaded - redis_1 | 1:M 04 Jan 2022 02:42:22.037 * Running mode=standalone, port=6379. - redis_1 | 1:M 04 Jan 2022 02:42:22.037 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. - redis_1 | 1:M 04 Jan 2022 02:42:22.037 # Server initialized - redis_1 | 1:M 04 Jan 2022 02:42:22.037 * Loading RDB produced by version 6.0.9 - redis_1 | 1:M 04 Jan 2022 02:42:22.037 * RDB age 9 seconds - redis_1 | 1:M 04 Jan 2022 02:42:22.037 * RDB memory usage when created 0.77 Mb - redis_1 | 1:M 04 Jan 2022 02:42:22.037 * DB loaded from disk: 0.000 seconds - redis_1 | 1:M 04 Jan 2022 02:42:22.037 * Ready to accept connections - example_1 | INFO: Started server process [1] - example_1 | INFO: Waiting for application startup. - example_1 | INFO: Application startup complete. - example_1 | INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) + fastapi-redis-redis-1 | 1:C 19 Dec 2022 02:33:02.484 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo + fastapi-redis-redis-1 | 1:C 19 Dec 2022 02:33:02.484 # Redis version=7.0.5, bits=64, commit=00000000, modified=0, pid=1, just started + fastapi-redis-redis-1 | 1:C 19 Dec 2022 02:33:02.484 # Configuration loaded + fastapi-redis-redis-1 | 1:M 19 Dec 2022 02:33:02.485 * monotonic clock: POSIX clock_gettime + fastapi-redis-redis-1 | 1:M 19 Dec 2022 02:33:02.485 * Running mode=standalone, port=6379. + fastapi-redis-redis-1 | 1:M 19 Dec 2022 02:33:02.485 # Server initialized + fastapi-redis-redis-1 | 1:M 19 Dec 2022 02:33:02.487 * Loading RDB produced by version 7.0.5 + fastapi-redis-redis-1 | 1:M 19 Dec 2022 02:33:02.487 * RDB age 58 seconds + fastapi-redis-redis-1 | 1:M 19 Dec 2022 02:33:02.487 * RDB memory usage when created 0.85 Mb + fastapi-redis-redis-1 | 1:M 19 Dec 2022 02:33:02.487 * Done loading RDB, keys loaded: 0, keys expired: 0. + fastapi-redis-redis-1 | 1:M 19 Dec 2022 02:33:02.487 * DB loaded from disk: 0.000 seconds + fastapi-redis-redis-1 | 1:M 19 Dec 2022 02:33:02.488 * Ready to accept connections + fastapi-redis-example-1 | INFO: Started server process [1] + fastapi-redis-example-1 | INFO: Waiting for application startup. + fastapi-redis-example-1 | INFO: Application startup complete. + fastapi-redis-example-1 | INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) + fastapi-redis-example-1 | INFO: 172.18.0.1:63998 - "GET / HTTP/1.1" 200 OK + fastapi-redis-example-1 | INFO: 172.18.0.1:63998 - "GET /favicon.ico HTTP/1.1" 404 Not Found + fastapi-redis-example-1 | INFO: 172.18.0.1:63998 - "GET / HTTP/1.1" 200 OK + fastapi-redis-example-1 | INFO: 172.18.0.1:63998 - "GET / HTTP/1.1" 200 OK Test ---- @@ -69,9 +60,9 @@ The output should be something like: .. code-block:: - platform linux -- Python 3.9, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 + platform linux -- Python 3.10.9, pytest-7.2.0, pluggy-1.0.0 rootdir: /code - plugins: cov-2.10.1, asyncio-0.14.0 + plugins: cov-4.0.0, asyncio-0.20.3 collected 1 item fastapiredis/tests.py . [100%] @@ -80,10 +71,10 @@ The output should be something like: Name Stmts Miss Cover ------------------------------------------------- fastapiredis/__init__.py 0 0 100% - fastapiredis/application.py 15 0 100% + fastapiredis/application.py 14 0 100% fastapiredis/containers.py 6 0 100% fastapiredis/redis.py 7 4 43% fastapiredis/services.py 7 3 57% fastapiredis/tests.py 18 0 100% ------------------------------------------------- - TOTAL 53 7 87% + TOTAL 52 7 87% \ No newline at end of file diff --git a/examples/miniapps/fastapi-redis/requirements.txt b/examples/miniapps/fastapi-redis/requirements.txt index 9a144a8d..c217324a 100644 --- a/examples/miniapps/fastapi-redis/requirements.txt +++ b/examples/miniapps/fastapi-redis/requirements.txt @@ -1,7 +1,7 @@ dependency-injector fastapi uvicorn -aioredis<2 # TODO: Update example to work with aioredis >= 2.0 +aioredis # For testing: pytest