-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.ps1
More file actions
99 lines (83 loc) · 2.83 KB
/
setup.ps1
File metadata and controls
99 lines (83 loc) · 2.83 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Param(
[switch]$SkipPackages
)
$ErrorActionPreference = "Stop"
Write-Host ""
Write-Host "=== Temporal Market Analysis Bot — Setup (Windows) ==="
# Go to project root (folder where this script lives)
$ProjectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $ProjectRoot
$VenvDir = Join-Path $ProjectRoot ".venv"
$VenvPython = Join-Path $VenvDir "Scripts\python.exe"
Write-Host ""
Write-Host "Project folder:" (Get-Location)
# 1) Create virtual environment if missing
if (-not (Test-Path $VenvPython)) {
Write-Host ""
Write-Host "Creating virtual environment in .venv ..."
$created = $false
$pythonCandidates = @("python", "py -3")
foreach ($cmd in $pythonCandidates) {
try {
Write-Host "Trying:" $cmd "-m venv .venv"
& $cmd -m venv ".venv"
$created = $true
break
} catch {
Write-Host " Failed with" $cmd
}
}
if (-not $created) {
Write-Error "Could not create a virtual environment. Make sure Python 3.11+ is installed and on PATH."
exit 1
}
} else {
Write-Host ""
Write-Host "Virtual environment already exists at .venv"
}
if (-not (Test-Path $VenvPython)) {
Write-Error "Virtual environment python not found at $VenvPython"
exit 1
}
# 2) Install / upgrade packages
if (-not $SkipPackages) {
if (-not (Test-Path "requirements.txt")) {
Write-Error "requirements.txt not found in project root."
exit 1
}
Write-Host ""
Write-Host "Upgrading pip inside the virtual environment ..."
& $VenvPython -m pip install --upgrade pip
Write-Host ""
Write-Host "Installing dependencies from requirements.txt ..."
& $VenvPython -m pip install -r "requirements.txt"
if (Test-Path "requirements-dev.txt") {
Write-Host ""
Write-Host "Installing development/test dependencies from requirements-dev.txt ..."
& $VenvPython -m pip install -r "requirements-dev.txt"
}
}
else {
Write-Host ""
Write-Host "Skipping package installation because -SkipPackages was provided."
}
Write-Host ""
Write-Host "=== Setup complete ==="
Write-Host ""
Write-Host "Next steps for NOOBS:"
Write-Host ""
Write-Host "1) Open PowerShell in this folder:"
Write-Host " $ProjectRoot"
Write-Host ""
Write-Host "2) To run the desktop GUI, use the helper script:"
Write-Host " .\run_gui.ps1"
Write-Host ""
Write-Host "3) To run the automated test suite:"
Write-Host " python run_all_tests.py"
Write-Host ""
Write-Host "You can still activate the virtualenv manually if you want to tinker:"
Write-Host " .\.venv\Scripts\Activate.ps1"
Write-Host ""
Write-Host "If activation fails because of execution policy, run this once:"
Write-Host " Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned"
Write-Host "and then try activating again."