Skip to content

Commit

Permalink
Merge branch 'master' into fix/issue-3464-misleading-documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
vladvildanov authored Feb 17, 2025
2 parents beab3c9 + 746653a commit 739841e
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 66 deletions.
15 changes: 5 additions & 10 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -75,7 +74,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:
Expand All @@ -99,7 +98,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:
Expand All @@ -123,7 +122,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' ]
Expand All @@ -149,7 +148,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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -192,7 +190,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
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ docker/stunnel/keys
/dockers/*/tls/*
/dockers/standalone/
/dockers/cluster/
/dockers/replica/
/dockers/sentinel/
/dockers/redis-stack/
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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+.

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

Expand Down
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
70 changes: 31 additions & 39 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
21 changes: 17 additions & 4 deletions docs/examples/connection_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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()"
]
},
{
Expand All @@ -93,7 +106,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand All @@ -102,7 +115,7 @@
"True"
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
],
Expand Down
15 changes: 15 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 739841e

Please sign in to comment.