You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "WaterWhisperer (via GitHub)" <gi...@apache.org> on 2026/05/24 15:26:38 UTC

[PR] ci(python): add interpreter version sync check [iggy]

WaterWhisperer opened a new pull request, #3319:
URL: https://github.com/apache/iggy/pull/3319

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #2776
   
   ## Rationale
   
   <!--
   Why is this change needed? If the issue explains it well, a one-liner is fine.
   -->
   Create a bash script that runs in CI and pre-commit hooks and checks that the python versions being used are all in sync.
   
   ## What changed?
   
   <!--
   2-4 sentences. Problem first (before), then solution (after).
   
   GOOD:
   
   "Messages were unavailable when background message_saver committed the
   journal and started async disk I/O before completion. Polling during
   this window found neither journal nor disk data.
   
   The fix freezes journal batches in the in-flight buffer before async persist."
   
   GOOD:
   
   "When many small messages accumulate in the journal, the flush passes
   thousands of IO vectors to writev(), exceeding IOV_MAX (1024 on Linux)."
   
   BAD:
   - Walls of text
   - "This PR adds..." (we can see the diff)
   -->
   The Python SDK declares its supported interpreter version in `foreign/python/pyproject.toml`, but related files can drift independently.
   
   A new `sync-python-version.sh` check uses that `requires-python` value as the source of truth, verifies the matching docker/README/CI/BDD/examples references, and checks that wheel builds include the selected interpreter. The check is wired into common CI and pre-commit.
   
   ## Local Execution
   
   - Passed:
     - `./scripts/ci/sync-python-version.sh --check`
     - `./scripts/ci/sync-python-version.sh --fix`
     - `./scripts/ci/shellcheck.sh --check scripts/ci/sync-python-version.sh`
     - `typos`
   - Pre-commit hooks ran
   
   <!--
   You must run your code locally before submitting.
   "Relying on CI" is not acceptable - PRs from authors who haven't run the code will be closed.
   
   Did you have `prek` installed? It runs automatically on commit and covers all project languages. See [CONTRIBUTING.md](https://github.com/apache/iggy/blob/master/CONTRIBUTING.md).
   -->
   
   ## AI Usage
   
   <!--
   If AI tools were used, please answer:
   1. Which tools? (e.g., GitHub Copilot, Claude, ChatGPT)
   2. Scope of usage? (e.g., autocomplete, generated functions, entire implementation)
   3. How did you verify the generated code works correctly?
   4. Can you explain every line of the code if asked?
   
   If no AI tools were used, write "None" or delete this section.
   -->
   
   1. Tools used: Codex
   2. Scope: repository inspection, implementation drafting, verification command selection.
   3. Verification: reviewed the generated diff and ran the local checks listed above.
   4. Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "WaterWhisperer (via GitHub)" <gi...@apache.org>.
WaterWhisperer commented on code in PR #3319:
URL: https://github.com/apache/iggy/pull/3319#discussion_r3298702064


##########
scripts/ci/sync-python-version.sh:
##########
@@ -0,0 +1,222 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Default mode
+MODE=""
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Sync the Python interpreter version across SDK files, CI, and Dockerfiles"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if Python interpreter versions are synchronized"
+            echo "  --fix      Update files to use the Python interpreter version from foreign/python/pyproject.toml"
+            echo "  --help     Show this help message"
+            exit 0
+            ;;
+        *)
+            echo -e "${RED}Error: Unknown option $1${NC}"
+            echo "Use --help for usage information"
+            exit 1
+            ;;
+    esac
+done
+
+# Require mode to be specified
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+# Get the repository root (two levels up from scripts/ci/)
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+SOURCE_FILE="foreign/python/pyproject.toml"
+PYTHON_VERSION=$(sed -nE 's/^requires-python = ">=([0-9]+\.[0-9]+)".*/\1/p' "$SOURCE_FILE" | head -1)
+
+if [ -z "$PYTHON_VERSION" ]; then
+    echo -e "${RED}Error: Could not extract Python interpreter version from $SOURCE_FILE${NC}"
+    exit 1
+fi
+
+PYTHON_VERSION_REGEX=${PYTHON_VERSION//./\\.}
+FAILED=0
+TOTAL_CHECKS=0
+FIXED_CHECKS=0
+
+echo -e "Python interpreter version from $SOURCE_FILE: ${GREEN}$PYTHON_VERSION${NC}"
+echo ""
+
+ensure_line() {
+    local file="$1"
+    local current_pattern="$2"
+    local expected_pattern="$3"
+    local replacement="$4"
+    local description="$5"
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    if grep -Eq "$expected_pattern" "$file"; then
+        echo -e "${GREEN}✓${NC} $file: $description"
+        return
+    fi
+
+    if ! grep -Eq "$current_pattern" "$file"; then
+        echo -e "${RED}✗${NC} $file: could not find $description"
+        FAILED=1
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: $description"
+    else
+        echo -e "${RED}✗${NC} $file: $description is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_wheel_interpreters() {
+    local file="$1"
+    local target_interpreter="python${PYTHON_VERSION}"
+    local missing=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ "$line" != *"$target_interpreter"* ]]; then
+            missing=1
+        fi
+    done < <(grep -- "--interpreter" "$file" || true)
+
+    if [ "$total" -eq 0 ]; then
+        echo -e "${RED}✗${NC} $file: could not find wheel interpreter list"
+        FAILED=1
+        return
+    fi
+
+    if [ "$missing" -eq 0 ]; then
+        echo -e "${GREEN}✓${NC} $file: wheel builds include $target_interpreter"
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "/--interpreter/ { /python${PYTHON_VERSION_REGEX}/! s/--interpreter/--interpreter ${target_interpreter}/; }" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: added $target_interpreter to wheel interpreter lists"
+    else
+        echo -e "${RED}✗${NC} $file: wheel builds do not include $target_interpreter"
+        FAILED=1
+    fi
+}
+
+ensure_line \
+    "foreign/python/Dockerfile.test" \
+    "^(FROM python:)[0-9]+\\.[0-9]+(-slim AS base)$" \
+    "^FROM python:${PYTHON_VERSION_REGEX}-slim AS base$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "Docker image Python version"
+
+ensure_line \
+    "foreign/python/README.md" \
+    "^(- Python )[0-9]+\\.[0-9]+(\\+.*)$" \
+    "^- Python ${PYTHON_VERSION_REGEX}\\+.*$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "README Python requirement"
+
+ensure_line \
+    "bdd/python/pyproject.toml" \
+    "^(requires-python = \">=)[0-9]+\\.[0-9]+(\".*)$" \
+    "^requires-python = \">=${PYTHON_VERSION_REGEX}\".*$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "BDD Python requirement"
+
+ensure_line \
+    "examples/python/pyproject.toml" \
+    "^(requires-python = \">=)[0-9]+\\.[0-9]+(\".*)$" \
+    "^requires-python = \">=${PYTHON_VERSION_REGEX}\".*$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "examples Python requirement"
+
+ensure_line \
+    ".github/actions/python-maturin/pre-merge/action.yml" \
+    "^([[:space:]]*python-version: \")[0-9]+\\.[0-9]+(\".*)$" \
+    "^[[:space:]]*python-version: \"${PYTHON_VERSION_REGEX}\".*$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "maturin action Python version"

