/** * @file Uv project install helpers — the locked-source-of-truth half of the * "uv project + dlx materialize" model. * uv, Astral's Python package manager, drives a uv PROJECT — a directory * with `pyproject.toml` + `uv.lock` (+ optional `[tool.uv] exclude-newer`). * The lock manifests every transitive version, so the project is the most * locked-down, most-version-pinned form a Python tool install can take. * Two entry points, used together: * * 1. `uvSyncProject` — `uv sync --locked --project `. Installs the lock's * exact closure into the project's own `.venv` and FAILS if `uv.lock` is * out of date vs `pyproject.toml` (the `--locked` gate). This is the * verification-grade install: it proves the lock resolves. * 2. `uvExportMaterialize` — `uv export --locked` → a flat, hash-pinned * requirements list, then `uv pip install --target ` into a * content-addressed dlx dir (no venv → no symlinks / absolute `home=`, so * the result is relocatable + SEA-VFS-embeddable). Mirrors * `downloadPipPackage`'s lock-guarded, idempotent shape. Both take an * explicit `uvBin` (typically `resolveUv().path`) and never mutate a * shared interpreter — the project venv and the dlx target are * self-contained. */ /** * Export a uv project's locked closure to a flat requirements list, then * `uv pip install --target` it into a content-addressed dlx dir. The dlx dir * holds plain files and no venv, so it is relocatable and embeddable in a smol * binary's VFS — the bundle-safe analog of `uvSyncProject`'s `.venv`. * * Lock-guarded + idempotent (reuses `pip-install`'s `isAlreadyInstalled` / * `isStaleLock`): a non-empty target dir short-circuits, and concurrent callers * serialize on a `.installing` sentinel one level up from the target. Throws on * a failed uv command or if the lock can't be acquired after MAX_RETRIES. */ export declare function uvExportMaterialize(options: UvExportMaterializeOptions, retryCount?: number): Promise; /** * Content-addressed dlx dir for a uv project's materialized closure: * `~/.socket/_dlx//site-packages`. Keyed on the project * dir so each project gets an isolated target; the analog of `pipPackageDir`. */ export declare function uvProjectTargetDir(projectDir: string): string; /** * Run `uv sync --locked` against a uv project. Installs the lock's exact * dependency closure into the project's `.venv`; the `--locked` flag turns a * lock-vs-manifest drift into a hard non-zero exit rather than a silent * re-resolution — this is what makes it verification-grade. Throws when uv * exits non-zero on drift, a missing lock, or a resolution failure. */ export declare function uvSyncProject(options: UvSyncProjectOptions): Promise; export interface UvSyncProjectOptions { /** * Absolute path to the `uv` executable (typically `resolveUv().path`). */ readonly uvBin: string; /** * Absolute path to the uv project dir (holds `pyproject.toml` + `uv.lock`). */ readonly projectDir: string; /** * Default true — pass `--locked` so a lock-vs-manifest drift fails hard. * Set false ONLY to bootstrap/refresh a lock, never in a verify path. */ readonly locked?: boolean | undefined; } export interface UvExportMaterializeOptions { /** * Absolute path to the `uv` executable. */ readonly uvBin: string; /** * Absolute path to the uv project dir to export from. */ readonly projectDir: string; /** * Override the content-addressed target dir. Defaults to * `uvProjectTargetDir(projectDir)`. */ readonly targetDir?: string | undefined; } export interface UvExportMaterializeResult { /** * `true` when this call ran uv; `false` when an existing install was reused. */ readonly installed: boolean; /** * Directory the closure was installed into. Put this on `PYTHONPATH` to run * the tool: `python -m `. */ readonly targetDir: string; }