From b8a05038112e92dbdb59fc01fe78b20426eed449 Mon Sep 17 00:00:00 2001 From: Vladyslav Vildanov <117659936+vladvildanov@users.noreply.github.com> Date: Thu, 13 Feb 2025 10:20:36 +0200 Subject: [PATCH 1/6] maintenance: Adding Python 3.13 compatibility (#3510) --- .github/workflows/integration.yaml | 10 +++++----- dev_requirements.txt | 2 +- setup.py | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index c4548c21ef..4467de4f62 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -75,7 +75,7 @@ jobs: fail-fast: false matrix: redis-version: ['8.0-M04-pre', '${{ needs.redis_version.outputs.CURRENT }}', '7.2.7', '6.2.17'] - python-version: ['3.8', '3.12'] + python-version: ['3.8', '3.13'] parser-backend: ['plain'] event-loop: ['asyncio'] env: @@ -99,7 +99,7 @@ jobs: fail-fast: false matrix: redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ] - python-version: ['3.9', '3.10', '3.11', 'pypy-3.9', 'pypy-3.10'] + python-version: ['3.9', '3.10', '3.11', '3.12', 'pypy-3.9', 'pypy-3.10'] parser-backend: [ 'plain' ] event-loop: [ 'asyncio' ] env: @@ -123,7 +123,7 @@ jobs: fail-fast: false matrix: redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ] - python-version: [ '3.8', '3.12'] + python-version: [ '3.8', '3.13'] parser-backend: [ 'hiredis' ] hiredis-version: [ '>=3.0.0', '<3.0.0' ] event-loop: [ 'asyncio' ] @@ -149,7 +149,7 @@ jobs: fail-fast: false matrix: redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ] - python-version: [ '3.8', '3.12' ] + python-version: [ '3.8', '3.13' ] parser-backend: [ 'plain' ] event-loop: [ 'uvloop' ] env: @@ -192,7 +192,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9', 'pypy-3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10'] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/dev_requirements.txt b/dev_requirements.txt index 728536d6fb..619fbf479c 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -9,7 +9,7 @@ packaging>=20.4 pytest pytest-asyncio>=0.23.0,<0.24.0 pytest-cov -pytest-profiling==1.7.0 +pytest-profiling==1.8.1 pytest-timeout ujson>=4.2.0 uvloop diff --git a/setup.py b/setup.py index 02853251b2..74f6fdafb7 100644 --- a/setup.py +++ b/setup.py @@ -54,6 +54,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ], From e1b81638579fb51f2b04a63abc73f0d9b945ccee Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 13 Feb 2025 10:37:27 +0100 Subject: [PATCH 2/6] Fix Incorrect markdown formatting for example in connection_examples.ipynb (#3504) Co-authored-by: Vladyslav Vildanov <117659936+vladvildanov@users.noreply.github.com> Co-authored-by: petyaslavova --- docs/examples/connection_examples.ipynb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/examples/connection_examples.ipynb b/docs/examples/connection_examples.ipynb index fd60e2a495..05c2c82081 100644 --- a/docs/examples/connection_examples.ipynb +++ b/docs/examples/connection_examples.ipynb @@ -75,13 +75,26 @@ ] }, { - "cell_type": "markdown", + "cell_type": "code", + "execution_count": 4, "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import redis\n", "\n", "r = redis.Redis(protocol=3)\n", - "rcon.ping()" + "r.ping()" ] }, { @@ -93,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -102,7 +115,7 @@ "True" ] }, - "execution_count": 4, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } From 7ddb74734a0e083298c2ed7bdfe62359c83a45d0 Mon Sep 17 00:00:00 2001 From: petyaslavova Date: Thu, 13 Feb 2025 12:40:53 +0200 Subject: [PATCH 3/6] Adding unit test for core info command related to modules info (#3507) --- tests/test_commands.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_commands.py b/tests/test_commands.py index 24c320a3f3..f89c5f3365 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1066,6 +1066,21 @@ def test_info_multi_sections(self, r): assert "redis_version" in res assert "connected_clients" in res + @pytest.mark.redismod + @skip_if_server_version_lt("7.9.0") + def test_info_with_modules(self, r: redis.Redis): + res = r.info(section="everything") + assert "modules" in res + assert "search_number_of_indexes" in res + + res = r.info(section="modules") + assert "modules" in res + assert "search_number_of_indexes" in res + + res = r.info(section="search") + assert "modules" not in res + assert "search_number_of_indexes" in res + @pytest.mark.onlynoncluster @skip_if_redis_enterprise() def test_lastsave(self, r): From db74c1ac3a7c874df8e16e164b6af1d2a6400925 Mon Sep 17 00:00:00 2001 From: petyaslavova Date: Thu, 13 Feb 2025 14:45:40 +0200 Subject: [PATCH 4/6] Replacing the redis and redis-stack-server images with redis-libs-tests image in test infrastructure (#3505) * Replacing the redis image with redis-libs-tests image in test infrastructure * Replacing redis-stack-server image usage with client-libs-test. Fixing lib version in setup.py * Defining stack tag variable for the build and test github action * Removing unused env var from build and test github actions --- .github/actions/run-tests/action.yml | 15 ++---- .github/workflows/integration.yaml | 8 ++-- .gitignore | 3 ++ docker-compose.yml | 70 ++++++++++++---------------- setup.py | 2 +- 5 files changed, 43 insertions(+), 55 deletions(-) diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index 1f9332fb86..ca775f5a5b 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -31,14 +31,9 @@ runs: - name: Setup Test environment env: REDIS_VERSION: ${{ inputs.redis-version }} - REDIS_IMAGE: "redis:${{ inputs.redis-version }}" - CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ inputs.redis-version }}" + CLIENT_LIBS_TEST_IMAGE_TAG: ${{ inputs.redis-version }} run: | set -e - - if [ "${{inputs.redis-version}}" == "8.0-M04-pre" ]; then - export REDIS_IMAGE=redis:8.0-M03 - fi echo "::group::Installing dependencies" pip install -U setuptools wheel @@ -60,13 +55,13 @@ runs: # Mapping of redis version to stack version declare -A redis_stack_version_mapping=( - ["7.4.2"]="7.4.0-v2" - ["7.2.7"]="7.2.0-v14" - ["6.2.17"]="6.2.6-v18" + ["7.4.2"]="rs-7.4.0-v2" + ["7.2.7"]="rs-7.2.0-v14" + ["6.2.17"]="rs-6.2.6-v18" ) if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then - export REDIS_STACK_IMAGE="redis/redis-stack-server:${redis_stack_version_mapping[$REDIS_VERSION]}" + export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=${redis_stack_version_mapping[$REDIS_VERSION]} echo "REDIS_MOD_URL=redis://127.0.0.1:6479/0" >> $GITHUB_ENV else echo "Version not found in the mapping." diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 4467de4f62..45e0d5bf8e 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -27,8 +27,7 @@ env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665 COVERAGE_CORE: sysmon - REDIS_IMAGE: redis:latest - REDIS_STACK_IMAGE: redis/redis-stack-server:latest + CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: 'rs-7.4.0-v2' CURRENT_REDIS_VERSION: '7.4.2' jobs: @@ -180,9 +179,8 @@ jobs: python-version: 3.9 - name: Run installed unit tests env: - REDIS_VERSION: ${{ env.CURRENT_REDIS_VERSION }} - REDIS_IMAGE: "redis:${{ env.CURRENT_REDIS_VERSION }}" - CLIENT_LIBS_TEST_IMAGE: "redislabs/client-libs-test:${{ env.CURRENT_REDIS_VERSION }}" + CLIENT_LIBS_TEST_IMAGE_TAG: ${{ env.CURRENT_REDIS_VERSION }} + CLIENT_LIBS_TEST_STACK_IMAGE_TAG: ${{ env.CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG }} run: | bash .github/workflows/install_and_test.sh ${{ matrix.extension }} diff --git a/.gitignore b/.gitignore index ee1bda0fa5..5f77dcfde4 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,6 @@ docker/stunnel/keys /dockers/*/tls/* /dockers/standalone/ /dockers/cluster/ +/dockers/replica/ +/dockers/sentinel/ +/dockers/redis-stack/ diff --git a/docker-compose.yml b/docker-compose.yml index 60657d5653..8ca3471311 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,14 @@ --- +x-client-libs-stack-image: &client-libs-stack-image + image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_STACK_IMAGE_TAG:-rs-7.4.0-v2}" + +x-client-libs-image: &client-libs-image + image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_IMAGE_TAG:-7.4.2}" services: redis: - image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:7.4.1} + <<: *client-libs-image container_name: redis-standalone environment: - TLS_ENABLED=yes @@ -24,20 +29,26 @@ services: - all replica: - image: ${REDIS_IMAGE:-redis:7.4.1} + <<: *client-libs-image container_name: redis-replica depends_on: - redis - command: redis-server --replicaof redis 6379 --protected-mode no --save "" + environment: + - TLS_ENABLED=no + - REDIS_CLUSTER=no + - PORT=6380 + command: ${REDIS_EXTRA_ARGS:---enable-debug-command yes --replicaof redis 6379 --protected-mode no --save ""} ports: - - 6380:6379 + - 6380:6380 + volumes: + - "./dockers/replica:/redis/work" profiles: - replica - all-stack - all cluster: - image: ${CLIENT_LIBS_TEST_IMAGE:-redislabs/client-libs-test:7.4.1} + <<: *client-libs-image container_name: redis-cluster environment: - REDIS_CLUSTER=yes @@ -58,57 +69,38 @@ services: - all sentinel: - image: ${REDIS_IMAGE:-redis:7.4.1} + <<: *client-libs-image container_name: redis-sentinel depends_on: - redis - entrypoint: "redis-sentinel /redis.conf --port 26379" + environment: + - REDIS_CLUSTER=no + - NODES=3 + - PORT=26379 + command: ${REDIS_EXTRA_ARGS:---sentinel} ports: - 26379:26379 - volumes: - - "./dockers/sentinel.conf:/redis.conf" - profiles: - - sentinel - - all-stack - - all - - sentinel2: - image: ${REDIS_IMAGE:-redis:7.4.1} - container_name: redis-sentinel2 - depends_on: - - redis - entrypoint: "redis-sentinel /redis.conf --port 26380" - ports: - 26380:26380 - volumes: - - "./dockers/sentinel.conf:/redis.conf" - profiles: - - sentinel - - all-stack - - all - - sentinel3: - image: ${REDIS_IMAGE:-redis:7.4.1} - container_name: redis-sentinel3 - depends_on: - - redis - entrypoint: "redis-sentinel /redis.conf --port 26381" - ports: - 26381:26381 volumes: - - "./dockers/sentinel.conf:/redis.conf" + - "./dockers/sentinel.conf:/redis/config-default/redis.conf" + - "./dockers/sentinel:/redis/work" profiles: - sentinel - all-stack - all redis-stack: - image: ${REDIS_STACK_IMAGE:-redis/redis-stack-server:latest} + <<: *client-libs-stack-image container_name: redis-stack + environment: + - REDIS_CLUSTER=no + - PORT=6379 + command: ${REDIS_EXTRA_ARGS:---enable-debug-command yes --enable-module-command yes --save ""} ports: - 6479:6379 - environment: - - "REDIS_ARGS=${REDIS_STACK_EXTRA_ARGS:---enable-debug-command yes --enable-module-command yes --save ''}" + volumes: + - "./dockers/redis-stack:/redis/work" profiles: - standalone - all-stack diff --git a/setup.py b/setup.py index 74f6fdafb7..2cde3fb51b 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ long_description_content_type="text/markdown", keywords=["Redis", "key-value store", "database"], license="MIT", - version="5.1.1", + version="5.2.1", packages=find_packages( include=[ "redis", From 8b53a9db84861251129cf48d68b926677777b8a5 Mon Sep 17 00:00:00 2001 From: Max Base Date: Thu, 13 Feb 2025 15:12:22 +0100 Subject: [PATCH 5/6] Fix formatting in README.md - 'Note' - bold formatting (#3413) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 98ddee5b52..8b4d4b6875 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The Python interface to the Redis key-value store. --------------------------------------------- -**Note: ** redis-py 5.0 will be the last version of redis-py to support Python 3.7, as it has reached [end of life](https://devguide.python.org/versions/). redis-py 5.1 will support Python 3.8+. +**Note:** redis-py 5.0 will be the last version of redis-py to support Python 3.7, as it has reached [end of life](https://devguide.python.org/versions/). redis-py 5.1 will support Python 3.8+. --------------------------------------------- From 746653a676cdade214a8fa7f433f930202805bf2 Mon Sep 17 00:00:00 2001 From: petyaslavova Date: Thu, 13 Feb 2025 17:06:18 +0200 Subject: [PATCH 6/6] Adding dev_requirements.txt and pytest.ini resources into sdist. Fix for issue #3057 (#3511) --- MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index 97fa305889..80afb437ff 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,8 @@ include INSTALL include LICENSE include README.md +include dev_requirements.txt +include pytest.ini exclude __pycache__ recursive-include tests * recursive-exclude tests *.pyc