Added support for new array commands#4055
Conversation
There was a problem hiding this comment.
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 toredis.commands.core, and wire the mixin intoRedis()/redis.asyncio.Redis()command surfaces. - Register a
parse_arinforesponse callback to normalizeARINFOoutput across RESP2/RESP3 into a consistentdict. - 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 ARINFO → parse_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.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
… into vv-array-commands-support
… into vv-array-commands-support
* 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]>

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()andredis.asyncio.Redis():arget,armget,argetrange,arscan,arcount,arlen,arnext,arinfoarset,armset,arinsert,arring,arseekardel,ardelrangeargreparoparlastitemsNew public enums (re-exported from
redis.commands.core)ArrayAggregateOperations— operation selector forarop(SUM,MIN,MAX,AND,OR,XOR,MATCH,USED)ArrayPredicateType— predicate kind forargrep(EXACT,MATCH,GLOB,RE)ArrayPredicateCombinator— predicate combiner forargrep(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_arinfocallback is registered in_RedisCallbacks(redis/_parsers/response_callbacks.py) so that all five documented modes —(protocol=2|3|None) × (legacy_responses=True|False)— produce aconsistent
dict[str, int]shape. This matches theXINFO STREAMpattern.Pull Request check-list
Please make sure to review and check all of these items:
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 intoDataAccessCommandsand 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
ARINFOresponses across RESP2/RESP3 by addingparse_arinfoand registering it in the shared response-callback map, and adds broad sync+async test coverage for the new commands gated byskip_if_server_version_lt("8.7.2"). CI dependency-audit config is updated to ignorePYSEC-2025-183.Reviewed by Cursor Bugbot for commit 7e349b1. Bugbot is set up for automated code reviews on this repo. Configure here.