This repository was archived by the owner on Jan 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_dependencies.py
More file actions
138 lines (117 loc) · 4.06 KB
/
install_dependencies.py
File metadata and controls
138 lines (117 loc) · 4.06 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
#!/usr/bin/env python3
"""
Dependency installation script for the automated code generation system.
This script installs all required dependencies for the project.
"""
import subprocess
import sys
import os
def run_command(command, description):
"""Run a command and handle errors"""
print(f"\n🔄 {description}...")
print(f"Running: {command}")
try:
result = subprocess.run(
command, shell=True, check=True, capture_output=True, text=True
)
print(f"✅ Success: {description}")
return True
except subprocess.CalledProcessError as e:
print(f"❌ Error: {description}")
print(f"Error output: {e.stderr}")
return False
def check_python_version():
"""Check if Python version is compatible"""
version = sys.version_info
if version.major < 3 or (version.major == 3 and version.minor < 8):
print(
f"❌ Python 3.8+ is required. Current version: {version.major}.{version.minor}"
)
return False
print(f"✅ Python version: {version.major}.{version.minor}.{version.micro}")
return True
def main():
"""Main installation function"""
print("🚀 Installing dependencies for Automated Code Generation System")
print("=" * 60)
# Check Python version
if not check_python_version():
sys.exit(1)
# Change to project directory
project_root = os.path.dirname(os.path.abspath(__file__))
os.chdir(project_root)
print(f"📁 Working directory: {project_root}")
# Installation commands
install_commands = [
{
"command": "python -m pip install --upgrade pip",
"description": "Upgrade pip to latest version",
},
{
"command": "pip install -r requirements.txt",
"description": "Install main project dependencies",
},
{
"command": "pip install -r tests/requirements.txt",
"description": "Install test dependencies",
},
]
# Optional development tools
dev_commands = [
{
"command": "pip install pre-commit",
"description": "Install pre-commit hooks (optional)",
},
{
"command": "pip install jupyter",
"description": "Install Jupyter for development (optional)",
},
]
success_count = 0
total_count = len(install_commands)
# Run main installation commands
for cmd in install_commands:
if run_command(cmd["command"], cmd["description"]):
success_count += 1
else:
print(f"⚠️ Failed to install: {cmd['description']}")
# Install optional development tools
print("\n📦 Installing optional development tools...")
for cmd in dev_commands:
run_command(cmd["command"], cmd["description"])
# Verify critical imports
print("\n🔍 Verifying critical imports...")
critical_imports = [
"azure.functions",
"pandas",
"openai",
"flake8",
"black",
"pytest",
]
import_success = 0
for module in critical_imports:
try:
__import__(module)
print(f"✅ {module}")
import_success += 1
except ImportError as e:
print(f"❌ {module}: {e}")
# Final summary
print("\n" + "=" * 60)
print("📊 INSTALLATION SUMMARY")
print(f"Main dependencies: {success_count}/{total_count} successful")
print(f"Import verification: {import_success}/{len(critical_imports)} successful")
if success_count == total_count and import_success == len(critical_imports):
print("🎉 All dependencies installed successfully!")
print("\n🚀 You can now run:")
print(" python function_app.py")
print(" python tests/run_tests.py")
return 0
else:
print("⚠️ Some installations failed. Please check errors above.")
print("\n🔧 Manual installation:")
print(" pip install azure-functions pandas openai flake8 black pytest")
return 1
if __name__ == "__main__":
sys.exit(main())