# ============================================
# BANGTRIXTOOLKIT - Dependencies
# ============================================
# Install ALL:   pip install -r requirements.txt
# Install MIN:   pip install -r requirements.txt --no-deps
#                  (only minimal aiohttp + requests)
#
# UNIVERSAL (REQUIRED for all users)
# ============================================
# aiohttp  -> REST API + WebSocket server for HW Monitor overlay
# requests  -> Google Translate + GitHub API (LHM download)
# async-timeout -> aiohttp compatibility
#
aiohttp>=3.8.0
requests>=2.31.0
async-timeout>=4.0.0

# ============================================
# ALL PLATFORMS - System RAM Monitoring
# ============================================
# psutil -> Provides accurate system RAM data.
#           Used by FallbackBackend + PDHBackend (APU VRAM proxy).
# WITHOUT psutil: Fallback reads /proc/meminfo (Linux) or no RAM data.
# RECOMMENDED: Install for ALL users
#
psutil>=5.9.0

# ============================================
# WINDOWS - Performance Counters (PDH)
# ============================================
# pywin32 (win32pdh) -> Reads GPU Utilization and VRAM directly from
#                       Windows Performance Counters - THE EXACT SAME SOURCE
#                       AS TASK MANAGER. Primary backend for Windows.
#
# * AMD / APU (Radeon Graphics): PDH is the PRIMARY backend
# * NVIDIA: PDH is the fallback if pynvml is not installed
# * Intel:  PDH is the PRIMARY backend
#
# WITHOUT pywin32: Fallback to PowerShell (much slower, subprocess every second).
# REQUIRED for Windows users.
# Not required on Linux.
#
pywin32>=306; sys_platform == "win32"

# ============================================
# NVIDIA GPU - pynvml (OPTIONAL - NVIDIA ONLY)
# ============================================
# pynvml -> Reads NVIDIA statistics directly from NVML (NVIDIA Management
#           Library). Provides the MOST ACCURATE data for NVIDIA GPUs:
#           Utilization, VRAM, Temperature, Fan, Clock, Power.
#
# * NVIDIA dGPU: PRIORITY backend. MUCH more accurate than PDH.
# * AMD / Intel: NOT REQUIRED (pynvml is only for NVIDIA).
# * APU: Not relevant (AMD APUs do not have NVML).
#
# WITHOUT pynvml: Fallback to PDH (Windows) or nvidia-smi (Linux).
#               Data remains accurate, just not as detailed as pynvml.
#
# Install ONLY if you have an NVIDIA GPU:
#   pip install pynvml
#
pynvml>=11.5.0

# ============================================
# AMD GPU - Temperature / Fan via ADL (AUTOMATIC)
# ============================================
# ADL (AMD Display Library) -> Reads AMD GPU temperature and fan speed
#                              directly from atiadlxx.dll via ctypes.
#
# * AMD dGPU / APU: WILL WORK AUTOMATICALLY if atiadlxx.dll is in the system
# * NVIDIA: Not relevant
#
# NO NEED to install any packages! Uses ctypes (Python stdlib)
# for direct binding to the AMD DLL already installed with the driver.
#
# If atiadlxx.dll is NOT FOUND in the system (e.g., minimal driver):
#   Automatic fallback to LibreHardwareMonitor (LHM) or thermal zone.
#
# NO pip package is required.

# ============================================
# LINUX - ROCm / amdgpu (AUTOMATIC - NO ROCm REQUIRED)
# ============================================
# Linux backend reads AMD GPUs directly from /sys/class/drm/ sysfs.
# NO NEED to install ROCm, pyrsmi, or any packages.
# Just a standard Linux kernel with the amdgpu driver.
#
# NVIDIA on Linux: Parsing nvidia-smi output via subprocess.
# NO additional packages required.

# ============================================
# INSTALLATION SUMMARY PER SCENARIO
# ============================================
#
# +-----------------------+----------------------------------------------------+
# | SCENARIO              | INSTALL COMMAND                                    |
# +-----------------------+----------------------------------------------------+
# | ALL USERS             | pip install -r requirements.txt                    |
# |   (Recommended)       |   (aiohttp + requests + psutil +                   |
# |                       |    pywin32 if Windows)                             |
# +-----------------------+----------------------------------------------------+
# | AMD + APU             | pip install -r requirements.txt                    |
# |                       |   (LHM & DLL handled automatically by the system)  |
# +-----------------------+----------------------------------------------------+
# | NVIDIA                | pip install -r requirements.txt                    |
# |                       | pip install pynvml                                 |
# +-----------------------+----------------------------------------------------+
# | Linux AMD             | pip install aiohttp requests psutil                |
# |                       |   (pywin32 automatically skipped on Linux)         |
# +-----------------------+----------------------------------------------------+
# | Linux NVIDIA          | pip install aiohttp requests psutil                |
# |                       | pip install pynvml (optional)                      |
# +-----------------------+----------------------------------------------------+

# ============================================
# INSTALLATION VERIFICATION
# ============================================
# After installation, run:
#   python -c "from monitor import get_hw_server; srv = get_hw_server(); print('OK')"
#
# If there are no errors, the backend is ready to use.
# The HW Monitor overlay will appear in the top right corner of the ComfyUI browser.