From c15bb311467614fb18b05fbd42e0e9d824c3265b Mon Sep 17 00:00:00 2001 From: "Abe Diaz (@abe238)" Date: Wed, 31 Dec 2025 01:41:16 -0800 Subject: [PATCH] fix: accept Python 3.12+ in install-backend.js (#443) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: accept Python 3.12+ in install-backend.js The installer was only accepting Python 3.12 exactly. This caused issues for users with Python 3.13 or 3.14 installed, as it would fall back to any available python binary and fail version requirements. Changes: - Accept Python 3.12, 3.13, and 3.14 - Prefer newer versions first (3.14 → 3.13 → 3.12) - Update error message to say "3.12+" instead of "3.12" Fixes #440 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 Signed-off-by: Abe Diaz (@abe238) * refactor: use proper version parsing for Python detection Address code review feedback from Gemini and CodeRabbit: - Replace string matching with regex version parsing for robustness - Handles pre-release versions (3.12rc1, 3.13.0a1) correctly - Future-proof for Python 3.15+ without code changes - Update comment from "Python 3.12" to "Python 3.12+" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 Signed-off-by: Abe Diaz (@abe238) --------- Signed-off-by: Abe Diaz (@abe238) Co-authored-by: Claude Opus 4.5 --- scripts/install-backend.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/scripts/install-backend.js b/scripts/install-backend.js index d1507a08..a90372b7 100644 --- a/scripts/install-backend.js +++ b/scripts/install-backend.js @@ -26,11 +26,11 @@ function run(cmd, options = {}) { } } -// Find Python 3.12 +// Find Python 3.12+ function findPython() { const candidates = isWindows - ? ['py -3.12', 'python3.12', 'python'] - : ['python3.12', 'python3', 'python']; + ? ['py -3.14', 'py -3.13', 'py -3.12', 'python3.14', 'python3.13', 'python3.12', 'python3', 'python'] + : ['python3.14', 'python3.13', 'python3.12', 'python3', 'python']; for (const cmd of candidates) { try { @@ -38,9 +38,17 @@ function findPython() { encoding: 'utf8', shell: true, }); - if (result.status === 0 && result.stdout.includes('3.12')) { - console.log(`Found Python 3.12: ${cmd} -> ${result.stdout.trim()}`); - return cmd; + // Accept Python 3.12+ using proper version parsing + if (result.status === 0) { + const versionMatch = result.stdout.match(/Python (\d+)\.(\d+)/); + if (versionMatch) { + const major = parseInt(versionMatch[1], 10); + const minor = parseInt(versionMatch[2], 10); + if (major === 3 && minor >= 12) { + console.log(`Found Python 3.12+: ${cmd} -> ${result.stdout.trim()}`); + return cmd; + } + } } } catch (e) { // Continue to next candidate @@ -58,11 +66,11 @@ function getPipPath() { // Main installation async function main() { - // Check for Python 3.12 + // Check for Python 3.12+ const python = findPython(); if (!python) { - console.error('\nError: Python 3.12 is required but not found.'); - console.error('Please install Python 3.12:'); + console.error('\nError: Python 3.12+ is required but not found.'); + console.error('Please install Python 3.12 or higher:'); if (isWindows) { console.error(' winget install Python.Python.3.12'); } else if (os.platform() === 'darwin') {