File size: 2,242 Bytes
0109502 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # One-time setup for Windows.
#
# Creates an isolated virtual environment INSIDE this project folder
# (.venv\) and installs the pipeline's dependencies into it. This never
# touches your system Python, any other project's packages, or anything
# outside this folder — deleting the project folder removes everything
# this script installed (except Gitleaks, which is a separate one-time
# system tool; see the message at the end).
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ProjectDir = Split-Path -Parent $ScriptDir
Set-Location $ProjectDir
$pythonCmd = Get-Command python -ErrorAction SilentlyContinue
if (-not $pythonCmd) {
Write-Host "ERROR: python not found on PATH. Install Python 3.10+ from https://www.python.org/downloads/ (check 'Add python.exe to PATH' during install)."
exit 1
}
Write-Host "Using $(python --version)"
if (-not (Test-Path ".venv")) {
Write-Host "Creating isolated virtual environment in .venv\ ..."
python -m venv .venv
} else {
Write-Host ".venv\ already exists — reusing it."
}
& .\.venv\Scripts\Activate.ps1
Write-Host "Installing dependencies into .venv\ (this does not touch system Python) ..."
pip install --quiet --upgrade pip
pip install --quiet -r requirements.txt
if (-not (Test-Path ".env")) {
Copy-Item ".env.example" ".env"
Write-Host "Created .env from .env.example — edit it and fill in NIM_API_KEY, NIM_BASE_URL, NIM_MODEL."
} else {
Write-Host ".env already exists — leaving it alone."
}
Write-Host ""
Write-Host "Checking for Gitleaks (required unless you deliberately set ALLOW_MISSING_GITLEAKS=1) ..."
$gitleaksCmd = Get-Command gitleaks -ErrorAction SilentlyContinue
if ($gitleaksCmd) {
Write-Host " Found: $(gitleaks version)"
} else {
Write-Host " NOT found. Install it (one-time, system-level, like installing any CLI tool):"
Write-Host " winget install gitleaks"
Write-Host " (or see https://github.com/gitleaks/gitleaks#installing)"
Write-Host " Until it's installed, real runs will refuse to start (fails closed by design)."
}
Write-Host ""
Write-Host "Setup complete."
Write-Host "Next: edit .env with your NIM credentials, then run scripts\run_daily.ps1"
|