Review Comment:
   I don't see any `pylock.toml` files in the current tree, but I'll add optional detection for it as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3319:
URL: https://github.com/apache/iggy/pull/3319#issuecomment-4529156703

   <!-- iggy-pr-triage-welcome -->
   Thanks for the pull request. It is now waiting for review, labeled `S-waiting-on-review`.
   
   You can update that label as the review goes back and forth, with slash commands - each on its own line, in a regular PR comment (not an inline review reply):
   
   - `/ready` - mark it `S-waiting-on-review` again, after addressing feedback
   - `/author` - mark it `S-waiting-on-author` (maintainers, or anyone who has had a PR merged before)
   - `/request-review @user ...` - request reviewers (`@user` or `@org/team`)
   
   Commands take up to ~90s to apply. If no reaction (👍 or 😕) appears on your comment, the apply step likely failed - check the repo's Actions tab for the `PR Triage Apply` run. Commands posted inside a review body (rather than a normal comment) cannot be reacted to, so they stay log-only.
   
   See [CONTRIBUTING.md](https://github.com/apache/iggy/blob/master/CONTRIBUTING.md#pr-triage-commands) for details.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on code in PR #3319:
URL: https://github.com/apache/iggy/pull/3319#discussion_r3301658323


##########
scripts/ci/sync-python-version.sh:
##########
@@ -0,0 +1,301 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Default mode
+MODE=""
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Sync the Python interpreter version across SDK files, CI, and Dockerfiles"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if Python interpreter versions are synchronized"
+            echo "  --fix      Update files to use the Python interpreter version from foreign/python/pyproject.toml"
+            echo "  --help     Show this help message"
+            exit 0
+            ;;
+        *)
+            echo -e "${RED}Error: Unknown option $1${NC}"
+            echo "Use --help for usage information"
+            exit 1
+            ;;
+    esac
+done
+
+# Require mode to be specified
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+# Get the repository root (two levels up from scripts/ci/)
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+SOURCE_FILE="foreign/python/pyproject.toml"
+PYTHON_VERSION=$(sed -nE 's/^requires-python = ">=([0-9]+\.[0-9]+)".*/\1/p' "$SOURCE_FILE" | head -1)
+
+if [ -z "$PYTHON_VERSION" ]; then
+    echo -e "${RED}Error: Could not extract Python interpreter version from $SOURCE_FILE${NC}"
+    exit 1
+fi
+
+PYTHON_VERSION_REGEX=${PYTHON_VERSION//./\\.}
+FAILED=0
+TOTAL_CHECKS=0
+FIXED_CHECKS=0
+
+echo -e "Python interpreter version from $SOURCE_FILE: ${GREEN}$PYTHON_VERSION${NC}"
+echo ""
+
+ensure_line() {
+    local file="$1"
+    local current_pattern="$2"
+    local expected_pattern="$3"
+    local replacement="$4"
+    local description="$5"
+    local mismatched=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ ! "$line" =~ $expected_pattern ]]; then
+            mismatched=1
+        fi
+    done < <(grep -E "$current_pattern" "$file" || true)
+
+    if [ "$total" -eq 0 ]; then
+        echo -e "${RED}✗${NC} $file: could not find $description"
+        FAILED=1
+        return
+    fi
+
+    if [ "$mismatched" -eq 0 ]; then
+        echo -e "${GREEN}✓${NC} $file: $description"
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: $description"
+    else
+        echo -e "${RED}✗${NC} $file: $description is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_lock_python_requirement() {

