From 72283c05ed8b8796f48ce694c0de91e2f24e116b Mon Sep 17 00:00:00 2001 From: Petya Slavova Date: Tue, 13 May 2025 10:40:35 +0300 Subject: [PATCH 1/3] Updating the readme and lib version to contain the changes from the latest stable release --- README.md | 43 +++++++++++++++++++++++++++++++++++++++---- docker-compose.yml | 5 +++-- redis/__init__.py | 2 +- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8b4d4b6875..8d69801990 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Looking for a high-level library to handle object mapping? See [redis-om-python] ## Supported Redis Versions -The most recent version of this library supports redis version [5.0](https://github.com/redis/redis/blob/5.0/00-RELEASENOTES), [6.0](https://github.com/redis/redis/blob/6.0/00-RELEASENOTES), [6.2](https://github.com/redis/redis/blob/6.2/00-RELEASENOTES), [7.0](https://github.com/redis/redis/blob/7.0/00-RELEASENOTES), [7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES) and [7.4](https://github.com/redis/redis/blob/7.4/00-RELEASENOTES). +The most recent version of this library supports redis version [7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES), [7.4](https://github.com/redis/redis/blob/7.4/00-RELEASENOTES) and [8.0](https://github.com/redis/redis/blob/8.0/00-RELEASENOTES). The table below highlights version compatibility of the most-recent library versions and redis versions. @@ -62,7 +62,8 @@ The table below highlights version compatibility of the most-recent library vers |-----------------|-------------------| | 3.5.3 | <= 6.2 Family of releases | | >= 4.5.0 | Version 5.0 to 7.0 | -| >= 5.0.0 | Version 5.0 to current | +| >= 5.0.0 | Version 5.0 to 7.4 | +| >= 6.0.0 | Version 7.2 to current | ## Usage @@ -152,8 +153,42 @@ The following example shows how to utilize [Redis Pub/Sub](https://redis.io/docs {'pattern': None, 'type': 'subscribe', 'channel': b'my-second-channel', 'data': 1} ``` +### Redis’ search and query capabilities default dialect --------------------------- +Release 6.0.0 introduces a client-side default dialect for Redis’ search and query capabilities. +By default, the client now overrides the server-side dialect with version 2, automatically appending *DIALECT 2* to commands like *FT.AGGREGATE* and *FT.SEARCH*. + +**Important**: Be aware that the query dialect may impact the results returned. If needed, you can revert to a different dialect version by configuring the client accordingly. + +``` python +>>> from redis.commands.search.field import TextField +>>> from redis.commands.search.query import Query +>>> from redis.commands.search.index_definition import IndexDefinition +>>> import redis + +>>> r = redis.Redis(host='localhost', port=6379, db=0) +>>> r.ft().create_index( +>>> (TextField("name"), TextField("lastname")), +>>> definition=IndexDefinition(prefix=["test:"]), +>>> ) + +>>> r.hset("test:1", "name", "James") +>>> r.hset("test:1", "lastname", "Brown") + +>>> # Query with default DIALECT 2 +>>> query = "@name: James Brown" +>>> q = Query(query) +>>> res = r.ft().search(q) + +>>> # Query with explicit DIALECT 1 +>>> query = "@name: James Brown" +>>> q = Query(query).dialect(1) +>>> res = r.ft().search(q) +``` + +You can find further details in the [query dialect documentation](https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/). + +--------------------------------------------- ### Author @@ -169,4 +204,4 @@ Special thanks to: system. - Paul Hubbard for initial packaging support. -[![Redis](./docs/_static/logo-redis.svg)](https://redis.io) +[![Redis](./docs/_static/logo-redis.svg)](https://redis.io) \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 76a60398f3..bcf85df1a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,10 @@ --- +# image tag 8.0-RC2-pre is the one matching the 8.0 GA release 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}" + image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_STACK_IMAGE_TAG:-8.0-RC2-pre}" x-client-libs-image: &client-libs-image - image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_IMAGE_TAG:-7.4.2}" + image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_IMAGE_TAG:-8.0-RC2-pre}" services: diff --git a/redis/__init__.py b/redis/__init__.py index 14030205e3..6769ba7506 100644 --- a/redis/__init__.py +++ b/redis/__init__.py @@ -45,7 +45,7 @@ def int_or_str(value): return value -__version__ = "5.2.1" +__version__ = "6.0.0" VERSION = tuple(map(int_or_str, __version__.split("."))) From cbea177bce4588f92a4f908ef2177aa8365678bb Mon Sep 17 00:00:00 2001 From: petyaslavova Date: Tue, 13 May 2025 10:47:28 +0300 Subject: [PATCH 2/3] Update README.md - copilot suggestion. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d69801990..80d9d4b5ca 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Looking for a high-level library to handle object mapping? See [redis-om-python] ## Supported Redis Versions -The most recent version of this library supports redis version [7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES), [7.4](https://github.com/redis/redis/blob/7.4/00-RELEASENOTES) and [8.0](https://github.com/redis/redis/blob/8.0/00-RELEASENOTES). +The most recent version of this library supports Redis version [7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES), [7.4](https://github.com/redis/redis/blob/7.4/00-RELEASENOTES) and [8.0](https://github.com/redis/redis/blob/8.0/00-RELEASENOTES). The table below highlights version compatibility of the most-recent library versions and redis versions. From b566aded133d59c11b53991f8b512eb0a341dd2c Mon Sep 17 00:00:00 2001 From: Petya Slavova Date: Tue, 13 May 2025 11:12:16 +0300 Subject: [PATCH 3/3] Applying review comments --- README.md | 9 +++++++-- redis/__init__.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 80d9d4b5ca..177f78feeb 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,17 @@ The Python interface to the Redis key-value store. ## Installation -Start a redis via docker: +Start a redis via docker (for Redis versions >= 8.0): ``` bash -docker run -p 6379:6379 -it redis/redis-stack:latest +docker run -p 6379:6379 -it redis:latest ``` +Start a redis via docker (for Redis versions < 8.0): + +``` bash +docker run -p 6379:6379 -it redis/redis-stack:latest + To install redis-py, simply: ``` bash diff --git a/redis/__init__.py b/redis/__init__.py index 6769ba7506..cd3ee12adb 100644 --- a/redis/__init__.py +++ b/redis/__init__.py @@ -45,7 +45,7 @@ def int_or_str(value): return value -__version__ = "6.0.0" +__version__ = "6.1.0" VERSION = tuple(map(int_or_str, __version__.split(".")))