#!/usr/bin/env python3
"""
Test script to verify ML tools integration works
"""
import subprocess
import sys
import os

def test_tool_import(tool_name):
    """Test if a tool can be imported"""
    try:
        if tool_name == "mlflow":
            import mlflow
            print(f"✅ {tool_name}: {mlflow.__version__}")
        elif tool_name == "wandb":
            import wandb
            print(f"✅ {tool_name}: {wandb.__version__}")
        elif tool_name == "streamlit":
            import streamlit
            print(f"✅ {tool_name}: {streamlit.__version__}")
        elif tool_name == "dash":
            import dash
            print(f"✅ {tool_name}: {dash.__version__}")
        elif tool_name == "panel":
            import panel
            print(f"✅ {tool_name}: {panel.__version__}")
        elif tool_name == "bokeh":
            import bokeh
            print(f"✅ {tool_name}: {bokeh.__version__}")
        else:
            print(f"❓ {tool_name}: Unknown tool")
        return True
    except ImportError as e:
        print(f"❌ {tool_name}: {e}")
        return False

def main():
    print("🧪 Testing ML Tools Integration")
    print("=" * 40)
    
    tools = ["mlflow", "wandb", "streamlit", "dash", "panel", "bokeh"]
    
    results = []
    for tool in tools:
        results.append(test_tool_import(tool))
    
    print("\n" + "=" * 40)
    success_count = sum(results)
    total_count = len(results)
    
    print(f"📊 Results: {success_count}/{total_count} tools available")
    
    if success_count == total_count:
        print("🎉 All ML tools are ready to use!")
        return 0
    else:
        print("⚠️  Some tools are missing. Check environment.yml")
        return 1

if __name__ == "__main__":
    sys.exit(main())
