Solidify the Python test-env path so any agent (Claude / Codex) or
human can bootstrap with one command, and so the global preflight
skill's pip-audit branch actually runs against this repo.
scripts/bootstrap_test_env.{ps1,sh}: one-liner per platform, idempotent
(no-op if .venv exists, --force / -Force to recreate), upgrades pip,
installs project + test extras.
pyproject.toml: add pip-audit>=2.7 to [project.optional-dependencies]
test so /preflight's Python audit branch lights up.
CLAUDE.md, Hard rules: replace the inline venv-bootstrap command with
a reference to the platform script.
AGENTS.md: short "Test Environment Bootstrap" pointer (mirrors CLAUDE.md
per the Claude/Codex symmetry rule).
.gitattributes: enforce LF for *.sh (otherwise Windows CRLF breaks the
bash shebang on POSIX) and CRLF for *.ps1 (Windows convention).
Triggered by the warmup-skill Python detection added in agent-playbooks
PR #34 — projects now need a clean bootstrap path for the new check to
have a recommended remediation.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
30 lines
826 B
PowerShell
30 lines
826 B
PowerShell
# Bootstrap a repo-local .venv and install test dependencies.
|
|
# Idempotent — no-op if .venv already exists. Pass -Force to recreate.
|
|
#
|
|
# Usage: scripts\bootstrap_test_env.ps1 [-Force]
|
|
|
|
param([switch]$Force)
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
if (Test-Path .venv) {
|
|
if (-not $Force) {
|
|
Write-Host ".venv already exists. Pass -Force to recreate."
|
|
exit 0
|
|
}
|
|
Write-Host "Removing existing .venv ..."
|
|
Remove-Item -Recurse -Force .venv
|
|
}
|
|
|
|
Write-Host "Creating .venv ..."
|
|
python -m venv .venv
|
|
|
|
Write-Host "Upgrading pip ..."
|
|
.\.venv\Scripts\python -m pip install --quiet --upgrade pip
|
|
|
|
Write-Host "Installing project + test extras ..."
|
|
.\.venv\Scripts\python -m pip install --quiet -e ".[test]"
|
|
|
|
Write-Host ""
|
|
Write-Host "Test env ready. Run tests with:"
|
|
Write-Host " .\.venv\Scripts\python -m pytest"
|