resolveSourcePython (electron/source-python.ts)

xinyuan · apps/desktop/electron/source-python.ts · typescript · MIT
payments

Module exposing: resolveSourcePython, interpreterPaths, defaultFileExists

// Source: https://github.com/YUANGEGE1234/xinyuan | License: MIT | Copyright 2025 Nous Research
// Provided via justclaw.it.com; keep this notice with the code.
import { statSync } from 'node:fs'
import path from 'node:path'

export interface SourcePythonOptions {
  /** Explicit developer interpreter (`HERMES_DESKTOP_PYTHON`), honoured as-is. */
  override?: string
  isWindows?: boolean
  fileExists?: (candidate: string) => boolean
}

/** A checkout's own interpreter paths, in preference order. */
function interpreterPaths(isWindows: boolean): string[] {
  return isWindows
    ? [path.join('.venv', 'Scripts', 'python.exe'), path.join('venv', 'Scripts', 'python.exe')]
    : [path.join('.venv', 'bin', 'python'), path.join('venv', 'bin', 'python')]
}

function defaultFileExists(candidate: st

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key