Repository navigation
DOC-7294 Add Python and Go BITRANGEINTARRAY examples to the bitmaps page - #4527
Conversation
🧠 Redis MemoryFound 8 related items from repository history (3 new this commit):
Memory updated at f245bb4 |
|
Thanks for the reviews @dwdougherty ! |
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]>
c03a9ff to
f245bb4
Compare
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]>
…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]>
Adds a
bitrangeintarraystep to thebitmap_tutorialset for Python (newdt_bitmap.py) and Go (newExampleClient_bitrangeintarray), and wraps theBITRANGEINTARRAYredis-cli block inbitmaps.mdin aclients-exampleshortcode limited to Python and Go. The prompt prefix inside the block changes fromredis>to>to match the rest of the page.Run-verified on
redis:8.12.0with go-redis v9.24.0 and redis-py v8.2.0.ExampleClient_bitrangeintarraypassedgo test, including the// Output:match, anddt_bitmap.pyprinted the expected values.bitmap-default-roaringwas back tonoafterwards. The Go example now usesBitRangeIntArrayWithOptions(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
BITRANGEINTARRAYto thebitmap_tutorialexample set, aligned with the existing redis-cli flows (roaring config, set bits, full range,ZEROS, andBIT/BYTELIMITpagination).On bitmaps.md, the standalone redis-cli fence under “Retrieve matching bit offsets” is replaced with a
clients-exampleshortcode (step="bitrangeintarray",lang_filter="Python, Go") and CLI prompts use>instead ofredis>.New sources:
local_examples/tmp/datatypes/strings/dt_bitmap.py(redis-py) andExampleClient_bitrangeintarrayinbitmap_tutorial_test.go(go-redisBitRangeIntArray/BitRangeIntArrayWithOptions), with cleanup viaREMOVE_START/REMOVE_ENDmarkers for the doc build.Reviewed by Cursor Bugbot for commit f245bb4. Bugbot is set up for automated code reviews on this repo. Configure here.