"""安装项目依赖"""
import subprocess
import sys

pip = r"C:\Users\simon\.workbuddy\binaries\python\envs\default\Scripts\pip.exe"

packages = [
    "sqlalchemy==2.0.31", "pytest", "pytest-asyncio", "aiosqlite",
    "fastapi==0.111.0", "httpx==0.27.0", "cryptography==42.0.8",
    "python-dotenv==1.0.1", "pydantic==2.7.4", "pydantic-settings==2.3.4",
    "redis==5.0.7", "uvicorn==0.30.1", "python-multipart==0.0.9"
]

result = subprocess.run(
    [pip, "install"] + packages,
    capture_output=True, text=True
)

output = f"EXIT: {result.returncode}\n\nSTDOUT (last 2000):\n{result.stdout[-2000:]}\n\nSTDERR (last 1000):\n{result.stderr[-1000:]}"

with open(r"C:\Users\simon\WorkBuddy\2026-05-21-16-57-26\install_results.txt", "w", encoding="utf-8") as f:
    f.write(output)
