Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added support for new array commands#4055

Merged
vladvildanov merged 17 commits into
masterfrom
vv-array-commands-support
May 20, 2026
Merged

Added support for new array commands#4055
vladvildanov merged 17 commits into
masterfrom
vv-array-commands-support

Conversation

@vladvildanov

@vladvildanov vladvildanov commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Description of change

Adds Python client support for the new Redis Array data type, introduced in Redis 8.8.0 (preview).

Commands implemented

All 18 array commands available under Redis() and redis.asyncio.Redis():

Group Commands
Read arget, armget, argetrange, arscan, arcount, arlen, arnext, arinfo
Write arset, armset, arinsert, arring, arseek
Delete ardel, ardelrange
Search argrep
Aggregate arop
History arlastitems

New public enums (re-exported from redis.commands.core)

  • ArrayAggregateOperations — operation selector for arop (SUM, MIN, MAX, AND, OR, XOR, MATCH, USED)
  • ArrayPredicateType — predicate kind for argrep (EXACT, MATCH, GLOB, RE)
  • ArrayPredicateCombinator — predicate combiner for argrep (AND, OR)

RESP2 / RESP3 compatibility

17 of the 18 commands return identical Python values across protocols and need no callback. ARINFO is the only command with protocol-divergent server output (RESP2 returns a flat key/value list; RESP3
returns a Map).

A parse_arinfo callback is registered in _RedisCallbacks (redis/_parsers/response_callbacks.py) so that all five documented modes — (protocol=2|3|None) × (legacy_responses=True|False) — produce a
consistent dict[str, int] shape. This matches the XINFO STREAM pattern.

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.


Note

Medium Risk
Adds a new public command surface for the preview Redis Array type and introduces a new response parser (ARINFO) that affects RESP2/RESP3 callback selection; behavior depends on server version and response-shape normalization.

Overview
Adds first-class Python client support for the preview Redis Array data type by introducing ArrayCommands (mixed into DataAccessCommands and async variants) with methods for read/write/delete/search/aggregate operations (e.g. ARSET, ARMSET, ARGET*, ARGREP, AROP, etc.) plus new public enums (ArrayAggregateOperations, ArrayPredicateType, ArrayPredicateCombinator).

Normalizes ARINFO responses across RESP2/RESP3 by adding parse_arinfo and registering it in the shared response-callback map, and adds broad sync+async test coverage for the new commands gated by skip_if_server_version_lt("8.7.2"). CI dependency-audit config is updated to ignore PYSEC-2025-183.

Reviewed by Cursor Bugbot for commit 7e349b1. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Redis-py client support for the new Redis Array data type (Redis 8.8.0 preview) by introducing a new ArrayCommands mixin (sync + asyncio), related public enums, and a protocol-unifying ARINFO response callback, along with extensive command tests.

Changes:

  • Add ArrayCommands (18 commands) and three public enums to redis.commands.core, and wire the mixin into Redis() / redis.asyncio.Redis() command surfaces.
  • Register a parse_arinfo response callback to normalize ARINFO output across RESP2/RESP3 into a consistent dict.
  • Add sync and asyncio tests for the new Array commands.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
redis/commands/core.py Introduces ArrayCommands + enums and mixes them into the main command classes.
redis/_parsers/helpers.py Adds parse_arinfo to normalize ARINFO replies.
redis/_parsers/response_callbacks.py Registers ARINFOparse_arinfo callback.
tests/test_commands.py Adds sync coverage for Array commands (including ARGETRANGE and explicit ARINSERT behavior tests).
tests/test_asyncio/test_commands.py Adds asyncio coverage for many Array commands, but misses some parity with sync tests (see comment).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_asyncio/test_commands.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e9ef2eb. Configure here.

Comment thread redis/commands/core.py Outdated
@jit-ci

jit-ci Bot commented May 7, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Comment thread redis/commands/core.py Outdated
Comment thread tests/test_asyncio/test_commands.py Outdated
@petyaslavova petyaslavova added the feature New feature label May 11, 2026
@vladvildanov vladvildanov marked this pull request as ready for review May 20, 2026 08:50

@petyaslavova petyaslavova left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@vladvildanov vladvildanov merged commit 9d6a252 into master May 20, 2026
342 of 343 checks passed
@vladvildanov vladvildanov deleted the vv-array-commands-support branch May 20, 2026 10:58
petyaslavova added a commit that referenced this pull request May 26, 2026
* Added a part of array commands

* Added one more group of commands

* Added remaining commands

* Updated callbacks

* Changed version constraint

* Updated test image

* Added missing coverage

* Codestyle fixes

* Updated return types of ARGREP and ARSCAN

* Codestyle fixes

* Added ignore vulnerability for PyJWT

---------

Co-authored-by: petyaslavova <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants