build: migrate codespell and gitlint from pip to uvx#7829
build: migrate codespell and gitlint from pip to uvx#7829cblecker wants to merge 1 commit intoopenshift:mainfrom
Conversation
Replace pip-based installation of codespell and gitlint with uvx, which runs tools in ephemeral cached environments without creating local dist directories or polluting system packages. Signed-off-by: Christoph Blecker <cblecker@redhat.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Please specify an area label DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
WalkthroughThe Makefile is refactored to use UVX as a universal tool invoker for external utilities (codespell, gitlint) instead of direct command calls. Legacy tool build targets are removed, and merge-base computation for non-PR scenarios is expanded to consider additional remote branches. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: cblecker The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Makefile`:
- Around line 382-383: The Makefile target verify-codespell currently uses an
invalid UVX version specifier "(UVX) codespell==$(CODESPELL_VER)"; update the
invocation in the verify-codespell recipe to use a valid UVX pinning form —
either call UVX with the direct command form $(UVX) codespell@$(CODESPELL_VER)
or use the PEP 508 form $(UVX) --from 'codespell==$(CODESPELL_VER)' codespell —
referencing the verify-codespell target and the UVX and CODESPELL_VER variables
when making the change.
ℹ️ Review info
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (1)
Makefile
| verify-codespell: ## Verify codespell. | ||
| @$(UVX) codespell==$(CODESPELL_VER) --count --ignore-words=./.codespellignore --skip="./docs/site/*,./vendor/*,./api/vendor/*,./hack/tools/vendor/*,./api/hypershift/v1alpha1/*,./support/thirdparty/*,./docs/content/reference/*,./hack/tools/bin/*,./cmd/install/assets/*,./go.sum,./hack/workspace/go.work.sum,./api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests,./hack/tools/go.mod,./hack/tools/go.sum,./karpenter-operator/controllers/karpenter/assets/*.yaml,./dev/*" |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
uvx version specifier syntax @ == documentation
💡 Result:
In uvx (alias of uv tool run), @ and == apply in different places:
-
command@<version>(uvx shorthand) = exact tool version only
Use this when the command name itself includes a pinned version, e.g.uvx ruff@0.6.0 check. The docs note this form and that@is for an exact version (and@latestis also supported). [2] -
--from/--withuse standard Python dependency specifiers (PEP 508), e.g.==, ranges, extras
Examples:uvx --from 'ruff==0.3.0' ruff checkuvx --from 'ruff>0.2.0,<0.3.0' ruff checkuvx --from 'mypy[faster-cache,reports]==1.13.0' mypy ...
This is standard “dependency specifier” syntax (name[extras] ==1.2.3,>=,<,!=, etc.). [2][3]
-
CLI reference confirms
commandmay include<package>@<version>(for the command token), anduvxbehavior matchesuv tool run. [1]
If you’re trying something like --with "pkg@1.2.3", that typically won’t parse as a version pin—use --with "pkg==1.2.3" instead. (This mismatch is also discussed in uv’s issue tracker.) [4]
Sources: uv CLI reference [1], uv “Using tools” guide [2], uv dependency specifiers (PEP 508) docs [3], GitHub issue discussion [4].
Fix uvx version specifier syntax.
uvx version pinning uses either @ for the direct command form (e.g., uvx codespell@2.4.1) or PEP 508 specifiers with the --from flag (e.g., uvx --from 'codespell==2.4.1' codespell). The current form $(UVX) codespell==$(CODESPELL_VER) mixes both approaches and will not work. Use either $(UVX) codespell@$(CODESPELL_VER) or $(UVX) --from 'codespell==$(CODESPELL_VER)' codespell.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Makefile` around lines 382 - 383, The Makefile target verify-codespell
currently uses an invalid UVX version specifier "(UVX)
codespell==$(CODESPELL_VER)"; update the invocation in the verify-codespell
recipe to use a valid UVX pinning form — either call UVX with the direct command
form $(UVX) codespell@$(CODESPELL_VER) or use the PEP 508 form $(UVX) --from
'codespell==$(CODESPELL_VER)' codespell — referencing the verify-codespell
target and the UVX and CODESPELL_VER variables when making the change.
|
@cblecker: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
Verify is failing |
Install uv via pip in the custom-verify-src dockerfile_literal so that the hypershift verify job can use uvx for codespell and gitlint (openshift/hypershift#7829). Assisted-by: Claude:claude-opus-4-6
|
@bryan-cox This would need openshift/release#75848 as a pre-requisite |
|
Stale PRs are closed after 21d of inactivity. If this PR is still relevant, comment to refresh it or remove the stale label. If this PR is safe to close now please do so with /lifecycle stale |
|
There it is. The I now have all the evidence for a complete root cause analysis. Test Failure Analysis CompleteJob Information
Test Failure AnalysisErrorSummaryPR #7829 migrated the Root CauseThe FROM base
RUN dnf install -y python3-pipThis image is based on PR #7829 changed the Makefile to replace: # Before: pip-installed codespell binary
verify-codespell: codespell
@$(CODESPELL) --count ...with: # After: uvx-invoked codespell
verify-codespell:
@$(UVX) codespell==$(CODESPELL_VER) --count ...where The fix requires either updating the Recommendations
Evidence
|
What this PR does / why we need it:
Migrates codespell and gitlint from
pip install --targettouvx, which runs Python tools in ephemeral, cached environments.Before:
pip installcreated local*_dist/directories underhack/tools/bin/, required shuffling binaries around, and could conflict with system Python.After:
uvxhandles tool installation transparently with zero side effects. No local dist directories, no pip invocations.Changes:
UVX ?= uvxvariable (overridable)$(CODESPELL)/$(GITLINT)invocations with$(UVX) codespell==/$(UVX) gitlint-core==codespellandgitlintinstallation prerequisites and build targets./hack/tools/bin/codespell_distfrom the codespell skip list (no longer exists)Which issue(s) this PR fixes:
Special notes for your reviewer:
gitlintCLI via uvx isgitlint-core, notgitlintcodespell==2.4.1,gitlint-core==0.19.1)UVXvariable is overridable (UVX ?= uvx) for CI environmentsChecklist:
Summary by CodeRabbit
Chores