Skip to main content

Module guard

Module guard 

Source
Expand description

Installer guard — structured error handling, logging, progress reporting, and Python version validation.

Ports the core functionality from scripts/lib/installer_guard.sh:

  • InstallerError enum with common failure modes
  • Structured logging with [mlstack][LEVEL] format, NO_COLOR support
  • Progress reporting with step counting
  • Python version validation (3.10+ general, 3.10-3.13 ROCm PyTorch)

§Validation Assertions

  • VAL-INFRA-009: InstallerError enum with common failure modes, implements std::error::Error
  • VAL-INFRA-010: Structured logging with [mlstack][LEVEL] format, NO_COLOR support
  • VAL-INFRA-011: Python version validation (3.10+ general, 3.10-3.13 ROCm PyTorch)
  • VAL-INFRA-012: Progress reporting with step counting

Structs§

ProgressTracker
Progress tracker for multi-step installation processes.
PythonVersion
Parsed Python version (major.minor).

Enums§

InstallerError
Common error types for installer operations.
LogLevel
Log level for structured messages.

Constants§

MAX_ROCM_TORCH_PYTHON
Maximum Python version for ROCm PyTorch wheels (3.13).
MIN_PYTHON_VERSION
Minimum Python version for general ML Stack use (3.10).

Functions§

detect_python_version
Detect the Python version from a binary by running python3 -c "import sys; ...".
is_python_supported
Check if a Python version is supported for general ML Stack use (3.10+).
is_python_supported_for_rocm_torch
Check if a Python version is supported for ROCm PyTorch (3.10-3.13).
log
Write a structured log message to stderr.
log_colored
Write a log message with optional color support.
log_error
Log an error message.
log_info
Log an info message.
log_warn
Log a warning message.