Skip to content

DOC-7294 Add Python and Go BITRANGEINTARRAY examples to the bitmaps page - #4527

Merged
andy-stark-redis merged 2 commits into
mainfrom
DOC-7294-bitrangeintarray-example
Nov 24, 2026
Merged

andy-stark-redis merged 2 commits into
mainfrom
DOC-7294-bitrangeintarray-example

Conversation

@andy-stark-redis

@andy-stark-redis andy-stark-redis commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Adds a bitrangeintarray step to the bitmap_tutorial set for Python (new dt_bitmap.py) and Go (new ExampleClient_bitrangeintarray), and wraps the BITRANGEINTARRAY redis-cli block in bitmaps.md in a clients-example shortcode limited to Python and Go. The prompt prefix inside the block changes from redis> to > to match the rest of the page.

Run-verified on redis:8.12.0 with go-redis v9.24.0 and redis-py v8.2.0. ExampleClient_bitrangeintarray passed go test, including the // Output: match, and dt_bitmap.py printed the expected values. bitmap-default-roaring was back to no afterwards. The Go example now uses BitRangeIntArrayWithOptions (renamed in go-redis#4277).


Note

Low Risk
Documentation and example harness only; no runtime or security-sensitive code paths change.

Overview
Adds runnable Python and Go client examples for BITRANGEINTARRAY to the bitmap_tutorial example set, aligned with the existing redis-cli flows (roaring config, set bits, full range, ZEROS, and BIT/BYTE LIMIT pagination).

On bitmaps.md, the standalone redis-cli fence under “Retrieve matching bit offsets” is replaced with a clients-example shortcode (step="bitrangeintarray", lang_filter="Python, Go") and CLI prompts use > instead of redis>.

New sources: local_examples/tmp/datatypes/strings/dt_bitmap.py (redis-py) and ExampleClient_bitrangeintarray in bitmap_tutorial_test.go (go-redis BitRangeIntArray / BitRangeIntArrayWithOptions), with cleanup via REMOVE_START/REMOVE_END markers for the doc build.

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

@andy-stark-redis andy-stark-redis added do not merge yet parked PR speculatively added based on pre-release info. Check validity when release goes ahead. labels Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

DOC-7294

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Redis Memory

Found 8 related items from repository history (3 new this commit):

Memory updated at f245bb4

@andy-stark-redis
andy-stark-redis requested a review from a team November 10, 2026 11:23
@andy-stark-redis andy-stark-redis self-assigned this Nov 10, 2026
@andy-stark-redis andy-stark-redis added the clients Client library docs label Nov 10, 2026
@andy-stark-redis

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews @dwdougherty !

andy-stark-redis and others added 2 commits November 24, 2026 13:07
Adds a `bitrangeintarray` step to the `bitmap_tutorial` set for Python (new
dt_bitmap.py) and Go (new ExampleClient_bitrangeintarray), and wraps the
BITRANGEINTARRAY redis-cli block in bitmaps.md in a clients-example shortcode
limited to Python and Go with lang_filter. The redis-cli prompt prefix changes
from `redis>` to `>` inside the shortcode to match the other blocks on the page.

Parked: BITRANGEINTARRAY is on the default branch of redis-py (509306f) and
go-redis (9f33ff1) but in no release (redis-py v8.2.0b1 lacks it; go-redis
v9.23.0 lacks it). Static checks only: `go vet` against the go-redis master
clone and an import/signature check of redis.Redis.bitrangeintarray from a
redis-py master install. NOT run: no Redis 8.12 server was available (Docker
not running; local redis-server is 7.2.7), so the printed values are copied
from the server-authored redis-cli block on the same page.

Not covered yet: Jedis (#4830 open), predis (#1754 open), lettuce (#3992 merged
2026-11-09, no tag), redis-rb (merged, Ruby has no bitmap_tutorial source),
node-redis (BITRANGEINTARRAY in neither 6.3.1 nor 6.4.0-beta.0). Add each to
the lang_filter allowlist only when it ships.

Learned:
- bitmap_tutorial had no Python, Node.js or Ruby source at all; the Roaring
  section's existing `roaring` step is CLI-only. The new Python file contains
  only this step, so the Python tab appears only on this block.
- The step sets bitmap-default-roaring and resets it in REMOVE code, which the
  build strips; the harness must reset it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Unparked after go-redis v9.24.0 (and redis-py v8.2.0) shipped with Redis 8.12.0 GA.