Review Comment:
   alright, then we'll merge #3318 first. @WaterWhisperer ignore this comment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "slbotbm (via GitHub)" <gi...@apache.org>.
slbotbm commented on code in PR #3319:
URL: https://github.com/apache/iggy/pull/3319#discussion_r3294945353


##########
scripts/ci/sync-python-version.sh:
##########


Review Comment:
   It is only reading lines containing `--interpreter`, but not line like `python-version: "3.11"`



##########
scripts/ci/sync-python-version.sh:
##########
@@ -0,0 +1,222 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Default mode
+MODE=""
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Sync the Python interpreter version across SDK files, CI, and Dockerfiles"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if Python interpreter versions are synchronized"
+            echo "  --fix      Update files to use the Python interpreter version from foreign/python/pyproject.toml"
+            echo "  --help     Show this help message"
+            exit 0
+            ;;
+        *)
+            echo -e "${RED}Error: Unknown option $1${NC}"
+            echo "Use --help for usage information"
+            exit 1
+            ;;
+    esac
+done
+
+# Require mode to be specified
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+# Get the repository root (two levels up from scripts/ci/)
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+SOURCE_FILE="foreign/python/pyproject.toml"
+PYTHON_VERSION=$(sed -nE 's/^requires-python = ">=([0-9]+\.[0-9]+)".*/\1/p' "$SOURCE_FILE" | head -1)
+
+if [ -z "$PYTHON_VERSION" ]; then
+    echo -e "${RED}Error: Could not extract Python interpreter version from $SOURCE_FILE${NC}"
+    exit 1
+fi
+
+PYTHON_VERSION_REGEX=${PYTHON_VERSION//./\\.}
+FAILED=0
+TOTAL_CHECKS=0
+FIXED_CHECKS=0
+
+echo -e "Python interpreter version from $SOURCE_FILE: ${GREEN}$PYTHON_VERSION${NC}"
+echo ""
+
+ensure_line() {
+    local file="$1"
+    local current_pattern="$2"
+    local expected_pattern="$3"
+    local replacement="$4"
+    local description="$5"
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    if grep -Eq "$expected_pattern" "$file"; then
+        echo -e "${GREEN}✓${NC} $file: $description"
+        return
+    fi
+
+    if ! grep -Eq "$current_pattern" "$file"; then
+        echo -e "${RED}✗${NC} $file: could not find $description"
+        FAILED=1
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: $description"
+    else
+        echo -e "${RED}✗${NC} $file: $description is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_wheel_interpreters() {
+    local file="$1"
+    local target_interpreter="python${PYTHON_VERSION}"
+    local missing=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ "$line" != *"$target_interpreter"* ]]; then
+            missing=1
+        fi
+    done < <(grep -- "--interpreter" "$file" || true)
+
+    if [ "$total" -eq 0 ]; then
+        echo -e "${RED}✗${NC} $file: could not find wheel interpreter list"
+        FAILED=1
+        return
+    fi
+
+    if [ "$missing" -eq 0 ]; then
+        echo -e "${GREEN}✓${NC} $file: wheel builds include $target_interpreter"
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "/--interpreter/ { /python${PYTHON_VERSION_REGEX}/! s/--interpreter/--interpreter ${target_interpreter}/; }" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: added $target_interpreter to wheel interpreter lists"
+    else
+        echo -e "${RED}✗${NC} $file: wheel builds do not include $target_interpreter"
+        FAILED=1
+    fi
+}
+
+ensure_line \
+    "foreign/python/Dockerfile.test" \
+    "^(FROM python:)[0-9]+\\.[0-9]+(-slim AS base)$" \
+    "^FROM python:${PYTHON_VERSION_REGEX}-slim AS base$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "Docker image Python version"
+
+ensure_line \
+    "foreign/python/README.md" \
+    "^(- Python )[0-9]+\\.[0-9]+(\\+.*)$" \
+    "^- Python ${PYTHON_VERSION_REGEX}\\+.*$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "README Python requirement"
+
+ensure_line \
+    "bdd/python/pyproject.toml" \
+    "^(requires-python = \">=)[0-9]+\\.[0-9]+(\".*)$" \
+    "^requires-python = \">=${PYTHON_VERSION_REGEX}\".*$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "BDD Python requirement"
+
+ensure_line \
+    "examples/python/pyproject.toml" \
+    "^(requires-python = \">=)[0-9]+\\.[0-9]+(\".*)$" \
+    "^requires-python = \">=${PYTHON_VERSION_REGEX}\".*$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "examples Python requirement"
+
+ensure_line \
+    ".github/actions/python-maturin/pre-merge/action.yml" \
+    "^([[:space:]]*python-version: \")[0-9]+\\.[0-9]+(\".*)$" \
+    "^[[:space:]]*python-version: \"${PYTHON_VERSION_REGEX}\".*$" \
+    "\\1${PYTHON_VERSION}\\2" \
+    "maturin action Python version"

Review Comment:
   Please add detection for `pylock.toml` to this as well as the pre-commit hooks.



##########
scripts/ci/sync-python-version.sh:
##########


Review Comment:
   `iggy/foreign/python/.devcontainer/Dockerfile` is also not covered by this.



##########
scripts/ci/sync-python-version.sh:
##########


Review Comment:
   This script is not working properly since it failed to detect that `.github/workflows/_build_python_wheels.yml` uses python 3.11, while it should be using 3.10.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3319:
URL: https://github.com/apache/iggy/pull/3319#issuecomment-4532522300

   ## [Codecov](https://app.codecov.io/gh/apache/iggy/pull/3319?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 73.25%. Comparing base ([`7aa4539`](https://app.codecov.io/gh/apache/iggy/commit/7aa45393612fdd39d4ae8b3aff222fcc8249f33a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`38b90bf`](https://app.codecov.io/gh/apache/iggy/commit/38b90bf32d461e955413a1852b58e49e3368afac?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3319      +/-   ##
   ============================================
   - Coverage     74.16%   73.25%   -0.92%     
     Complexity      943      943              
   ============================================
     Files          1237     1174      -63     
     Lines        112641   107834    -4807     
     Branches      89201    89113      -88     
   ============================================
   - Hits          83536    78989    -4547     
   + Misses        26309    26048     -261     
   - Partials       2796     2797       +1     
   ```
   
   | [Components](https://app.codecov.io/gh/apache/iggy/pull/3319/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [Rust Core](https://app.codecov.io/gh/apache/iggy/pull/3319/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `75.30% <ø> (ø)` | |
   | [Java SDK](https://app.codecov.io/gh/apache/iggy/pull/3319/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `58.44% <ø> (ø)` | |
   | [C# SDK](https://app.codecov.io/gh/apache/iggy/pull/3319/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.65% <ø> (ø)` | |
   | [Python SDK](https://app.codecov.io/gh/apache/iggy/pull/3319/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `81.43% <ø> (ø)` | |
   | [Node SDK](https://app.codecov.io/gh/apache/iggy/pull/3319/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `87.48% <ø> (-3.93%)` | :arrow_down: |
   | [Go SDK](https://app.codecov.io/gh/apache/iggy/pull/3319/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.91% <ø> (ø)` | |
   [see 81 files with indirect coverage changes](https://app.codecov.io/gh/apache/iggy/pull/3319/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "WaterWhisperer (via GitHub)" <gi...@apache.org>.
WaterWhisperer commented on PR #3319:
URL: https://github.com/apache/iggy/pull/3319#issuecomment-4542405769

   @hubcio thanks for the guidance


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "WaterWhisperer (via GitHub)" <gi...@apache.org>.
WaterWhisperer commented on code in PR #3319:
URL: https://github.com/apache/iggy/pull/3319#discussion_r3298699080


##########
scripts/ci/sync-python-version.sh:
##########


Review Comment:
   Thanks, I'll update.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "slbotbm (via GitHub)" <gi...@apache.org>.
slbotbm commented on PR #3319:
URL: https://github.com/apache/iggy/pull/3319#issuecomment-4529320365

   /author


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "WaterWhisperer (via GitHub)" <gi...@apache.org>.
WaterWhisperer commented on PR #3319:
URL: https://github.com/apache/iggy/pull/3319#issuecomment-4539860576

   > lgtm from my side, but an issue remains: if we upgrade the python version to 3.11 and forget to remove code publishing 3.10 wheels, the script will still pass. (I am not really sure that is in the scope of this PR -- maybe @hubcio can comment?)
   
   Thanks, I’ll wait for @hubcio’s thoughts.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "slbotbm (via GitHub)" <gi...@apache.org>.
slbotbm commented on code in PR #3319:
URL: https://github.com/apache/iggy/pull/3319#discussion_r3301595252


##########
scripts/ci/sync-python-version.sh:
##########
@@ -0,0 +1,301 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Default mode
+MODE=""
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Sync the Python interpreter version across SDK files, CI, and Dockerfiles"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if Python interpreter versions are synchronized"
+            echo "  --fix      Update files to use the Python interpreter version from foreign/python/pyproject.toml"
+            echo "  --help     Show this help message"
+            exit 0
+            ;;
+        *)
+            echo -e "${RED}Error: Unknown option $1${NC}"
+            echo "Use --help for usage information"
+            exit 1
+            ;;
+    esac
+done
+
+# Require mode to be specified
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+# Get the repository root (two levels up from scripts/ci/)
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+SOURCE_FILE="foreign/python/pyproject.toml"
+PYTHON_VERSION=$(sed -nE 's/^requires-python = ">=([0-9]+\.[0-9]+)".*/\1/p' "$SOURCE_FILE" | head -1)
+
+if [ -z "$PYTHON_VERSION" ]; then
+    echo -e "${RED}Error: Could not extract Python interpreter version from $SOURCE_FILE${NC}"
+    exit 1
+fi
+
+PYTHON_VERSION_REGEX=${PYTHON_VERSION//./\\.}
+FAILED=0
+TOTAL_CHECKS=0
+FIXED_CHECKS=0
+
+echo -e "Python interpreter version from $SOURCE_FILE: ${GREEN}$PYTHON_VERSION${NC}"
+echo ""
+
+ensure_line() {
+    local file="$1"
+    local current_pattern="$2"
+    local expected_pattern="$3"
+    local replacement="$4"
+    local description="$5"
+    local mismatched=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ ! "$line" =~ $expected_pattern ]]; then
+            mismatched=1
+        fi
+    done < <(grep -E "$current_pattern" "$file" || true)
+
+    if [ "$total" -eq 0 ]; then
+        echo -e "${RED}✗${NC} $file: could not find $description"
+        FAILED=1
+        return
+    fi
+
+    if [ "$mismatched" -eq 0 ]; then
+        echo -e "${GREEN}✓${NC} $file: $description"
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: $description"
+    else
+        echo -e "${RED}✗${NC} $file: $description is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_lock_python_requirement() {

Review Comment:
   the pylock files will be added in #3318. Leaving at least the pylock part as it is seems prudent.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "WaterWhisperer (via GitHub)" <gi...@apache.org>.
WaterWhisperer commented on PR #3319:
URL: https://github.com/apache/iggy/pull/3319#issuecomment-4542396743

   /ready


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio merged PR #3319:
URL: https://github.com/apache/iggy/pull/3319


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "WaterWhisperer (via GitHub)" <gi...@apache.org>.
WaterWhisperer commented on PR #3319:
URL: https://github.com/apache/iggy/pull/3319#issuecomment-4535273407

   /ready


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on code in PR #3319:
URL: https://github.com/apache/iggy/pull/3319#discussion_r3301516829


##########
scripts/ci/sync-python-version.sh:
##########
@@ -0,0 +1,301 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Default mode
+MODE=""
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Sync the Python interpreter version across SDK files, CI, and Dockerfiles"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if Python interpreter versions are synchronized"
+            echo "  --fix      Update files to use the Python interpreter version from foreign/python/pyproject.toml"
+            echo "  --help     Show this help message"
+            exit 0
+            ;;
+        *)
+            echo -e "${RED}Error: Unknown option $1${NC}"
+            echo "Use --help for usage information"
+            exit 1
+            ;;
+    esac
+done
+
+# Require mode to be specified
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+# Get the repository root (two levels up from scripts/ci/)
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+SOURCE_FILE="foreign/python/pyproject.toml"
+PYTHON_VERSION=$(sed -nE 's/^requires-python = ">=([0-9]+\.[0-9]+)".*/\1/p' "$SOURCE_FILE" | head -1)
+
+if [ -z "$PYTHON_VERSION" ]; then
+    echo -e "${RED}Error: Could not extract Python interpreter version from $SOURCE_FILE${NC}"
+    exit 1
+fi
+
+PYTHON_VERSION_REGEX=${PYTHON_VERSION//./\\.}
+FAILED=0
+TOTAL_CHECKS=0
+FIXED_CHECKS=0
+
+echo -e "Python interpreter version from $SOURCE_FILE: ${GREEN}$PYTHON_VERSION${NC}"
+echo ""
+
+ensure_line() {
+    local file="$1"
+    local current_pattern="$2"
+    local expected_pattern="$3"
+    local replacement="$4"
+    local description="$5"
+    local mismatched=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ ! "$line" =~ $expected_pattern ]]; then
+            mismatched=1
+        fi
+    done < <(grep -E "$current_pattern" "$file" || true)
+
+    if [ "$total" -eq 0 ]; then
+        echo -e "${RED}✗${NC} $file: could not find $description"
+        FAILED=1
+        return
+    fi
+
+    if [ "$mismatched" -eq 0 ]; then
+        echo -e "${GREEN}✓${NC} $file: $description"
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: $description"
+    else
+        echo -e "${RED}✗${NC} $file: $description is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_lock_python_requirement() {
+    local file="$1"
+    local current_pattern="^(requires-python = \">=)[0-9]+\\.[0-9]+(\".*)$"
+    local expected_pattern="^requires-python = \">=${PYTHON_VERSION_REGEX}\".*$"
+    local replacement="\\1${PYTHON_VERSION}\\2"
+    local first_table_line
+    local top_level_end
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    first_table_line=$(grep -n -m1 '^\[' "$file" | cut -d: -f1 || true)
+    if [ -n "$first_table_line" ]; then
+        top_level_end=$((first_table_line - 1))
+    else
+        top_level_end=$(wc -l < "$file")
+    fi
+
+    if [ "$top_level_end" -lt 1 ]; then
+        echo -e "${RED}✗${NC} $file: could not find lock file Python requirement"
+        FAILED=1
+        return
+    fi
+
+    if sed -n "1,${top_level_end}p" "$file" | grep -Eq "$expected_pattern"; then
+        echo -e "${GREEN}✓${NC} $file: lock file Python requirement"
+        return
+    fi
+
+    if ! sed -n "1,${top_level_end}p" "$file" | grep -Eq "$current_pattern"; then
+        echo -e "${RED}✗${NC} $file: could not find lock file Python requirement"
+        FAILED=1
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "1,${top_level_end}s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: lock file Python requirement"
+    else
+        echo -e "${RED}✗${NC} $file: lock file Python requirement is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_wheel_interpreters() {
+    local file="$1"
+    local target_interpreter="python${PYTHON_VERSION}"
+    local missing=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ "$line" != *"$target_interpreter"* ]]; then
+            missing=1
+        fi
+    done < <(grep -- "--interpreter" "$file" || true)
+
+    if [ "$total" -eq 0 ]; then
+        echo -e "${RED}✗${NC} $file: could not find wheel interpreter list"
+        FAILED=1
+        return
+    fi
+
+    if [ "$missing" -eq 0 ]; then
+        echo -e "${GREEN}✓${NC} $file: wheel builds include $target_interpreter"
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "/--interpreter/ { /python${PYTHON_VERSION_REGEX}/! s/--interpreter/--interpreter ${target_interpreter}/; }" "$file"

Review Comment:
   `ensure_wheel_interpreters` is additive only. on a `requires-python` bump (say 3.10 -> 3.11) the existing `--interpreter python3.10 python3.11 python3.12 python3.13` line already contains the new target as a substring, so `missing=0`, the fix is a no-op, and the stale `python3.10` entry stays in the wheel matrix. consider asserting the exact interpreter set instead of checking for substring presence.



##########
scripts/ci/sync-python-version.sh:
##########
@@ -0,0 +1,301 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Default mode
+MODE=""
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Sync the Python interpreter version across SDK files, CI, and Dockerfiles"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if Python interpreter versions are synchronized"
+            echo "  --fix      Update files to use the Python interpreter version from foreign/python/pyproject.toml"
+            echo "  --help     Show this help message"
+            exit 0
+            ;;
+        *)
+            echo -e "${RED}Error: Unknown option $1${NC}"
+            echo "Use --help for usage information"
+            exit 1
+            ;;
+    esac
+done
+
+# Require mode to be specified
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+# Get the repository root (two levels up from scripts/ci/)
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+SOURCE_FILE="foreign/python/pyproject.toml"
+PYTHON_VERSION=$(sed -nE 's/^requires-python = ">=([0-9]+\.[0-9]+)".*/\1/p' "$SOURCE_FILE" | head -1)
+
+if [ -z "$PYTHON_VERSION" ]; then
+    echo -e "${RED}Error: Could not extract Python interpreter version from $SOURCE_FILE${NC}"
+    exit 1
+fi
+
+PYTHON_VERSION_REGEX=${PYTHON_VERSION//./\\.}
+FAILED=0
+TOTAL_CHECKS=0
+FIXED_CHECKS=0
+
+echo -e "Python interpreter version from $SOURCE_FILE: ${GREEN}$PYTHON_VERSION${NC}"
+echo ""
+
+ensure_line() {
+    local file="$1"
+    local current_pattern="$2"
+    local expected_pattern="$3"
+    local replacement="$4"
+    local description="$5"
+    local mismatched=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ ! "$line" =~ $expected_pattern ]]; then
+            mismatched=1
+        fi
+    done < <(grep -E "$current_pattern" "$file" || true)
+
+    if [ "$total" -eq 0 ]; then
+        echo -e "${RED}✗${NC} $file: could not find $description"
+        FAILED=1
+        return
+    fi
+
+    if [ "$mismatched" -eq 0 ]; then
+        echo -e "${GREEN}✓${NC} $file: $description"
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: $description"
+    else
+        echo -e "${RED}✗${NC} $file: $description is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_lock_python_requirement() {

Review Comment:
   this function plus the `PYLOCK_FILES` loop at 271-281 is dead code - no `pylock.toml` exists under `foreign/python/`, `bdd/python/`, or `examples/python/`. the active drift surface is `uv.lock`, which is handled by the separate `uv-lock-check.sh` hook. suggest dropping the function, the loop, and the three `pylock\.toml` paths from the `files:` regex in `.pre-commit-config.yaml`.



##########
scripts/ci/sync-python-version.sh:
##########
@@ -0,0 +1,301 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Default mode
+MODE=""
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Sync the Python interpreter version across SDK files, CI, and Dockerfiles"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if Python interpreter versions are synchronized"
+            echo "  --fix      Update files to use the Python interpreter version from foreign/python/pyproject.toml"
+            echo "  --help     Show this help message"
+            exit 0
+            ;;
+        *)
+            echo -e "${RED}Error: Unknown option $1${NC}"
+            echo "Use --help for usage information"
+            exit 1
+            ;;
+    esac
+done
+
+# Require mode to be specified
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+# Get the repository root (two levels up from scripts/ci/)
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+SOURCE_FILE="foreign/python/pyproject.toml"
+PYTHON_VERSION=$(sed -nE 's/^requires-python = ">=([0-9]+\.[0-9]+)".*/\1/p' "$SOURCE_FILE" | head -1)
+
+if [ -z "$PYTHON_VERSION" ]; then
+    echo -e "${RED}Error: Could not extract Python interpreter version from $SOURCE_FILE${NC}"
+    exit 1
+fi
+
+PYTHON_VERSION_REGEX=${PYTHON_VERSION//./\\.}
+FAILED=0
+TOTAL_CHECKS=0
+FIXED_CHECKS=0
+
+echo -e "Python interpreter version from $SOURCE_FILE: ${GREEN}$PYTHON_VERSION${NC}"
+echo ""
+
+ensure_line() {
+    local file="$1"
+    local current_pattern="$2"
+    local expected_pattern="$3"
+    local replacement="$4"
+    local description="$5"
+    local mismatched=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ ! "$line" =~ $expected_pattern ]]; then
+            mismatched=1
+        fi
+    done < <(grep -E "$current_pattern" "$file" || true)

Review Comment:
   `grep -E ... || true` masks ENOENT as `could not find $description`. same pattern at line 183. grep still prints `No such file or directory` to stderr so the real cause is adjacent, but a `[ -f "$file" ]` precondition would emit a clean missing-file error instead of the misleading one.



##########
scripts/ci/sync-python-version.sh:
##########
@@ -0,0 +1,301 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Default mode
+MODE=""
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Sync the Python interpreter version across SDK files, CI, and Dockerfiles"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if Python interpreter versions are synchronized"
+            echo "  --fix      Update files to use the Python interpreter version from foreign/python/pyproject.toml"
+            echo "  --help     Show this help message"
+            exit 0
+            ;;
+        *)
+            echo -e "${RED}Error: Unknown option $1${NC}"
+            echo "Use --help for usage information"
+            exit 1
+            ;;
+    esac
+done
+
+# Require mode to be specified
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+# Get the repository root (two levels up from scripts/ci/)
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+SOURCE_FILE="foreign/python/pyproject.toml"
+PYTHON_VERSION=$(sed -nE 's/^requires-python = ">=([0-9]+\.[0-9]+)".*/\1/p' "$SOURCE_FILE" | head -1)
+
+if [ -z "$PYTHON_VERSION" ]; then
+    echo -e "${RED}Error: Could not extract Python interpreter version from $SOURCE_FILE${NC}"
+    exit 1
+fi
+
+PYTHON_VERSION_REGEX=${PYTHON_VERSION//./\\.}
+FAILED=0
+TOTAL_CHECKS=0
+FIXED_CHECKS=0
+
+echo -e "Python interpreter version from $SOURCE_FILE: ${GREEN}$PYTHON_VERSION${NC}"
+echo ""
+
+ensure_line() {
+    local file="$1"
+    local current_pattern="$2"
+    local expected_pattern="$3"
+    local replacement="$4"
+    local description="$5"
+    local mismatched=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ ! "$line" =~ $expected_pattern ]]; then
+            mismatched=1
+        fi
+    done < <(grep -E "$current_pattern" "$file" || true)
+
+    if [ "$total" -eq 0 ]; then
+        echo -e "${RED}✗${NC} $file: could not find $description"
+        FAILED=1
+        return
+    fi
+
+    if [ "$mismatched" -eq 0 ]; then
+        echo -e "${GREEN}✓${NC} $file: $description"
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: $description"
+    else
+        echo -e "${RED}✗${NC} $file: $description is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_lock_python_requirement() {
+    local file="$1"
+    local current_pattern="^(requires-python = \">=)[0-9]+\\.[0-9]+(\".*)$"
+    local expected_pattern="^requires-python = \">=${PYTHON_VERSION_REGEX}\".*$"
+    local replacement="\\1${PYTHON_VERSION}\\2"
+    local first_table_line
+    local top_level_end
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    first_table_line=$(grep -n -m1 '^\[' "$file" | cut -d: -f1 || true)
+    if [ -n "$first_table_line" ]; then
+        top_level_end=$((first_table_line - 1))
+    else
+        top_level_end=$(wc -l < "$file")
+    fi
+
+    if [ "$top_level_end" -lt 1 ]; then
+        echo -e "${RED}✗${NC} $file: could not find lock file Python requirement"
+        FAILED=1
+        return
+    fi
+
+    if sed -n "1,${top_level_end}p" "$file" | grep -Eq "$expected_pattern"; then
+        echo -e "${GREEN}✓${NC} $file: lock file Python requirement"
+        return
+    fi
+
+    if ! sed -n "1,${top_level_end}p" "$file" | grep -Eq "$current_pattern"; then
+        echo -e "${RED}✗${NC} $file: could not find lock file Python requirement"
+        FAILED=1
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "1,${top_level_end}s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: lock file Python requirement"
+    else
+        echo -e "${RED}✗${NC} $file: lock file Python requirement is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_wheel_interpreters() {
+    local file="$1"
+    local target_interpreter="python${PYTHON_VERSION}"
+    local missing=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ "$line" != *"$target_interpreter"* ]]; then

