This is an automated email from the ASF dual-hosted git repository.

piotr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/master by this push:
     new 3863ad5b5 chore(ci): add uv lock check to pre-commit hooks (#2996)
3863ad5b5 is described below

commit 3863ad5b55d0dc01dcc950476e2a2c3f4ef179be
Author: Hubert Gruszecki <[email protected]>
AuthorDate: Fri Mar 20 18:17:58 2026 +0100

    chore(ci): add uv lock check to pre-commit hooks (#2996)
    
    Stale uv.lock files went unnoticed across multiple version
    bumps (e.g. foreign/python stuck at 0.7.2.dev1 when the
    version was already 0.7.3.dev1). Add a pre-commit hook
    that runs uv lock --check on all Python directories and
    auto-regenerates stale lock files.
---
 .pre-commit-config.yaml     |  8 ++++
 bdd/python/uv.lock          |  2 +-
 examples/python/uv.lock     |  8 ++--
 foreign/python/uv.lock      |  2 +-
 scripts/ci/uv-lock-check.sh | 98 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 113 insertions(+), 5 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 0712dc663..bf0c242cf 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -87,6 +87,14 @@ repos:
         files: ^foreign/python/(Cargo\.toml|pyproject\.toml)$
         pass_filenames: false
 
+      - id: uv-lock-check
+        name: uv lock check
+        entry: ./scripts/ci/uv-lock-check.sh
+        args: ["--fix"]
+        language: system
+        files: ^(foreign|bdd|examples)/python/(pyproject\.toml|uv\.lock)$
+        pass_filenames: false
+
       - id: trailing-whitespace
         name: trailing whitespace
         entry: ./scripts/ci/trailing-whitespace.sh
diff --git a/bdd/python/uv.lock b/bdd/python/uv.lock
index 380b63502..e3d0aa275 100644
--- a/bdd/python/uv.lock
+++ b/bdd/python/uv.lock
@@ -4,7 +4,7 @@ requires-python = ">=3.10"
 
 [[package]]
 name = "apache-iggy"
-version = "0.7.2.dev1"
+version = "0.7.3.dev1"
 source = { directory = "../../foreign/python" }
 
 [package.metadata]
diff --git a/examples/python/uv.lock b/examples/python/uv.lock
index f26eac111..9151f6941 100644
--- a/examples/python/uv.lock
+++ b/examples/python/uv.lock
@@ -4,13 +4,13 @@ requires-python = ">=3.10"
 
 [[package]]
 name = "apache-iggy"
-version = "0.7.0"
+version = "0.7.3.dev1"
 source = { directory = "../../foreign/python" }
 
 [package.metadata]
 requires-dist = [
-    { name = "black", marker = "extra == 'all'", specifier = ">=23.0,<25.0" },
-    { name = "black", marker = "extra == 'dev'", specifier = ">=23.0,<25.0" },
+    { name = "black", marker = "extra == 'all'", specifier = ">=23.0,<27.0" },
+    { name = "black", marker = "extra == 'dev'", specifier = ">=23.0,<27.0" },
     { name = "isort", marker = "extra == 'all'", specifier = ">=5.12.0,<6.0" },
     { name = "isort", marker = "extra == 'dev'", specifier = ">=5.12.0,<6.0" },
     { name = "loguru", marker = "extra == 'all'", specifier = ">=0.7.0,<1.0" },
@@ -22,6 +22,8 @@ requires-dist = [
     { name = "pytest", marker = "extra == 'testing'", specifier = ">=7.0,<9.0" 
},
     { name = "pytest-asyncio", marker = "extra == 'all'", specifier = 
">=0.21.0,<1.0" },
     { name = "pytest-asyncio", marker = "extra == 'testing'", specifier = 
">=0.21.0,<1.0" },
+    { name = "pytest-cov", marker = "extra == 'all'", specifier = ">=4.0,<7.0" 
},
+    { name = "pytest-cov", marker = "extra == 'testing'", specifier = 
">=4.0,<7.0" },
     { name = "pytest-timeout", marker = "extra == 'all'", specifier = 
">=2.0,<3.0" },
     { name = "pytest-timeout", marker = "extra == 'testing'", specifier = 
">=2.0,<3.0" },
     { name = "pytest-xdist", marker = "extra == 'all'", specifier = 
">=3.0,<4.0" },
diff --git a/foreign/python/uv.lock b/foreign/python/uv.lock
index 9565f48ca..e17b932d8 100644
--- a/foreign/python/uv.lock
+++ b/foreign/python/uv.lock
@@ -4,7 +4,7 @@ requires-python = ">=3.10"
 
 [[package]]
 name = "apache-iggy"
-version = "0.7.2.dev1"
+version = "0.7.3.dev1"
 source = { editable = "." }
 
 [package.optional-dependencies]
diff --git a/scripts/ci/uv-lock-check.sh b/scripts/ci/uv-lock-check.sh
new file mode 100755
index 000000000..42cfd6778
--- /dev/null
+++ b/scripts/ci/uv-lock-check.sh
@@ -0,0 +1,98 @@
+#!/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
+
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+NC='\033[0m'
+
+MODE=""
+
+while [[ $# -gt 0 ]]; do
+    case $1 in
+        --check)
+            MODE="check"
+            shift
+            ;;
+        --fix)
+            MODE="fix"
+            shift
+            ;;
+        --help|-h)
+            echo "Usage: $0 [--check|--fix]"
+            echo ""
+            echo "Verify uv.lock files are up to date with their 
pyproject.toml"
+            echo ""
+            echo "Options:"
+            echo "  --check    Check if lock files are up to date"
+            echo "  --fix      Regenerate stale lock files"
+            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
+
+if [ -z "$MODE" ]; then
+    echo -e "${RED}Error: Please specify either --check or --fix${NC}"
+    echo "Use --help for usage information"
+    exit 1
+fi
+
+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cd "$REPO_ROOT"
+
+PYTHON_DIRS=(
+    "foreign/python"
+    "bdd/python"
+    "examples/python"
+)
+
+FAILED=0
+
+for dir in "${PYTHON_DIRS[@]}"; do
+    if [ ! -f "$dir/uv.lock" ]; then
+        continue
+    fi
+
+    if (cd "$dir" && uv lock --check 2>/dev/null); then
+        echo -e "${GREEN}$dir/uv.lock is up to date${NC}"
+    else
+        if [ "$MODE" = "check" ]; then
+            echo -e "${RED}$dir/uv.lock is out of date${NC}"
+            FAILED=1
+        else
+            echo -e "${YELLOW}$dir/uv.lock is out of date, 
regenerating...${NC}"
+            (cd "$dir" && uv lock 2>/dev/null)
+            echo -e "${GREEN}$dir/uv.lock updated${NC}"
+        fi
+    fi
+done
+
+if [ "$FAILED" -ne 0 ]; then
+    echo ""
+    echo -e "${RED}Some uv.lock files are out of date${NC}"
+    echo -e "${YELLOW}Run '$0 --fix' to fix this automatically${NC}"
+    exit 1
+fi

Reply via email to