#!/usr/bin/env python3
"""Verify Docker setup has all requirements for 48-language support."""
import sys
import subprocess
from pathlib import Path
def check_requirements():
"""Check all requirements are properly configured."""
print("=== Verifying Docker Setup for 48-Language Support ===\n")
issues = []
# 1. Check Python dependencies in pyproject.toml
print("1. Checking pyproject.toml...")
pyproject = Path("pyproject.toml").read_text()
required_deps = [
("tree-sitter>=0.20.0", "Base tree-sitter library"),
("tree-sitter-languages>=1.8.0", "All 48 language grammars"),
("jedi>=0.19.0", "Python code analysis"),
("fastapi", "Web framework"),
("uvicorn", "ASGI server"),
("watchdog", "File watching")
]
for dep, desc in required_deps:
dep_name = dep.split(">")[0].split("=")[0]
if dep_name in pyproject:
print(f" ✅ {dep_name}: {desc}")
else:
print(f" ❌ {dep_name}: {desc} - MISSING")
issues.append(f"Missing {dep_name} in pyproject.toml")
# 2. Check Dockerfile system dependencies
print("\n2. Checking Dockerfile system dependencies...")
dockerfile = Path("Dockerfile").read_text()
sys_deps = [
("build-essential", "Compilation tools"),
("git", "Version control"),
("curl", "HTTP client"),
("libcurl4-openssl-dev", "Development headers")
]
recommended_deps = [
("libstdc++6", "C++ standard library for tree-sitter"),
("python3-dev", "Python development headers")
]
for dep, desc in sys_deps:
if dep in dockerfile:
print(f" ✅ {dep}: {desc}")
else:
print(f" ❌ {dep}: {desc} - MISSING")
issues.append(f"Missing {dep} in Dockerfile")
print("\n Recommended additions:")
for dep, desc in recommended_deps:
if dep in dockerfile:
print(f" ✅ {dep}: {desc}")
else:
print(f" ⚠️ {dep}: {desc} - RECOMMENDED")
# 3. Check production requirements
print("\n3. Checking production requirements...")
if Path("requirements-production.txt").exists():
prod_reqs = Path("requirements-production.txt").read_text()
if "tree-sitter-languages" in prod_reqs:
print(" ✅ tree-sitter-languages in production requirements")
else:
print(" ❌ tree-sitter-languages missing from production requirements")
issues.append("Missing tree-sitter-languages in production requirements")
else:
print(" ⚠️ requirements-production.txt not found")
# 4. Check docker-compose setup
print("\n4. Checking docker-compose files...")
compose_files = list(Path(".").glob("docker-compose*.yml"))
if compose_files:
print(f" ✅ Found {len(compose_files)} docker-compose files")
for f in compose_files:
print(f" - {f.name}")
else:
print(" ⚠️ No docker-compose files found")
# 5. Test tree-sitter-languages import
print("\n5. Testing tree-sitter-languages import...")
try:
import tree_sitter_languages
# Check available languages using the correct method
available_langs = []
for lang in ['python', 'javascript', 'go', 'rust', 'java', 'c', 'cpp', 'ruby']:
try:
tree_sitter_languages.get_language(lang)
available_langs.append(lang)
except:
pass
print(f" ✅ tree-sitter-languages loaded successfully")
print(f" Sample languages verified: {', '.join(available_langs)}")
except ImportError:
print(" ⚠️ tree-sitter-languages not installed in current environment")
print(" (This is OK if running outside Docker)")
except Exception as e:
print(f" ⚠️ tree-sitter-languages error: {e}")
# 6. Check for language registry
print("\n6. Checking language registry...")
lang_registry = Path("mcp_server/plugins/language_registry.py")
if lang_registry.exists():
content = lang_registry.read_text()
lang_count = content.count('"code":')
print(f" ✅ Language registry found with ~{lang_count} languages configured")
else:
print(" ❌ Language registry not found")
issues.append("Missing language registry")
# Summary
print("\n=== Summary ===")
if not issues:
print("✅ Docker setup is properly configured for 48-language support!")
print("\nKey components verified:")
print(" - tree-sitter-languages package included")
print(" - System dependencies configured")
print(" - Language registry present")
print(" - Docker build configuration correct")
else:
print("❌ Issues found:")
for issue in issues:
print(f" - {issue}")
print("\n⚠️ Enhanced Dockerfile available at: Dockerfile.enhanced")
# Recommendations
print("\n=== Recommendations ===")
print("1. Use Dockerfile.enhanced for better tree-sitter compatibility")
print("2. The current setup supports all 48 languages via tree-sitter-languages")
print("3. Production deployment is optimized with multi-stage builds")
print("4. All language grammars are bundled - no additional downloads needed")
return len(issues) == 0
if __name__ == "__main__":
success = check_requirements()
sys.exit(0 if success else 1)