Skip to content

COMP: Auto-install pixi pre-commit env for git worktrees (supersedes #6522)#6560

Open
hjmjohnson wants to merge 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:comp-worktree-pixi-precommit-env
Open

COMP: Auto-install pixi pre-commit env for git worktrees (supersedes #6522)#6560
hjmjohnson wants to merge 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:comp-worktree-pixi-precommit-env

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Keeps the per-worktree pixi mechanism (per @thewtex on #6522) but removes the fresh-worktree trap: run-pixi-python.sh now installs the pre-commit pixi env on first use, and the contributing guide documents pixi install -e pre-commit for worktrees. Supersedes #6522.

Details
  • Utilities/Hooks/run-pixi-python.sh: when ./.pixi/envs/pre-commit is missing and pixi is on PATH, runs pixi install -e pre-commit before resolving the interpreter; if it still cannot resolve, the error message names the exact command to run instead of the bare "Python executable not found".
  • Documentation/docs/contributing/index.md: notes that each additional git worktree needs pixi install -e pre-commit once, since the commit-msg hooks resolve the pixi env relative to the checkout root.
  • Unlike COMP: Run kw commit-msg hooks via pre-commit-managed Python #6522, this does not move the hooks to language: python, so no system Python is assumed (the Windows concern raised by @blowekamp and @thewtex).

Verified locally in a fresh worktree with .pixi/envs/pre-commit deleted: the launcher auto-installed the env and both kw commit-msg hooks passed during a real git commit.

The launcher resolves ./.pixi/envs/pre-commit relative to the checkout
root, and pixi envs are per-worktree, so kw commit-msg hooks failed in
fresh git worktrees. Install the env on first use when pixi is
available; otherwise name the command to run.
@github-actions github-actions Bot added type:Compiler Compiler support or related warnings type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:Python wrapping Python bindings for a class area:Documentation Issues affecting the Documentation module labels Jul 6, 2026
@hjmjohnson hjmjohnson marked this pull request as ready for review July 6, 2026 21:59
@greptile-apps

greptile-apps Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates the Pixi-backed commit-message hook flow for git worktrees. The main changes are:

  • Auto-installs the pre-commit Pixi environment when the hook launcher first needs it.
  • Keeps hook execution tied to the checkout-local Pixi environment.
  • Documents the one-time pixi install -e pre-commit setup step for additional git worktrees.

Confidence Score: 5/5

Safe to merge with minimal risk.

The changes are small, scoped to the hook launcher and matching documentation, and preserve a clear failure path when the Pixi environment cannot be created or found.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex ran the requested verification by performing the general contract validation for the PR.
  • T-Rex observed that local artifact references were not uploaded alongside the verification results.

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
Utilities/Hooks/run-pixi-python.sh Adds first-use provisioning of the per-worktree pre-commit Pixi environment before executing hook Python scripts; no blocking issues found.
Documentation/docs/contributing/index.md Documents the per-worktree pixi install -e pre-commit setup step and adds the relevant link references; no issues found.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Git as git commit
participant PC as pre-commit hook
participant Launcher as run-pixi-python.sh
participant Pixi as pixi
participant Py as pre-commit Python env

Git->>PC: run commit-msg hooks
PC->>Launcher: invoke hook script
Launcher->>Launcher: resolve .pixi/envs/pre-commit Python
alt Python executable missing and pixi is available
    Launcher->>Pixi: pixi install -e pre-commit
    Pixi-->>Launcher: environment installed or install failed
end
alt Python executable exists
    Launcher->>Py: exec target hook script
    Py-->>Git: hook result
else Python executable still missing
    Launcher-->>Git: error with install command
end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Git as git commit
participant PC as pre-commit hook
participant Launcher as run-pixi-python.sh
participant Pixi as pixi
participant Py as pre-commit Python env

Git->>PC: run commit-msg hooks
PC->>Launcher: invoke hook script
Launcher->>Launcher: resolve .pixi/envs/pre-commit Python
alt Python executable missing and pixi is available
    Launcher->>Pixi: pixi install -e pre-commit
    Pixi-->>Launcher: environment installed or install failed
end
alt Python executable exists
    Launcher->>Py: exec target hook script
    Py-->>Git: hook result
else Python executable still missing
    Launcher-->>Git: error with install command
end
Loading

Reviews (1): Last reviewed commit: "DOC: Document pixi pre-commit env setup ..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Documentation Issues affecting the Documentation module area:Python wrapping Python bindings for a class type:Compiler Compiler support or related warnings type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant