/** * @file `pythonFromDownload()` — fetches a python-build-standalone CPython into * the DLX cache and returns a `ResolvedPython` pointing at the interpreter. * The `install_only` tarball extracts to a `python/` subdirectory, so the * interpreter lands at `/python/bin/python3` (or * `python/python.exe` on Windows) — no strip. */ import type { BinaryDownloader } from '../from-download.js'; import type { HashInput } from '../../crypto/integrity.js'; import type { ResolvedPython } from './types.js'; export interface PythonFromDownloadOptions { /** * CPython version, e.g. `3.11.14`. */ version: string; /** * Python-build-standalone release tag, e.g. `20260203`. */ tag: string; /** * Target `platform-arch`, e.g. `darwin-arm64`. Omit to auto-detect the * current host via {@link getPythonArch}. */ arch?: string | undefined; /** * Optional pinned integrity (hex SHA-256 or SRI) for the tarball. */ integrity?: HashInput | undefined; /** * Override the extraction directory. Defaults to * `~/.socket/_dlx/python/--`. */ cacheDir?: string | undefined; /** * Inject a custom downloader (tests / alternate cache). Defaults to dlx. */ downloader?: BinaryDownloader | undefined; } /** * Return the absolute path to the interpreter inside an extracted * python-build-standalone tree. The layout follows the TARGET arch, not the * host: a Windows target nests the interpreter at `python/python.exe`, every * other target at `python/bin/python3`. Keying off `process.platform` would be * wrong when cross-resolving (e.g. a Windows host downloading a linux-x64 * build). `arch` is a platform-arch key like `win-x64` / `linux-x64`; omit it * to fall back to the host platform. */ export declare function pythonBinPath(extractedDir: string, arch?: string | undefined): string; /** * Default DLX cache directory for a python build pin. */ export declare function pythonCacheDir(version: string, tag: string, arch: string): string; export declare function pythonFromDownload(options: PythonFromDownloadOptions): Promise;