The park snapshot predicted the Go rename from go-redis#4277 and it landed: the example
now uses BitRangeIntArrayWithOptions and BitRangeIntArrayOptions, Unit is the string
"BIT" or "BYTE" (the redis.BitCountIndex* constants no longer fit), and Limit is *int64,
so the step declares two int64 variables. The Python example needed no change, because
the redis-py v8.2.0 signature matches the snapshot. Both examples were run on
redis:8.12.0, with go test matching its // Output block, and both left
bitmap-default-roaring at no. The shortcode keeps lang_filter="Python, Go": the other
bitmap_tutorial steps are unaffected, since the tab partial omits a client whose file
lacks the step. The branch was recreated from origin/main with the one PR commit
cherry-picked, because feature-oss-8.12 is already in main as a squash.

Learned: redis-py v8.2.0 fails the merge-commit ancestor test (diverged) but contains the code, so read the signature at the tag
Learned: a python script run against a bare redis.Redis() hits port 6379, not the scratch container, so pass the port explicitly and check the container version in the output
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@andy-stark-redis
andy-stark-redis force-pushed the DOC-7294-bitrangeintarray-example branch from c03a9ff to f245bb4 Compare November 24, 2026 13:16
@andy-stark-redis andy-stark-redis changed the title DOC-7294 Add Python and Go BITRANGEINTARRAY examples to the bitmaps page [PARKED] DOC-7294 Add Python and Go BITRANGEINTARRAY examples to the bitmaps page Nov 24, 2026
@andy-stark-redis andy-stark-redis removed do not merge yet parked PR speculatively added based on pre-release info. Check validity when release goes ahead. labels Nov 24, 2026
@andy-stark-redis
andy-stark-redis merged commit 12892e8 into main Nov 24, 2026
115 checks passed
@andy-stark-redis
andy-stark-redis deleted the DOC-7294-bitrangeintarray-example branch November 24, 2026 15:39
andy-stark-redis added a commit that referenced this pull request Nov 25, 2026
Adds a `bitrangeintarray` step to the PHP `bitmap_tutorial` file and
wraps the BITRANGEINTARRAY redis-cli block in bitmaps.md in a
`clients-example` shortcode with `lang_filter="PHP"`. The prompt prefix
in the block changes from `redis>` to `>` to match the rest of the page.

Run-verified on redis:8.12-rc2 (reports 8.11.241) against Predis v3.8.0.
Outputs match the redis-cli block: [1,7,9,30], [28,29,31], [1,7],
[9,30], [1,7], [9]. The `$index` argument is the BYTE/BIT unit: Predis
upper-cases arg 4 and appends it as-is (BITRANGEINTARRAY.php at v3.8.0).

Learned:
- The PHP step runs CONFIG SET bitmap-default-roaring yes, as the
  redis-cli block does, and resets it to `no` in REMOVE code. The build
  strips REMOVE blocks, so the reset only protects the harness.
- build/example-test-harness/run.sh has no `bitmap_tutorial` entry at
  all, so `./run.sh bitmap_tutorial php` reports "SKIP (no source)". I
  ran it with a temporary `bitmap_tutorial:php` line pointing at
  local_examples/tmp/DtBitmapTest.php and did not commit it, to stay in
  scope. The parked #4527 also notes the missing mapping.
- Not Hugo-built: the shortcode shape copies the neighboring steps.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
andy-stark-redis added a commit that referenced this pull request Nov 25, 2026
…4663)

Adds a `bitrangeintarray` step to the PHP `bitmap_tutorial` example. The page
block was already a clients-example for Python and Go (DOC-7294, #4527
landed while this PR was open), so the only page change is adding PHP to its
`lang_filter`, which is now "Python, Go, PHP".

Run-verified on redis:8.12-rc2 (reports 8.11.241) against Predis v3.8.0. The
outputs match the redis-cli block: [1,7,9,30], [28,29,31], [1,7], [9,30],
[1,7], [9]. The step runs CONFIG SET bitmap-default-roaring yes as the block
does and resets it to `no` in REMOVE code. The build strips REMOVE blocks,
so the reset only protects the harness.

Learned: build/example-test-harness/run.sh has no bitmap_tutorial entry, so ./run.sh bitmap_tutorial php reports SKIP (no source)
Directive: to re-run the PHP step, add a temporary bitmap_tutorial:php line pointing at local_examples/tmp/DtBitmapTest.php to run.sh and do not commit it
Gaps: the page was not built with Hugo locally; the PHP step was not re-run after rebasing onto the Python and Go change, which touched only the shortcode line
Ticket: DOC-7346
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients Client library docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants