/** * Conda Location Discovery (VSCode/PET-style filesystem forensics) * * Finds conda installs and environments WITHOUT executing conda/mamba — * spawning conda boots a full Python interpreter and takes seconds, and the * binary may not even be on PATH for envs created by mamba/micromamba or * from another shell. Instead, everything comes from files conda itself * maintains: * * - ~/.conda/environments.txt — conda appends EVERY env it creates here * (named, path-based `-p` envs, and base), so this single file covers * envs living in arbitrary locations. * - .condarc `envs_dirs`/`envs_path` — user-configured env containers. * - Well-known install roots (~/miniconda3, /opt/homebrew/…, micromamba…). * - CONDA_* / MAMBA_* environment variables. * - conda/mamba/micromamba binaries on PATH — the install root is derived * from the (symlink-resolved) binary location, never by running it. * * A directory IS a conda env iff it has a `conda-meta/` directory (pixi envs * carry a `conda-meta/pixi` marker and are excluded — the pixi locator owns * those). An env is an install root iff it also has `envs/` or `condabin/`. */ export interface CondaLocatorContext { home: string; env: Record; platform: NodeJS.Platform; } export interface CondaEnvLocation { prefix: string; envName: string | null; base?: string; } export declare function defaultCondaContext(): CondaLocatorContext; /** conda-meta/ present, and not a pixi env (conda-meta/pixi marker). */ export declare function isCondaEnv(dir: string): Promise; /** An install root is itself an env (base) that also carries envs/ or condabin/. */ export declare function isCondaInstall(dir: string): Promise; /** Env prefixes recorded by conda itself — one absolute path per line. */ export declare function readEnvironmentsTxt(ctx: CondaLocatorContext): Promise; /** * Minimal .condarc reader for the two keys that name env containers. * Handles block lists and inline `[a, b]` lists; deliberately not a full * YAML parser — these files are flat and hand-written. */ export declare function parseCondaRcEnvDirs(content: string, home: string): string[]; /** Every .condarc-style file worth checking, most specific first. */ export declare function getCondaRcSearchPaths(ctx: CondaLocatorContext): string[]; /** Env container dirs from every .condarc found (envs_dirs / envs_path). */ export declare function getCondaRcEnvDirs(ctx: CondaLocatorContext): Promise; /** Well-known install roots (cheap string candidates; existence checked later). */ export declare function getKnownCondaRoots(ctx: CondaLocatorContext): string[]; /** * Derive install roots from conda-like binaries on PATH: resolve the symlink * (homebrew shims point into Caskroom), then walk out of bin/condabin/Scripts. * The binary is never executed. */ export declare function getCondaRootsFromPath(ctx: CondaLocatorContext): Promise; /** * Locate conda/mamba/micromamba binaries (PATH first, then known roots) for * callers that DO need to run conda — e.g. `conda install -p ` in the * ipykernel install flow. Discovery itself never executes these. */ export declare function findCondaLikeBinaries(ctx?: CondaLocatorContext): Promise; export declare function pythonExeForPrefix(prefix: string, platform: NodeJS.Platform): string; /** Inverse of pythonExeForPrefix: the env prefix a python executable lives in. */ export declare function prefixForPythonExe(pythonPath: string): string; /** First match for an executable name on the context's PATH (fs check only). */ export declare function findExecutableOnPath(name: string, ctx?: CondaLocatorContext): Promise; /** * The full sweep: merge every source, expand install roots and containers, * and return deduped env locations. */ export declare function collectCondaEnvs(ctx?: CondaLocatorContext): Promise;