# backend/requirements.txt
# Consolidated requirements for Guaardvark
#
# REQUIRES PYTHON 3.12. Do not install on 3.13/3.14 — numpy<2.0, mediapipe,
# basicsr/gfpgan and realesrgan have no wheels for those yet and the build
# fails (issue #35). Create the venv with python3.12 before installing.

# pkg_resources guard — setuptools >=81 dropped pkg_resources, which several
# ML libs in this stack still import (resemble-perth via chatterbox-tts hit
# this on 2026-04-28; gfpgan/basicsr/mediapipe historically use it too).
# Once the rest of the stack migrates off pkg_resources we can drop this.
setuptools<81

# Core Flask/Backend Dependencies
Flask==3.1.3
Flask-Executor==1.0.0
Flask-Migrate==4.0.7
Flask-SQLAlchemy==3.1.1
Flask-SocketIO==5.3.6
flask-cors==6.0.0
alembic==1.13.1
anthropic>=0.40.0
python-dotenv==1.2.2

# Background Tasks & Caching
celery==5.4.0
redis==5.0.4
eventlet==0.40.3

# Data Processing & Analysis
numpy<2.0,>=1.26.4  # Pin to <2.0 for PyTorch compatibility
pandas==2.2.2
pydantic==2.11.7
psutil==5.9.8

# Web Scraping & File Processing
beautifulsoup4==4.12.3
lxml==6.1.1
pypdf==6.10.2
requests==2.33.0
google-auth==2.53.0
websocket-client==1.8.0
duckduckgo-search==8.1.1

# Database & Utilities
psycopg2-binary==2.9.9
python-slugify==8.0.4
loguru==0.7.2

# LLM/AI Dependencies
ollama>=0.4.0
llama-index-core>=0.13.0,<0.15.0  # Compatible with llama-index-embeddings-ollama
llama-index-llms-ollama>=0.7.0  # Updated for llama-index-core 0.14.x
llama-index-embeddings-ollama>=0.8.0
llama-index-readers-file>=0.5.0  # Updated for llama-index-core 0.14.x
llama-index-retrievers-bm25>=0.5.0  # Hybrid search: BM25 keyword retrieval
# PyTorch is installed by scripts/install_pytorch.sh (smart installer) - do not pin versions here
# torch, torchvision, torchaudio versions are auto-detected based on GPU hardware

# MCP Server Dependencies
# Powers `python -m backend.mcp` (stdio server exposing the gated tool registry +
# read-only output resources to Claude Desktop / Cursor / Zed / Continue). Was a
# silent missing dep — the server is documented but couldn't import without this.
mcp>=1.27.0

# Image Generation Dependencies
diffusers>=0.38.0
transformers>=4.50.3,<5.0  # ComfyUI needs >=4.50.3, diffusers incompatible with 5.x
accelerate==1.2.1
safetensors>=0.4.0
Pillow>=12.2.0
pillow-heif>=1.3.0  # AVIF/HEIF image support for vision analysis
mss>=10.0.0  # Fast screenshot capture for agent virtual display

# ComfyUI / Video Generation Dependencies
torchsde>=0.2.6
sentencepiece>=0.2.0
kornia>=0.7.1
spandrel>=0.4.0
av>=14.2.0
pydantic-settings>=2.0
gguf>=0.18.0

# Face Restoration & Enhancement
gfpgan==1.3.5  # Downgraded from 1.3.8 for torchvision compatibility
realesrgan==0.3.0
facexlib==0.3.0
basicsr>=1.4.2  # Required by GFPGAN and RealESRGAN
lmdb>=1.0.0  # Required by GFPGAN
scipy>=1.10.0  # Required by GFPGAN
tqdm>=4.65.0  # Required by GFPGAN and RealESRGAN
PyYAML>=6.0  # Required by GFPGAN (note: package name is PyYAML, not pyyaml)
tb-nightly  # Required by GFPGAN (optional for runtime, but recommended)

# Anatomy & Pose Control
controlnet-aux==0.0.9
mediapipe==0.10.14

# Video Processing Dependencies
opencv-python==4.8.1.78
imageio==2.34.0
imageio-ffmpeg==0.5.1

# Voice Processing Dependencies
piper-tts==1.3.0
onnxruntime==1.22.1
pydub==0.25.1
librosa>=0.10.2  # Audio decode + duration probe in voice_api.py
soundfile>=0.12.1  # WAV/FLAC IO for voice_api + audio_foundry backends

# Testing Dependencies
pytest==9.0.3
pytest-timeout==2.3.1
pytest-playwright==0.8.0  # 0.7.0 caps pytest<9.0.0; 0.8.0 supports pytest 9.x
playwright==1.52.0

# Desktop Automation Dependencies
pyautogui>=0.9.54      # GUI automation (mouse, keyboard)
pynput>=1.7.6          # Keyboard/mouse monitoring
watchdog>=3.0.0        # File system monitoring
pyperclip>=1.8.2       # Cross-platform clipboard
plyer>=2.1.0           # Native notifications

# Development Tools (Optional - uncomment if needed)
# black==25.1.0
# isort==6.0.1
# mypy==1.16.1
# ruff==0.11.13
faster-whisper>=1.0.0

# Code Intelligence Dependencies
tree-sitter>=0.22.0
tree-sitter-python>=0.23.0
tree-sitter-javascript>=0.23.0
tree-sitter-typescript>=0.23.0
tree-sitter-java>=0.23.0
tree-sitter-go>=0.23.0
tree-sitter-rust>=0.23.0
tree-sitter-c>=0.23.0
tree-sitter-cpp>=0.23.0
tree-sitter-ruby>=0.23.0
tree-sitter-php>=0.23.0
tree-sitter-c-sharp>=0.23.0
pathspec>=0.12.0
networkx>=3.2
