-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_alpha_v2.py
More file actions
195 lines (151 loc) · 4.84 KB
/
Copy pathsetup_alpha_v2.py
File metadata and controls
195 lines (151 loc) · 4.84 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
"""
Alpha Evolve v2.0 - Quick Setup Script
Automated setup and verification for all components
"""
import os
import sys
import subprocess
from pathlib import Path
def print_header(text):
"""Print formatted header."""
print("\n" + "=" * 70)
print(f" {text}")
print("=" * 70)
def print_step(step, description):
"""Print step description."""
print(f"\n[{step}] {description}")
def run_command(cmd, description):
"""Run shell command with output."""
print(f" Running: {description}")
try:
result = subprocess.run(
cmd, shell=True, check=True,
capture_output=True, text=True
)
print(f" ✅ Success")
return True
except subprocess.CalledProcessError as e:
print(f" ❌ Failed: {e.stderr}")
return False
def check_python_version():
"""Check Python version."""
version = sys.version_info
if version.major >= 3 and version.minor >= 9:
print(f" ✅ Python {version.major}.{version.minor}.{version.micro}")
return True
else:
print(f" ❌ Python {version.major}.{version.minor}.{version.micro} (need 3.9+)")
return False
def check_command_exists(cmd):
"""Check if command exists."""
try:
subprocess.run(
f"{cmd} --version",
shell=True, check=True,
capture_output=True
)
return True
except:
return False
def main():
"""Main setup function."""
print_header("🚀 Alpha Evolve v2.0 - Quick Setup")
# Step 1: Check Python version
print_step(1, "Checking Python version")
if not check_python_version():
print("\n⚠️ Python 3.9+ required. Please upgrade Python.")
return False
# Step 2: Check dependencies
print_step(2, "Checking system dependencies")
dependencies = {
"docker": "Docker (optional for deployment)",
"redis-cli": "Redis (optional for caching)",
"ollama": "Ollama (optional for LLM features)"
}
for cmd, desc in dependencies.items():
if check_command_exists(cmd):
print(f" ✅ {desc}")
else:
print(f" ⚠️ {desc} not found (optional)")
# Step 3: Create directories
print_step(3, "Creating directories")
directories = [
"data",
"data/chroma_db",
"data/validation_test",
"logs"
]
for dir_path in directories:
Path(dir_path).mkdir(parents=True, exist_ok=True)
print(f" ✅ Created: {dir_path}")
# Step 4: Install Python dependencies
print_step(4, "Installing Python dependencies")
if not run_command(
f"{sys.executable} -m pip install --upgrade pip",
"Upgrading pip"
):
print(" ⚠️ Pip upgrade failed, continuing...")
if run_command(
f"{sys.executable} -m pip install -r requirements_alpha_v2.txt",
"Installing dependencies from requirements_alpha_v2.txt"
):
print(" ✅ All Python dependencies installed")
else:
print(" ❌ Failed to install dependencies")
return False
# Step 5: Verify installation
print_step(5, "Verifying installation")
packages = [
"fastapi",
"streamlit",
"optuna",
"networkx",
"redis",
"geopy",
"phonenumbers"
]
all_installed = True
for package in packages:
try:
__import__(package)
print(f" ✅ {package}")
except ImportError:
print(f" ❌ {package} not found")
all_installed = False
if not all_installed:
print("\n⚠️ Some packages missing. Run: pip install -r requirements_alpha_v2.txt")
# Step 6: Run validation
print_step(6, "Running system validation")
if run_command(
f"{sys.executable} validate_system.py",
"Validating all components"
):
print(" ✅ System validation passed")
else:
print(" ⚠️ Validation had warnings (check output above)")
# Final summary
print_header("📊 Setup Complete")
print("""
✅ Alpha Evolve v2.0 is ready!
Next steps:
1. Start services:
Option A: Docker (recommended)
$ docker-compose up -d
Option B: Local Python
Terminal 1: $ python -m uvicorn src.api.fastapi_gateway:app --reload
Terminal 2: $ streamlit run src/dashboard/app.py
2. Access:
- API: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Dashboard: http://localhost:8501
3. Optional: Install Ollama for LLM features
$ curl https://ollama.ai/install.sh | sh
$ ollama pull llama3
4. Run tests:
$ pytest tests/test_alpha_evolve_v2.py -v
For more information, see README_ALPHA_EVOLVE_V2.md
""")
return True
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)