This repository was archived by the owner on Mar 24, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.py
More file actions
95 lines (81 loc) · 2.83 KB
/
setup.py
File metadata and controls
95 lines (81 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
#!/usr/bin/env python3
"""
Setup script for Project Analyzer
This script helps users get started quickly with Project Analyzer
"""
import os
import sys
import subprocess
import shutil
from pathlib import Path
def check_python_version():
"""Check if Python version is 3.8 or higher"""
if sys.version_info < (3, 8):
print("❌ Error: Python 3.8 or higher is required")
print(f" Current version: {sys.version}")
return False
print(f"✅ Python {sys.version.split()[0]} detected")
return True
def install_dependencies():
"""Install required dependencies"""
print("\n📦 Installing dependencies...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
print("✅ Dependencies installed successfully")
return True
except subprocess.CalledProcessError:
print("❌ Failed to install dependencies")
return False
def setup_env_file():
"""Set up the .env file"""
env_file = Path(".env")
env_example = Path(".env.example")
if env_file.exists():
print("✅ .env file already exists")
return True
if env_example.exists():
shutil.copy(env_example, env_file)
print("✅ Created .env file from template")
print("📝 Please edit .env and add your Google API key")
return True
else:
print("❌ .env.example not found")
return False
def test_installation():
"""Test if the installation works"""
print("\n🧪 Testing installation...")
try:
result = subprocess.run([sys.executable, "analyzer_main.py", "--help"],
capture_output=True, text=True)
if result.returncode == 0:
print("✅ Project Analyzer is working correctly")
return True
else:
print("❌ Project Analyzer test failed")
print(result.stderr)
return False
except Exception as e:
print(f"❌ Test failed: {e}")
return False
def main():
"""Main setup function"""
print("🔍 Project Analyzer Setup")
print("=" * 30)
if not check_python_version():
sys.exit(1)
if not install_dependencies():
sys.exit(1)
if not setup_env_file():
print("⚠️ Warning: .env setup failed, AI features won't work without API key")
if not test_installation():
sys.exit(1)
print("\n🎉 Setup completed successfully!")
print("\n📖 Quick start:")
print(" python analyzer_main.py .")
print(" python analyzer_main.py . --markdown")
print(" python analyzer_main.py --help")
print("\n🔗 Don't forget to:")
print(" 1. Add your Google API key to .env for AI features")
print(" 2. Check out README.md for detailed usage")
if __name__ == "__main__":
main()