This commit is contained in:
saqib mir
2026-05-27 12:48:07 +05:30
+27 -1
View File
@@ -17,7 +17,33 @@ if ($Port -le 0) {
Write-Host "Starting FastAPI Gateway local dev server on port $Port..." -ForegroundColor Cyan
Push-Location $gatewayDir
try {
# Check if virtual environment exists, if not, bootstrap it
if (-not (Test-Path ".venv")) {
Write-Host "Python virtual environment not found. Bootstrapping gateway environment..." -ForegroundColor Yellow
# Verify Python is installed
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
Write-Error "Python was not found on your PATH. Please install Python 3.11+ and try again."
return
}
Write-Host "Creating virtual environment in $gatewayDir\.venv..." -ForegroundColor Yellow
& python -m venv .venv
if ($LASTEXITCODE -ne 0 -or -not (Test-Path ".venv")) {
Write-Error "Failed to create Python virtual environment."
return
}
Write-Host "Installing gateway dependencies (pip install -e '.[dev]')..." -ForegroundColor Yellow
& .venv\Scripts\pip install -e ".[dev]"
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to install gateway dependencies."
return
}
Write-Host "Bootstrap complete!" -ForegroundColor Green
}
& .venv\Scripts\uvicorn app.main:app --reload --port $Port
} finally {
Pop-Location
}
}