Review Comment:
   substring match here has no word boundary, and same applies to the sed regex at line 197. not currently exploitable since `PYTHON_VERSION` at line 72 captures `[0-9]+\.[0-9]+` only and `python3.10` won't realistically collide with `python3.100`, but anchoring with something like `python${PYTHON_VERSION_REGEX}([^0-9]|$)` would tighten future safety.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ci(python): add interpreter version sync check [iggy]

Posted by "slbotbm (via GitHub)" <gi...@apache.org>.
slbotbm commented on code in PR #3319:
URL: https://github.com/apache/iggy/pull/3319#discussion_r3301595252


##########
scripts/ci/sync-python-version.sh:
##########
@@ -0,0 +1,301 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -euo pipefail
+
+# Colors for output
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m' # No Color
+
+# Default mode
+MODE=""
+
+# Parse arguments
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Sync the Python interpreter version across SDK files, CI, and Dockerfiles"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if Python interpreter versions are synchronized"
+            echo "  --fix      Update files to use the Python interpreter version from foreign/python/pyproject.toml"
+            echo "  --help     Show this help message"
+            exit 0
+            ;;
+        *)
+            echo -e "${RED}Error: Unknown option $1${NC}"
+            echo "Use --help for usage information"
+            exit 1
+            ;;
+    esac
+done
+
+# Require mode to be specified
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+# Get the repository root (two levels up from scripts/ci/)
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+SOURCE_FILE="foreign/python/pyproject.toml"
+PYTHON_VERSION=$(sed -nE 's/^requires-python = ">=([0-9]+\.[0-9]+)".*/\1/p' "$SOURCE_FILE" | head -1)
+
+if [ -z "$PYTHON_VERSION" ]; then
+    echo -e "${RED}Error: Could not extract Python interpreter version from $SOURCE_FILE${NC}"
+    exit 1
+fi
+
+PYTHON_VERSION_REGEX=${PYTHON_VERSION//./\\.}
+FAILED=0
+TOTAL_CHECKS=0
+FIXED_CHECKS=0
+
+echo -e "Python interpreter version from $SOURCE_FILE: ${GREEN}$PYTHON_VERSION${NC}"
+echo ""
+
+ensure_line() {
+    local file="$1"
+    local current_pattern="$2"
+    local expected_pattern="$3"
+    local replacement="$4"
+    local description="$5"
+    local mismatched=0
+    local total=0
+
+    TOTAL_CHECKS=$((TOTAL_CHECKS + 1))
+
+    while IFS= read -r line; do
+        total=$((total + 1))
+        if [[ ! "$line" =~ $expected_pattern ]]; then
+            mismatched=1
+        fi
+    done < <(grep -E "$current_pattern" "$file" || true)
+
+    if [ "$total" -eq 0 ]; then
+        echo -e "${RED}✗${NC} $file: could not find $description"
+        FAILED=1
+        return
+    fi
+
+    if [ "$mismatched" -eq 0 ]; then
+        echo -e "${GREEN}✓${NC} $file: $description"
+        return
+    fi
+
+    if [ "$MODE" = "fix" ]; then
+        sed -i -E "s|$current_pattern|$replacement|" "$file"
+        FIXED_CHECKS=$((FIXED_CHECKS + 1))
+        echo -e "${GREEN}Fixed${NC} $file: $description"
+    else
+        echo -e "${RED}✗${NC} $file: $description is not $PYTHON_VERSION"
+        FAILED=1
+    fi
+}
+
+ensure_lock_python_requirement() {

Review Comment:
   the pylock files will be added in #3318 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org