-
Notifications
You must be signed in to change notification settings - Fork 29
[RHAIENG-4578] ISSUE #3032: chore(uv): pin uv version to fix CI check-generated-code failure (#3034) #2138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RHAIENG-4578] ISSUE #3032: chore(uv): pin uv version to fix CI check-generated-code failure (#3034) #2138
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -15,13 +15,17 @@ jobs: | |||
| - uses: actions/checkout@v6 | ||||
|
|
||||
| # https://github.com/astral-sh/setup-uv | ||||
| - name: Install the latest version of uv | ||||
| - name: Install uv | ||||
| uses: astral-sh/setup-uv@v7 | ||||
| with: | ||||
| version: "latest" | ||||
| python-version: "3.14" | ||||
| version-file: uv.toml | ||||
| enable-cache: true | ||||
| cache-dependency-glob: "uv.lock" | ||||
|
|
||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove trailing whitespace at Line 24. This matches the lint failure reported by static analysis. Proposed fix-
+📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: code-static-analysis[failure] 24-24: 🤖 Prompt for AI Agents |
||||
| - name: Install Python | ||||
| uses: actions/setup-python@v6 | ||||
| with: | ||||
| python-version: "3.14" | ||||
|
|
||||
| - name: Rerun all code generators we have | ||||
| run: bash ci/generate_code.sh | ||||
|
|
@@ -44,10 +48,10 @@ jobs: | |||
| - uses: actions/checkout@v6 | ||||
|
|
||||
| # https://github.com/astral-sh/setup-uv | ||||
| - name: Install the latest version of uv | ||||
| - name: Install uv | ||||
| uses: astral-sh/setup-uv@v7 | ||||
| with: | ||||
| version: "latest" | ||||
| version-file: uv.toml | ||||
| python-version: "3.14" | ||||
| enable-cache: true | ||||
| cache-dependency-glob: "uv.lock" | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -19,13 +19,17 @@ jobs: | |||
| - uses: actions/checkout@v6 | ||||
|
|
||||
| # https://github.com/astral-sh/setup-uv | ||||
| - name: Install the latest version of uv | ||||
| - name: Install uv | ||||
| uses: astral-sh/setup-uv@v7 | ||||
| with: | ||||
| version: "latest" | ||||
| python-version: "3.14" | ||||
| version-file: uv.toml | ||||
| enable-cache: true | ||||
| cache-dependency-glob: "uv.lock" | ||||
|
|
||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove trailing whitespace at Line 28 to keep lint green. This matches the current static-analysis failure and can block CI. Proposed fix-
+📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: code-static-analysis[failure] 28-28: 🤖 Prompt for AI Agents |
||||
| - name: Install Python | ||||
| uses: actions/setup-python@v6 | ||||
| with: | ||||
| python-version: "3.14" | ||||
|
|
||||
| - name: Run the release notes script | ||||
| run: | | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -461,7 +461,7 @@ refresh-pipfilelock-files: | |
| echo "Updating $(PYTHON_VERSION) uv.lock in $$dir" | ||
| cd $$dir | ||
| if [ -f "pyproject.toml" ]; then | ||
| uv lock && rm uv.lock | ||
| $(ROOT_DIR)/uv lock && rm uv.lock | ||
| else | ||
| echo "No pyproject.toml found in $$dir, skipping." | ||
| fi | ||
|
|
@@ -526,4 +526,4 @@ print-release: | |
| .PHONY: test | ||
| test: | ||
| @echo "Running quick static tests" | ||
| uv run pytest -m 'not buildonlytest' | ||
| ./uv run pytest -m 'not buildonlytest' | ||
|
Comment on lines
527
to
+529
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Propagate At Line 529, 🔧 Suggested fix+KONFLUX ?= false
+
.PHONY: test
test:
`@echo` "Running quick static tests"
- ./uv run pytest -m 'not buildonlytest'
+ KONFLUX="$(KONFLUX)" "$(ROOT_DIR)/uv" run pytest -m 'not buildonlytest'As per coding guidelines, Ensure the 🧰 Tools🪛 GitHub Actions: Code static analysis[error] 528-528: Command 'make test' failed with exit code 2 due to pytest error during test collection. 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,17 +62,49 @@ Note: To ensure the GitHub Action runs successfully, users must add a `GH_ACCESS | |
|
|
||
| #### Prepare Python + uv + pytest env | ||
|
|
||
| This project pins its uv version in `uv.toml` (`required-version`). | ||
| Use the `./uv` wrapper script at the repo root — it reads the pinned | ||
| version and runs it via `uvx`, so your system uv version doesn't matter: | ||
|
|
||
| ```shell | ||
| # Linux | ||
| sudo dnf install python3.14 | ||
| pip install --user uv | ||
| # MacOS | ||
| # macOS | ||
| brew install python@3.14 uv | ||
|
|
||
| uv venv --python $(which python3.14) | ||
| uv sync --locked | ||
| ./uv venv --python $(which python3.14) | ||
| ./uv sync --locked | ||
| ``` | ||
|
|
||
| <details> | ||
| <summary>Alternatives to <code>./uv</code></summary> | ||
|
|
||
| The `./uv` wrapper is the recommended way, but you can also | ||
| (replace `0.10.6` below with the version from `uv.toml`): | ||
|
|
||
| - **Use `uvx` directly** with an explicit version: | ||
| ```shell | ||
| uvx uv@0.10.6 sync --locked | ||
| ``` | ||
| - **Use `uv tool run`** (equivalent, longer form): | ||
| ```shell | ||
| uv tool run uv@0.10.6 sync --locked | ||
| ``` | ||
| - **Install the exact version** so `uv` works directly: | ||
| ```shell | ||
| # Standalone installer (any OS) | ||
| curl -LsSf https://astral.sh/uv/0.10.6/install.sh | sh | ||
| # Or with pip | ||
| pip install uv==0.10.6 | ||
| ``` | ||
|
Comment on lines
+84
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update hardcoded uv version examples to match the current pin. Line 84/88/92/97/99 still use 📝 Suggested doc fix-The `./uv` wrapper is the recommended way, but you can also
-(replace `0.10.6` below with the version from `uv.toml`):
+The `./uv` wrapper is the recommended way, but you can also
+(commands below use the current pinned version from `uv.toml`):
@@
- uvx uv@0.10.6 sync --locked
+ uvx uv@0.8.12 sync --locked
@@
- uv tool run uv@0.10.6 sync --locked
+ uv tool run uv@0.8.12 sync --locked
@@
- curl -LsSf https://astral.sh/uv/0.10.6/install.sh | sh
+ curl -LsSf https://astral.sh/uv/0.8.12/install.sh | sh
@@
- pip install uv==0.10.6
+ pip install uv==0.8.12🤖 Prompt for AI Agents |
||
|
|
||
| If your system uv matches the pinned version, you can use `uv` directly — | ||
| `required-version` in `uv.toml` will let it through. If it doesn't match, | ||
| uv exits with a clear error telling you which version is required. | ||
|
|
||
| </details> | ||
|
|
||
| #### Running Python selftests in Pytest | ||
| By completing configuration in previous section, you are able to run any tests that don't need to start a container using following command: | ||
|
|
||
|
|
@@ -106,15 +138,15 @@ sudo dnf install podman | |
| systemctl --user start podman.service | ||
| systemctl --user status podman.service | ||
| systemctl --user status podman.socket | ||
| DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock uv run pytest tests/containers -m 'not openshift and not cuda and not rocm' --image quay.io/opendatahub/workbench-images@sha256:e98d19df346e7abb1fa3053f6d41f0d1fa9bab39e49b4cb90b510ca33452c2e4 | ||
| DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock ./uv run pytest tests/containers -m 'not openshift and not cuda and not rocm' --image quay.io/opendatahub/workbench-images@sha256:e98d19df346e7abb1fa3053f6d41f0d1fa9bab39e49b4cb90b510ca33452c2e4 | ||
|
|
||
| # Mac OS | ||
| brew install podman | ||
| podman machine init | ||
| podman machine set --rootful=false | ||
| sudo podman-mac-helper install | ||
| podman machine start | ||
| uv run pytest tests/containers -m 'not openshift' --image quay.io/opendatahub/workbench-images@sha256:e98d19df346e7abb1fa3053f6d41f0d1fa9bab39e49b4cb90b510ca33452c2e4 | ||
| ./uv run pytest tests/containers -m 'not openshift' --image quay.io/opendatahub/workbench-images@sha256:e98d19df346e7abb1fa3053f6d41f0d1fa9bab39e49b4cb90b510ca33452c2e4 | ||
| ``` | ||
|
|
||
| When using lima on macOS, it might be useful to give yourself access to rootful podman socket | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| #!/usr/bin/env bash | ||
| set -Eeuxo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" | ||
|
|
||
| uv --version || pip install "uv==0.8.12" | ||
|
|
||
| uv run scripts/dockerfile_fragments.py | ||
| "${REPO_ROOT}/uv" run scripts/dockerfile_fragments.py | ||
| "${REPO_ROOT}/uv" run manifests/tools/generate_kustomization.py | ||
| bash scripts/pylocks_generator.sh |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,10 @@ | ||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||
| set -Eeuxo pipefail | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| error() { | ||||||||||||||||||||||||
| printf '%s\n' "$*" >&2 | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Red Hat's build tooling depends on requirements.txt files with hashes | ||||||||||||||||||||||||
| # Namely, Konflux (https://konflux-ci.dev/), and Cachi2 (https://github.com/containerbuildsystem/cachi2). | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
@@ -9,6 +13,12 @@ set -Eeuxo pipefail | |||||||||||||||||||||||
| # ground-up relock and force upgrades using `uv pip compile --upgrade`. | ||||||||||||||||||||||||
| # This is intended for scheduled runs, while manual runs should default to off. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||||||||||||||||||||||||
| ROOT_DIR="$(dirname "$SCRIPT_DIR")" | ||||||||||||||||||||||||
| # Default to the repo-root ./uv wrapper; override with UV=/path/to/your/wrapper | ||||||||||||||||||||||||
| UV="${UV:-$ROOT_DIR/uv}" | ||||||||||||||||||||||||
| export UV | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ADDITIONAL_UV_FLAGS="" | ||||||||||||||||||||||||
| for arg in "$@"; do | ||||||||||||||||||||||||
| case "$arg" in | ||||||||||||||||||||||||
|
|
@@ -23,12 +33,35 @@ if [[ "${FORCE_LOCKFILES_UPGRADE:-0}" == "1" ]]; then | |||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
| export ADDITIONAL_UV_FLAGS | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if [[ ! -x "$UV" ]]; then | ||||||||||||||||||||||||
| error "Expected uv wrapper at '$UV' but it is missing or not executable." | ||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if ! command -v uv &>/dev/null; then | ||||||||||||||||||||||||
| error "uv command not found. Please install uv: https://github.com/astral-sh/uv" | ||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| UV_MIN_VERSION="0.4.0" | ||||||||||||||||||||||||
| UV_VERSION=$("$UV" --version 2>/dev/null | awk '{print $2}' || echo "0.0.0") | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| version_ge() { | ||||||||||||||||||||||||
| [ "$(printf '%s\n' "$2" "$1" | sort -V | head -n1)" = "$2" ] | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if ! version_ge "$UV_VERSION" "$UV_MIN_VERSION"; then | ||||||||||||||||||||||||
| error "uv version $UV_VERSION found, but >= $UV_MIN_VERSION is required." | ||||||||||||||||||||||||
| error "Please upgrade uv: https://github.com/astral-sh/uv" | ||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # The following will create a pylock.toml file for every pyproject.toml we have. | ||||||||||||||||||||||||
| uv --version || pip install "uv==0.8.12" | ||||||||||||||||||||||||
| ${UV} --version | ||||||||||||||||||||||||
| find . -name pylock.toml -execdir bash -c ' | ||||||||||||||||||||||||
| pwd | ||||||||||||||||||||||||
| # derives python-version from directory suffix (e.g., "ubi9-python-3.12") | ||||||||||||||||||||||||
| uv pip compile pyproject.toml \ | ||||||||||||||||||||||||
| ${UV} pip compile pyproject.toml \ | ||||||||||||||||||||||||
|
Comment on lines
+60
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Verify current call sites and quoting in the changed region
nl -ba scripts/sync-python-lockfiles.sh | sed -n '56,72p'Repository: red-hat-data-services/notebooks Length of output: 117 🏁 Script executed: cat -n scripts/sync-python-lockfiles.sh | head -75 | tail -25Repository: red-hat-data-services/notebooks Length of output: 1024 🏁 Script executed: cat -n scripts/sync-python-lockfiles.sh | head -80 | head -40Repository: red-hat-data-services/notebooks Length of output: 1445 🏁 Script executed: cat -n scripts/sync-python-lockfiles.sh | grep -E '\$UV|${UV}'Repository: red-hat-data-services/notebooks Length of output: 418 🏁 Script executed: cat -n scripts/sync-python-lockfiles.sh | sed -n '55,75p'Repository: red-hat-data-services/notebooks Length of output: 771 🏁 Script executed: cat -n scripts/sync-python-lockfiles.sh | wc -lRepository: red-hat-data-services/notebooks Length of output: 77 Quote Lines 60 and 64 invoke 🔧 Suggested hardening-${UV} --version
+"$UV" --version
@@
- ${UV} pip compile pyproject.toml \
+ "$UV" pip compile pyproject.toml \📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| --output-file pylock.toml \ | ||||||||||||||||||||||||
| --format pylock.toml \ | ||||||||||||||||||||||||
| --generate-hashes \ | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing whitespace at Line 251.
This is currently reported by static analysis and should be cleaned up.
Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 GitHub Check: code-static-analysis
[failure] 251-251:
251:1 [trailing-spaces] trailing spaces
🤖 Prompt for AI Agents