mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
chore(server): drop ad-hoc dependency/integration scratch scripts
update_dependencies.py pinned 'latest 2025' versions outside requirements.txt, test_all_integrations.py and TEST_RESULTS_SUMMARY.md were one-off run artefacts; pytest covers the same provider contracts.
This commit is contained in:
parent
bb74a719a1
commit
7e09042f40
3 changed files with 0 additions and 775 deletions
|
|
@ -1,215 +0,0 @@
|
|||
# 🧪 Integration Test Results Summary
|
||||
|
||||
**Test Date**: October 2, 2025
|
||||
**Python Version**: 3.13.x
|
||||
**Test Suite**: Comprehensive Integration Tests
|
||||
|
||||
---
|
||||
|
||||
## 📊 **Overall Results**
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| **Total Tests** | 30 |
|
||||
| **✅ Passed** | 27 |
|
||||
| **❌ Failed** | 3 |
|
||||
| **⚠️ Warnings** | 4 |
|
||||
| **Success Rate** | **90.0%** |
|
||||
| **Status** | ✅ **PRODUCTION READY*** |
|
||||
|
||||
_*With minor limitations noted below_
|
||||
|
||||
---
|
||||
|
||||
## ✅ **What's Working (27/30)**
|
||||
|
||||
### Core ML/AI Framework
|
||||
- ✅ NumPy 2.3.3 (Latest, Python 3.13 compatible)
|
||||
- ✅ PyTorch 2.8.0 (Even newer than requirements!)
|
||||
- ✅ TorchAudio 2.8.0
|
||||
- ✅ NumPy 2.x compatibility verified
|
||||
- ✅ PyTorch 2.4+ compatibility verified
|
||||
|
||||
### Web Frameworks & Networking
|
||||
- ✅ WebSockets 14.2
|
||||
- ✅ aiohttp 3.12.15
|
||||
- ✅ HTTPX 0.27.2
|
||||
- ✅ Requests 2.32.3
|
||||
- ✅ Async/await support working
|
||||
|
||||
### AI/LLM API Clients
|
||||
- ✅ OpenAI SDK 1.99.9 (with 2.x client structure)
|
||||
- ✅ Google Generative AI 0.8.5
|
||||
- ✅ **ElevenLabs 2.16.0** ⭐ (Newly installed)
|
||||
|
||||
### TTS Services
|
||||
- ✅ Edge TTS 7.2.3 (Microsoft, free)
|
||||
- ✅ ElevenLabs TTS (Premium voices, paid)
|
||||
- ✅ OpenAI TTS (High quality, paid)
|
||||
|
||||
### Audio Processing
|
||||
- ✅ PyDub
|
||||
- ✅ Vosk (Speech recognition)
|
||||
- ✅ **OpenAI Whisper 20250625** ⭐ (Newly installed)
|
||||
|
||||
### Security & Authentication
|
||||
- ✅ PyJWT 2.10.1
|
||||
- ✅ Cryptography 44.0.2
|
||||
|
||||
### Data Processing
|
||||
- ✅ ormsgpack 1.10.0
|
||||
- ✅ ruamel.yaml 0.18.10
|
||||
- ✅ Loguru 0.7.3
|
||||
|
||||
### MCP Protocol
|
||||
- ✅ MCP support
|
||||
|
||||
### Configuration
|
||||
- ✅ config.yaml found
|
||||
- ✅ mcp_server_settings.json found
|
||||
|
||||
---
|
||||
|
||||
## ❌ **Known Limitations (3/30)**
|
||||
|
||||
### 1. Kokoro TTS - Not Available
|
||||
**Status**: ❌ Expected Failure
|
||||
**Reason**: Requires Python 3.9-3.12 (incompatible with Python 3.13)
|
||||
**Impact**: Low - 3 other TTS providers available
|
||||
**Workaround**:
|
||||
- Use Docker with Python 3.11 for Kokoro support, OR
|
||||
- Use Edge TTS (free), OpenAI TTS, or ElevenLabs TTS instead
|
||||
|
||||
### 2. mem0ai - Not Installed
|
||||
**Status**: ❌ Installation Issue
|
||||
**Reason**: Package showed as installed but import fails
|
||||
**Impact**: Medium - Memory functionality may be limited
|
||||
**Solution**: Reinstall mem0ai
|
||||
```bash
|
||||
pip install --force-reinstall mem0ai==0.1.118
|
||||
```
|
||||
|
||||
### 3. data/.config.yaml Missing
|
||||
**Status**: ⚠️ Warning (not critical)
|
||||
**Reason**: Optional configuration file for API-driven config
|
||||
**Impact**: Low - config.yaml works fine
|
||||
**When Needed**: Only if using API-driven configuration
|
||||
**Solution**: Create file if needed or use config.yaml directly
|
||||
|
||||
---
|
||||
|
||||
## 🎯 **Feature Availability Matrix**
|
||||
|
||||
| Feature | Status | Notes |
|
||||
|---------|--------|-------|
|
||||
| **Basic Server** | ✅ Ready | All core features work |
|
||||
| **WebSocket Support** | ✅ Ready | v14.2 installed and tested |
|
||||
| **HTTP API** | ✅ Ready | aiohttp + httpx working |
|
||||
| **OpenAI Integration** | ✅ Ready | GPT-4, GPT-3.5, etc. |
|
||||
| **Google Gemini** | ✅ Ready | Latest SDK installed |
|
||||
| **Edge TTS** | ✅ Ready | Free Microsoft TTS |
|
||||
| **OpenAI TTS** | ✅ Ready | High-quality TTS |
|
||||
| **ElevenLabs TTS** | ✅ Ready | Premium voice cloning |
|
||||
| **Kokoro TTS** | ❌ Limited | Python 3.13 incompatible |
|
||||
| **Speech Recognition** | ✅ Ready | Whisper + Vosk |
|
||||
| **Memory Systems** | ⚠️ Partial | Needs mem0ai reinstall |
|
||||
| **MCP Protocol** | ✅ Ready | Latest version |
|
||||
| **Security** | ✅ Ready | Latest cryptography |
|
||||
|
||||
---
|
||||
|
||||
## 📦 **Package Versions Summary**
|
||||
|
||||
### Updated in This Session
|
||||
| Package | Old | New | Status |
|
||||
|---------|-----|-----|--------|
|
||||
| websockets | 14.2 | 15.0.1* | *requirements.txt updated |
|
||||
| httpx | 0.27.2 | 0.28.1* | *requirements.txt updated |
|
||||
| openai | 1.107.0 | 2.0.1* | *requirements.txt updated |
|
||||
| cryptography | 41.0.7 | 46.0.2* | *requirements.txt updated |
|
||||
| mem0ai | 0.1.62 | 0.1.118* | *requirements.txt updated |
|
||||
| mcp | 1.13.1 | 1.16.0* | *requirements.txt updated |
|
||||
| elevenlabs | - | 2.16.0 | ✅ Installed |
|
||||
| openai-whisper | - | 20250625 | ✅ Installed |
|
||||
|
||||
### Already Latest (No Update Needed)
|
||||
- PyTorch 2.8.0 (system has newer than requirements!)
|
||||
- NumPy 2.3.3 (compatible with all packages)
|
||||
- aiohttp 3.12.15
|
||||
- Google Generative AI 0.8.5
|
||||
- Edge TTS 7.2.3
|
||||
|
||||
---
|
||||
|
||||
## 🚀 **Deployment Readiness**
|
||||
|
||||
### ✅ **Ready for Production:**
|
||||
- **Core Functionality**: 90% operational
|
||||
- **TTS Options**: 3 providers available (Edge, OpenAI, ElevenLabs)
|
||||
- **AI/LLM**: All major providers working
|
||||
- **Security**: Latest versions installed
|
||||
- **Performance**: All critical packages updated
|
||||
|
||||
### 📝 **Pre-Deployment Checklist:**
|
||||
|
||||
- [x] Core dependencies installed
|
||||
- [x] Web frameworks operational
|
||||
- [x] AI/LLM APIs configured
|
||||
- [x] TTS providers available (3/4)
|
||||
- [x] Security packages updated
|
||||
- [x] Configuration files present
|
||||
- [ ] Fix mem0ai installation (optional)
|
||||
- [ ] Create data/.config.yaml (if needed)
|
||||
- [ ] Docker build for Kokoro TTS (if needed)
|
||||
|
||||
---
|
||||
|
||||
## 💡 **Recommendations**
|
||||
|
||||
### Immediate Actions
|
||||
1. **✅ DONE**: Install ElevenLabs + Whisper
|
||||
2. **Optional**: Reinstall mem0ai if memory features needed
|
||||
3. **Optional**: Create data/.config.yaml for API-driven config
|
||||
|
||||
### For Full Feature Support
|
||||
- **Option A**: Continue with current setup (90% features)
|
||||
- Missing only Kokoro TTS
|
||||
- All other TTS providers work
|
||||
|
||||
- **Option B**: Use Docker for 100% compatibility
|
||||
```bash
|
||||
docker build -t xiaozhi-esp32-server .
|
||||
docker run -p 8000:8000 xiaozhi-esp32-server
|
||||
```
|
||||
- Includes Python 3.11
|
||||
- Full Kokoro TTS support
|
||||
- Isolated environment
|
||||
|
||||
### Long-Term Maintenance
|
||||
- Monitor for Kokoro TTS Python 3.13 compatibility updates
|
||||
- Update dependencies monthly using `pip list --outdated`
|
||||
- Security updates: cryptography, PyJWT (check monthly)
|
||||
|
||||
---
|
||||
|
||||
## 🎉 **Conclusion**
|
||||
|
||||
**Your xiaozhi-esp32-server is 90% production-ready!**
|
||||
|
||||
### What Works
|
||||
✅ All core functionality
|
||||
✅ 3 TTS providers (Edge, OpenAI, ElevenLabs)
|
||||
✅ Latest AI/LLM SDKs
|
||||
✅ Latest security patches
|
||||
✅ Speech recognition (Whisper)
|
||||
✅ Web frameworks and networking
|
||||
|
||||
### Minor Limitations
|
||||
⚠️ Kokoro TTS requires Docker or Python 3.11
|
||||
⚠️ mem0ai needs reinstall (if using memory features)
|
||||
|
||||
### Bottom Line
|
||||
The system is **fully functional for production use** with the available TTS providers. The missing Kokoro TTS is not critical as you have 3 other high-quality alternatives.
|
||||
|
||||
**Recommendation**: Deploy as-is or use Docker for 100% feature parity! 🚀
|
||||
|
||||
|
|
@ -1,363 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Comprehensive Integration Test Suite
|
||||
Tests all updated dependencies and TTS integrations
|
||||
"""
|
||||
|
||||
import sys
|
||||
import asyncio
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
|
||||
# Add project root to path
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
|
||||
class TestResults:
|
||||
def __init__(self):
|
||||
self.passed = []
|
||||
self.failed = []
|
||||
self.warnings = []
|
||||
|
||||
def add_pass(self, test_name, message=""):
|
||||
self.passed.append((test_name, message))
|
||||
print(f"✅ {test_name}: PASSED {message}")
|
||||
|
||||
def add_fail(self, test_name, error):
|
||||
self.failed.append((test_name, str(error)))
|
||||
print(f"❌ {test_name}: FAILED - {error}")
|
||||
|
||||
def add_warning(self, test_name, message):
|
||||
self.warnings.append((test_name, message))
|
||||
print(f"⚠️ {test_name}: WARNING - {message}")
|
||||
|
||||
def print_summary(self):
|
||||
print("\n" + "="*70)
|
||||
print("📊 TEST SUMMARY")
|
||||
print("="*70)
|
||||
print(f"✅ Passed: {len(self.passed)}")
|
||||
print(f"❌ Failed: {len(self.failed)}")
|
||||
print(f"⚠️ Warnings: {len(self.warnings)}")
|
||||
print(f"📈 Success Rate: {(len(self.passed)/(len(self.passed)+len(self.failed))*100):.1f}%")
|
||||
|
||||
if self.failed:
|
||||
print("\n❌ FAILED TESTS:")
|
||||
for name, error in self.failed:
|
||||
print(f" - {name}: {error}")
|
||||
|
||||
if self.warnings:
|
||||
print("\n⚠️ WARNINGS:")
|
||||
for name, msg in self.warnings:
|
||||
print(f" - {name}: {msg}")
|
||||
|
||||
return len(self.failed) == 0
|
||||
|
||||
results = TestResults()
|
||||
|
||||
print("🧪 COMPREHENSIVE INTEGRATION TEST SUITE")
|
||||
print("="*70)
|
||||
|
||||
# Test 1: Core Dependencies Import
|
||||
print("\n📦 TEST 1: Core Dependencies Import")
|
||||
print("-"*70)
|
||||
|
||||
core_imports = [
|
||||
("numpy", "NumPy"),
|
||||
("torch", "PyTorch"),
|
||||
("torchaudio", "TorchAudio"),
|
||||
]
|
||||
|
||||
for module, name in core_imports:
|
||||
try:
|
||||
imported = __import__(module)
|
||||
version = getattr(imported, '__version__', 'unknown')
|
||||
results.add_pass(f"Import {name}", f"(v{version})")
|
||||
except ImportError as e:
|
||||
results.add_fail(f"Import {name}", e)
|
||||
except Exception as e:
|
||||
results.add_warning(f"Import {name}", e)
|
||||
|
||||
# Test 2: Web Framework Dependencies
|
||||
print("\n🌐 TEST 2: Web Framework Dependencies")
|
||||
print("-"*70)
|
||||
|
||||
web_imports = [
|
||||
("websockets", "WebSockets"),
|
||||
("aiohttp", "aiohttp"),
|
||||
("httpx", "HTTPX"),
|
||||
("requests", "Requests"),
|
||||
]
|
||||
|
||||
for module, name in web_imports:
|
||||
try:
|
||||
imported = __import__(module)
|
||||
version = getattr(imported, '__version__', 'unknown')
|
||||
results.add_pass(f"Import {name}", f"(v{version})")
|
||||
except ImportError as e:
|
||||
results.add_fail(f"Import {name}", e)
|
||||
|
||||
# Test 3: AI/LLM API Clients
|
||||
print("\n🤖 TEST 3: AI/LLM API Clients")
|
||||
print("-"*70)
|
||||
|
||||
ai_imports = [
|
||||
("openai", "OpenAI SDK"),
|
||||
("google.generativeai", "Google Generative AI"),
|
||||
("elevenlabs", "ElevenLabs"),
|
||||
]
|
||||
|
||||
for module, name in ai_imports:
|
||||
try:
|
||||
imported = __import__(module, fromlist=[''])
|
||||
version = getattr(imported, '__version__', 'unknown')
|
||||
results.add_pass(f"Import {name}", f"(v{version})")
|
||||
|
||||
# Special check for OpenAI 2.x breaking changes
|
||||
if module == "openai":
|
||||
try:
|
||||
from openai import OpenAI
|
||||
results.add_pass("OpenAI 2.x Client", "New API structure available")
|
||||
except ImportError:
|
||||
results.add_warning("OpenAI 2.x Client", "May need code updates")
|
||||
|
||||
except ImportError as e:
|
||||
results.add_fail(f"Import {name}", e)
|
||||
|
||||
# Test 4: TTS Services
|
||||
print("\n🎤 TEST 4: TTS Service Providers")
|
||||
print("-"*70)
|
||||
|
||||
tts_imports = [
|
||||
("edge_tts", "Edge TTS"),
|
||||
]
|
||||
|
||||
for module, name in tts_imports:
|
||||
try:
|
||||
imported = __import__(module)
|
||||
version = getattr(imported, '__version__', 'unknown')
|
||||
results.add_pass(f"Import {name}", f"(v{version})")
|
||||
except ImportError as e:
|
||||
results.add_fail(f"Import {name}", e)
|
||||
|
||||
# Test 5: Kokoro TTS Integration
|
||||
print("\n🎵 TEST 5: Kokoro TTS Integration")
|
||||
print("-"*70)
|
||||
|
||||
try:
|
||||
import kokoro_tts
|
||||
results.add_pass("Import Kokoro TTS", f"(v{kokoro_tts.__version__})")
|
||||
|
||||
# Test provider initialization
|
||||
try:
|
||||
from core.providers.tts.kokoro import TTSProvider
|
||||
test_config = {
|
||||
"type": "kokoro",
|
||||
"use_api": False,
|
||||
"voice": "af_heart",
|
||||
"language": "en-us",
|
||||
"speed": 1.0,
|
||||
"response_format": "mp3",
|
||||
"output_dir": "tmp/"
|
||||
}
|
||||
provider = TTSProvider(test_config, delete_audio_file=True)
|
||||
results.add_pass("Kokoro TTS Provider Init", "Successfully initialized")
|
||||
except Exception as e:
|
||||
results.add_fail("Kokoro TTS Provider Init", e)
|
||||
|
||||
except ImportError as e:
|
||||
results.add_fail("Import Kokoro TTS", e)
|
||||
|
||||
# Test 6: ElevenLabs TTS Integration
|
||||
print("\n🔊 TEST 6: ElevenLabs TTS Integration")
|
||||
print("-"*70)
|
||||
|
||||
try:
|
||||
from elevenlabs.client import ElevenLabs
|
||||
results.add_pass("Import ElevenLabs Client", "SDK 2.16.0 structure")
|
||||
|
||||
try:
|
||||
from core.providers.tts.elevenlabs import TTSProvider
|
||||
test_config = {
|
||||
"type": "elevenlabs",
|
||||
"api_key": "test_key",
|
||||
"voice_id": "21m00Tcm4TlvDq8ikWAM",
|
||||
"model_id": "eleven_turbo_v2_5",
|
||||
"output_dir": "tmp/"
|
||||
}
|
||||
provider = TTSProvider(test_config, delete_audio_file=True)
|
||||
results.add_pass("ElevenLabs TTS Provider Init", "Successfully initialized")
|
||||
except Exception as e:
|
||||
results.add_fail("ElevenLabs TTS Provider Init", e)
|
||||
|
||||
except ImportError as e:
|
||||
results.add_warning("Import ElevenLabs Client", "Trying fallback import")
|
||||
try:
|
||||
from elevenlabs import ElevenLabs
|
||||
results.add_pass("Import ElevenLabs (fallback)", "Alternative import works")
|
||||
except ImportError as e2:
|
||||
results.add_fail("Import ElevenLabs", e2)
|
||||
|
||||
# Test 7: Security & Authentication
|
||||
print("\n🔒 TEST 7: Security & Authentication")
|
||||
print("-"*70)
|
||||
|
||||
security_imports = [
|
||||
("jwt", "PyJWT"),
|
||||
("cryptography", "Cryptography"),
|
||||
]
|
||||
|
||||
for module, name in security_imports:
|
||||
try:
|
||||
imported = __import__(module)
|
||||
version = getattr(imported, '__version__', 'unknown')
|
||||
results.add_pass(f"Import {name}", f"(v{version})")
|
||||
except ImportError as e:
|
||||
results.add_fail(f"Import {name}", e)
|
||||
|
||||
# Test 8: Data Processing
|
||||
print("\n📊 TEST 8: Data Processing & Serialization")
|
||||
print("-"*70)
|
||||
|
||||
data_imports = [
|
||||
("ormsgpack", "ormsgpack"),
|
||||
("ruamel.yaml", "ruamel.yaml"),
|
||||
("loguru", "Loguru"),
|
||||
]
|
||||
|
||||
for module, name in data_imports:
|
||||
try:
|
||||
imported = __import__(module, fromlist=[''])
|
||||
version = getattr(imported, '__version__', 'unknown')
|
||||
results.add_pass(f"Import {name}", f"(v{version})")
|
||||
except ImportError as e:
|
||||
results.add_fail(f"Import {name}", e)
|
||||
|
||||
# Test 9: Memory & MCP
|
||||
print("\n🧠 TEST 9: Memory & MCP Systems")
|
||||
print("-"*70)
|
||||
|
||||
memory_imports = [
|
||||
("mem0ai", "Mem0 AI"),
|
||||
("mcp", "MCP"),
|
||||
]
|
||||
|
||||
for module, name in memory_imports:
|
||||
try:
|
||||
imported = __import__(module)
|
||||
version = getattr(imported, '__version__', 'unknown')
|
||||
results.add_pass(f"Import {name}", f"(v{version})")
|
||||
except ImportError as e:
|
||||
results.add_fail(f"Import {name}", e)
|
||||
|
||||
# Test 10: Audio Processing
|
||||
print("\n🎧 TEST 10: Audio Processing")
|
||||
print("-"*70)
|
||||
|
||||
audio_imports = [
|
||||
("pydub", "PyDub"),
|
||||
("vosk", "Vosk"),
|
||||
("whisper", "OpenAI Whisper"),
|
||||
]
|
||||
|
||||
for module, name in audio_imports:
|
||||
try:
|
||||
imported = __import__(module)
|
||||
version = getattr(imported, '__version__', 'unknown')
|
||||
results.add_pass(f"Import {name}", f"(v{version})")
|
||||
except ImportError as e:
|
||||
results.add_fail(f"Import {name}", e)
|
||||
|
||||
# Test 11: Version Compatibility Checks
|
||||
print("\n🔍 TEST 11: Version Compatibility Checks")
|
||||
print("-"*70)
|
||||
|
||||
try:
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
np_version = tuple(map(int, np.__version__.split('.')[:2]))
|
||||
torch_version = tuple(map(int, torch.__version__.split('.')[:2]))
|
||||
|
||||
if np_version >= (2, 0):
|
||||
results.add_pass("NumPy 2.x Compatibility", f"NumPy {np.__version__}")
|
||||
else:
|
||||
results.add_fail("NumPy 2.x Compatibility", f"NumPy {np.__version__} < 2.0")
|
||||
|
||||
if torch_version >= (2, 4):
|
||||
results.add_pass("PyTorch 2.4+ Compatibility", f"PyTorch {torch.__version__}")
|
||||
else:
|
||||
results.add_warning("PyTorch Version", f"PyTorch {torch.__version__} (2.4+ recommended)")
|
||||
|
||||
except Exception as e:
|
||||
results.add_fail("Version Compatibility Check", e)
|
||||
|
||||
# Test 12: Configuration Loading
|
||||
print("\n⚙️ TEST 12: Configuration Files")
|
||||
print("-"*70)
|
||||
|
||||
config_files = [
|
||||
"config.yaml",
|
||||
"mcp_server_settings.json",
|
||||
]
|
||||
|
||||
for config_file in config_files:
|
||||
try:
|
||||
config_path = Path(__file__).parent / config_file
|
||||
if config_path.exists():
|
||||
results.add_pass(f"Config File: {config_file}", "Found")
|
||||
else:
|
||||
results.add_warning(f"Config File: {config_file}", "Not found (optional)")
|
||||
except Exception as e:
|
||||
results.add_fail(f"Config File: {config_file}", e)
|
||||
|
||||
# Test 13: TTS Provider Module Structure
|
||||
print("\n🎙️ TEST 13: TTS Provider Module Structure")
|
||||
print("-"*70)
|
||||
|
||||
tts_providers = [
|
||||
("core.providers.tts.openai", "OpenAI TTS"),
|
||||
("core.providers.tts.edge", "Edge TTS"),
|
||||
("core.providers.tts.elevenlabs", "ElevenLabs TTS"),
|
||||
("core.providers.tts.kokoro", "Kokoro TTS"),
|
||||
]
|
||||
|
||||
for module, name in tts_providers:
|
||||
try:
|
||||
imported = __import__(module, fromlist=['TTSProvider'])
|
||||
TTSProvider = getattr(imported, 'TTSProvider')
|
||||
results.add_pass(f"TTS Provider: {name}", "Module structure valid")
|
||||
except ImportError as e:
|
||||
results.add_fail(f"TTS Provider: {name}", e)
|
||||
except Exception as e:
|
||||
results.add_warning(f"TTS Provider: {name}", e)
|
||||
|
||||
# Test 14: Async Support
|
||||
print("\n⚡ TEST 14: Async/Await Support")
|
||||
print("-"*70)
|
||||
|
||||
async def test_async():
|
||||
"""Test async functionality"""
|
||||
try:
|
||||
import aiohttp
|
||||
async with aiohttp.ClientSession() as session:
|
||||
results.add_pass("Async HTTP Session", "aiohttp async support works")
|
||||
except Exception as e:
|
||||
results.add_fail("Async HTTP Session", e)
|
||||
|
||||
try:
|
||||
asyncio.run(test_async())
|
||||
except Exception as e:
|
||||
results.add_fail("Async Event Loop", e)
|
||||
|
||||
# Final Summary
|
||||
print("\n" + "="*70)
|
||||
success = results.print_summary()
|
||||
|
||||
if success:
|
||||
print("\n🎉 ALL TESTS PASSED!")
|
||||
print("✅ System is ready for deployment")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("\n⚠️ SOME TESTS FAILED")
|
||||
print("💡 Review failed tests above and fix issues before deployment")
|
||||
sys.exit(1)
|
||||
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Dependency Update and Compatibility Verification Script
|
||||
Updates all Python dependencies to latest 2025 versions with compatibility checks
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import pkg_resources
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
def run_command(cmd, check=True):
|
||||
"""Run a shell command and return the result"""
|
||||
try:
|
||||
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, check=check)
|
||||
return result.stdout.strip(), result.stderr.strip(), result.returncode
|
||||
except subprocess.CalledProcessError as e:
|
||||
return e.stdout, e.stderr, e.returncode
|
||||
|
||||
def check_python_version():
|
||||
"""Check if Python version is compatible"""
|
||||
version = sys.version_info
|
||||
print(f"🐍 Python version: {version.major}.{version.minor}.{version.micro}")
|
||||
|
||||
if version.major < 3 or (version.major == 3 and version.minor < 8):
|
||||
print("❌ Python 3.8+ is required for this project")
|
||||
return False
|
||||
elif version.minor >= 11:
|
||||
print("✅ Python version is optimal for 2025 dependencies")
|
||||
else:
|
||||
print("⚠️ Consider upgrading to Python 3.11+ for best compatibility")
|
||||
|
||||
return True
|
||||
|
||||
def backup_requirements():
|
||||
"""Create a backup of current requirements"""
|
||||
backup_file = "requirements_backup.txt"
|
||||
try:
|
||||
subprocess.run(["pip", "freeze"], stdout=open(backup_file, 'w'), check=True)
|
||||
print(f"✅ Created backup: {backup_file}")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"❌ Failed to create backup: {e}")
|
||||
return False
|
||||
|
||||
def update_pip_tools():
|
||||
"""Update pip and essential tools"""
|
||||
print("\n🔧 Updating pip and essential tools...")
|
||||
|
||||
commands = [
|
||||
"python -m pip install --upgrade pip",
|
||||
"pip install --upgrade setuptools wheel",
|
||||
"pip install --upgrade pip-tools pip-check"
|
||||
]
|
||||
|
||||
for cmd in commands:
|
||||
print(f"Running: {cmd}")
|
||||
stdout, stderr, code = run_command(cmd, check=False)
|
||||
if code == 0:
|
||||
print(f"✅ Success")
|
||||
else:
|
||||
print(f"⚠️ Warning: {stderr}")
|
||||
|
||||
def install_dependencies():
|
||||
"""Install updated dependencies"""
|
||||
print("\n📦 Installing updated dependencies...")
|
||||
|
||||
cmd = "pip install -r requirements.txt"
|
||||
print(f"Running: {cmd}")
|
||||
stdout, stderr, code = run_command(cmd, check=False)
|
||||
|
||||
if code == 0:
|
||||
print("✅ Dependencies installed successfully")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Installation failed: {stderr}")
|
||||
return False
|
||||
|
||||
def check_compatibility():
|
||||
"""Check for dependency conflicts"""
|
||||
print("\n🔍 Checking for dependency conflicts...")
|
||||
|
||||
stdout, stderr, code = run_command("pip check", check=False)
|
||||
|
||||
if code == 0:
|
||||
print("✅ No dependency conflicts found")
|
||||
return True
|
||||
else:
|
||||
print(f"⚠️ Dependency conflicts detected:")
|
||||
print(stderr)
|
||||
return False
|
||||
|
||||
def verify_key_imports():
|
||||
"""Verify that key packages can be imported"""
|
||||
print("\n🧪 Testing key package imports...")
|
||||
|
||||
key_packages = [
|
||||
("torch", "PyTorch"),
|
||||
("numpy", "NumPy"),
|
||||
("aiohttp", "aiohttp"),
|
||||
("websockets", "websockets"),
|
||||
("openai", "OpenAI"),
|
||||
("elevenlabs", "ElevenLabs"),
|
||||
("kokoro_tts", "Kokoro TTS"),
|
||||
("edge_tts", "Edge TTS"),
|
||||
("loguru", "Loguru"),
|
||||
("requests", "Requests")
|
||||
]
|
||||
|
||||
results = []
|
||||
for package, name in key_packages:
|
||||
try:
|
||||
__import__(package)
|
||||
print(f"✅ {name}: OK")
|
||||
results.append((name, True, None))
|
||||
except ImportError as e:
|
||||
print(f"❌ {name}: FAILED - {e}")
|
||||
results.append((name, False, str(e)))
|
||||
except Exception as e:
|
||||
print(f"⚠️ {name}: WARNING - {e}")
|
||||
results.append((name, False, str(e)))
|
||||
|
||||
return results
|
||||
|
||||
def generate_report(import_results):
|
||||
"""Generate a compatibility report"""
|
||||
print("\n📊 COMPATIBILITY REPORT")
|
||||
print("=" * 50)
|
||||
|
||||
total = len(import_results)
|
||||
passed = sum(1 for _, success, _ in import_results if success)
|
||||
|
||||
print(f"Total packages tested: {total}")
|
||||
print(f"Successfully imported: {passed}")
|
||||
print(f"Failed imports: {total - passed}")
|
||||
print(f"Success rate: {(passed/total)*100:.1f}%")
|
||||
|
||||
if passed == total:
|
||||
print("\n🎉 ALL DEPENDENCIES ARE COMPATIBLE!")
|
||||
print("✅ Ready for production use")
|
||||
else:
|
||||
print("\n⚠️ SOME DEPENDENCIES NEED ATTENTION:")
|
||||
for name, success, error in import_results:
|
||||
if not success:
|
||||
print(f"❌ {name}: {error}")
|
||||
|
||||
return passed == total
|
||||
|
||||
def main():
|
||||
"""Main update and verification process"""
|
||||
print("🚀 Python Dependencies Update & Compatibility Check")
|
||||
print("=" * 60)
|
||||
|
||||
# Step 1: Check Python version
|
||||
if not check_python_version():
|
||||
return False
|
||||
|
||||
# Step 2: Create backup
|
||||
if not backup_requirements():
|
||||
return False
|
||||
|
||||
# Step 3: Update pip and tools
|
||||
update_pip_tools()
|
||||
|
||||
# Step 4: Install dependencies
|
||||
if not install_dependencies():
|
||||
print("\n❌ Dependency installation failed!")
|
||||
print("💡 Try restoring from backup: pip install -r requirements_backup.txt")
|
||||
return False
|
||||
|
||||
# Step 5: Check compatibility
|
||||
compatible = check_compatibility()
|
||||
|
||||
# Step 6: Test imports
|
||||
import_results = verify_key_imports()
|
||||
|
||||
# Step 7: Generate report
|
||||
all_good = generate_report(import_results)
|
||||
|
||||
if all_good and compatible:
|
||||
print("\n🎉 UPDATE SUCCESSFUL!")
|
||||
print("✅ All dependencies updated to latest 2025 versions")
|
||||
print("✅ No compatibility issues detected")
|
||||
print("✅ All key packages import successfully")
|
||||
else:
|
||||
print("\n⚠️ UPDATE COMPLETED WITH WARNINGS")
|
||||
print("💡 Review the issues above and consider:")
|
||||
print(" - Checking package documentation for breaking changes")
|
||||
print(" - Running your application tests")
|
||||
print(" - Restoring from backup if needed")
|
||||
|
||||
return all_good and compatible
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = main()
|
||||
sys.exit(0 if success else 1)
|
||||
Loading…
Reference in a new issue