From 2f8680ac3d4866c31fff55d10fae6e8ddea9cc78 Mon Sep 17 00:00:00 2001 From: nose Date: Wed, 24 Dec 2025 03:29:45 -0800 Subject: [PATCH] bootstrap: prompt to install in editable mode when run interactively inside git checkout (default yes) --- scripts/bootstrap.ps1 | 15 +++++++++++++++ scripts/bootstrap.sh | 13 ++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index e502024..cc29422 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -144,6 +144,21 @@ if (-not (Test-Path $venvPython)) { Write-Log "Created venv but could not find p Write-Log "Using venv python: $venvPython" if (-not $NoInstall) { + # Suggest editable install for development checkouts (interactive git clones) + if (-not $Editable) { + $isGit = $false + try { + if (Test-Path (Join-Path $repoRoot '.git')) { $isGit = $true } + elseif ((Get-Command git -ErrorAction SilentlyContinue) -ne $null) { + try { $gitOut = & git -C $repoRoot rev-parse --is-inside-work-tree 2>$null; if ($gitOut -eq 'true') { $isGit = $true } } catch {} + } + } catch {} + if ($isGit -and -not $Quiet) { + $ans = Read-Host "It looks like this is a development checkout (git repo). Install project in editable mode for development? (Y/n)" + if ($ans -eq '' -or $ans -eq 'y' -or $ans -eq 'Y') { $Editable = $true; Write-Log "Selected editable install for development." "INFO" } + } + } + Write-Log "Upgrading pip, setuptools, wheel" try { & $venvPython -m pip install -U pip setuptools wheel } catch { Write-Log "pip upgrade failed: $_" "ERROR"; exit 5 } diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 4553a22..94e1444 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -258,7 +258,18 @@ if [[ ! -x "$VENV_PY" ]]; then exit 3 fi -if [[ "$NOINSTALL" != "true" ]]; then +if [[ "$NOINSTALL" != "true" ]]; then # If not explicitly requested, suggest editable install for development checkouts + if [[ "$EDITABLE" != "true" ]]; then + if [[ -d "$REPO/.git" ]] || git -C "$REPO" rev-parse --is-inside-work-tree >/dev/null 2>&1; then + if [[ "$QUIET" != "true" && -t 0 ]]; then + read -p "It looks like this is a development checkout (git repo). Install project in editable mode for development? (Y/n) " devans + if [[ -z "$devans" || "$devans" == "y" || "$devans" == "Y" ]]; then + EDITABLE=true + echo "Selected: editable install for development" + fi + fi + fi + fi echo "Upgrading pip, setuptools, wheel..." "$VENV_PY" -m pip install -U pip setuptools wheel