Chris4K's picture
Upload 195 files
4c75d73 verified
#!/usr/bin/env python3
"""
Setup script for MMOP Second Try
Installs dependencies and verifies the installation
"""
import subprocess
import sys
import os
from pathlib import Path
def run_command(command, description):
"""Run a command and handle errors"""
print(f"\n{'='*50}")
print(f"🔧 {description}")
print(f"{'='*50}")
try:
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
print(f"✅ {description} completed successfully")
if result.stdout:
print(f"Output: {result.stdout}")
return True
except subprocess.CalledProcessError as e:
print(f"❌ {description} failed")
print(f"Error: {e.stderr}")
return False
def check_python_version():
"""Check if Python version is suitable"""
print(f"🐍 Python version: {sys.version}")
if sys.version_info < (3, 8):
print("❌ Python 3.8 or higher is required")
return False
print("✅ Python version is compatible")
return True
def install_dependencies():
"""Install dependencies from requirements.txt"""
requirements_file = Path("requirements.txt")
if not requirements_file.exists():
print("❌ requirements.txt not found")
return False
return run_command(
f"{sys.executable} -m pip install -r requirements.txt",
"Installing dependencies"
)
def verify_installation():
"""Verify that key components can be imported"""
print(f"\n{'='*50}")
print("🔍 Verifying installation")
print(f"{'='*50}")
tests = [
("import gradio", "Gradio UI framework"),
("import numpy", "NumPy"),
("import pandas", "Pandas"),
("from src.facades.game_facade import GameFacade", "Game Facade"),
("from src.mcp.mcp_tools import GradioMCPTools", "MCP Tools"),
("from app import MMORPGApplication", "Main Application"),
]
all_passed = True
for test_import, description in tests:
try:
exec(test_import)
print(f"✅ {description}")
except ImportError as e:
print(f"❌ {description}: {e}")
all_passed = False
except Exception as e:
print(f"⚠️ {description}: {e}")
return all_passed
def main():
"""Main setup function"""
print("🎮 MMOP Second Try - Setup Script")
print("=" * 50)
# Check Python version
if not check_python_version():
sys.exit(1)
# Install dependencies
if not install_dependencies():
print("\n❌ Dependency installation failed")
sys.exit(1)
# Verify installation
if not verify_installation():
print("\n⚠️ Some components failed verification, but you can still try running the application")
else:
print("\n🎉 Setup completed successfully!")
print(f"\n{'='*50}")
print("🚀 Next steps:")
print("1. Run the application: python app.py")
print("2. Open your browser to the displayed URL")
print("3. Start playing your MMORPG!")
print(f"{'='*50}")
if __name__ == "__main__":
main()