rules/python/uv_toolchain.js
Developer reference: this page includes exported implementation details. BUILD authors should prefer the User API reference.
UV_TOOL
const UV_TOOL
Undocumented.
uvArtifactName()
uvArtifactName(version, plat)
Return the uv release archive filename for a version and platform.
| Parameter | Type | Description |
|---|---|---|
| version | string | |
| plat | { os: string, arch: string } |
Returns: string
uvDownloadUrl()
uvDownloadUrl(version, plat)
Return the uv release download URL for a version and platform.
| Parameter | Type | Description |
|---|---|---|
| version | string | |
| plat | { os: string, arch: string } |
Returns: string
uvCacheKey()
uvCacheKey(version, plat)
Return the named-cache key for a uv toolchain version and platform.
| Parameter | Type | Description |
|---|---|---|
| version | string | |
| plat | { os: string, arch: string } |
Returns: string
uvSupportedPlatforms()
uvSupportedPlatforms()
Undocumented.
UvToolchain (implementation class)
class UvToolchain
Implementation class. BUILD files should use uvToolchain().
Undocumented.
uvToolchain()
uvToolchain(version, opts = {})
Declare a uv toolchain version and optionally set it as the default. matching lockfile entry (warns instead of failing).
| Parameter | Type | Description |
|---|---|---|
| version | string | |
| [opts] | object | |
| [opts.default=false] | boolean | |
| [opts.unverified=false] | boolean | Allow downloading without a |
Returns: object Target handle for this uv toolchain.
installUvToolchain()
installUvToolchain(version, source)
Install a local uv toolchain directory into the named cache.
| Parameter | Type | Description |
|---|---|---|
| version | string | |
| source | string | Path to the toolchain root. |
Returns: string|null Local path to the cached toolchain root.
acquireUvToolchain
const acquireUvToolchain
Acquire a uv toolchain, downloading and caching it if not already installed in the named cache.
| Parameter | Type | Description |
|---|---|---|
| version | string |
Returns: Promise<string> Local path to the toolchain root.
resolveUvToolchainVersion()
resolveUvToolchainVersion(version)
Resolve an explicit or default uv toolchain version.
| Parameter | Type | Description |
|---|---|---|
| [version] | string |
Returns: string|null
uvCacheDirTool()
uvCacheDirTool()
Return a named-cache-backed tool descriptor mounting uv's shared package/ interpreter cache at a stable path, read-write across every sandbox. Not put on PATH (binDirs empty) — pair with uvCacheDirEnv() to point $UV_CACHE_DIR at its mount path.
Returns: object
uvCacheDirEnv()
uvCacheDirEnv()
Return the run() env entries pointing uv at its shared cache-dir tool mount (see uvCacheDirTool). Any run() using this must also include that tool, or the path won't exist in the sandbox. Values are relative to the sandbox root — callers must export them as absolute paths (capturing $(pwd) before any cd) rather than passing them via run()'s own env:, exactly as zigGlobalCacheEnv()'s doc comment in rules/c/zig/index.js explains for ZIG_GLOBAL_CACHE_DIR. Also pins UV_PYTHON_INSTALL_DIR alongside UV_CACHE_DIR: left at its default, uv's automatic Python management downloads interpreters under the sandbox's own ephemeral $HOME (see src/exec.rs's sandbox_home_tmp) — freshly empty every run, so the interpreter itself is redownloaded (and discarded) every single build, same failure mode ZIG_BUILD_CACHE's doc comment describes for an unpinned ZIG_GLOBAL_CACHE_DIR. Nested under the uv-cache-dir mount rather than its own separate named cache, since it's still uv-managed, content-addressed state safe to share the same way.
Returns: string[]
defaultUvToolchainVersion()
defaultUvToolchainVersion()
Return the currently configured default uv toolchain version.
Returns: string|null
defaultUvToolchain()
defaultUvToolchain()
Return the currently configured default uv toolchain target handle.
Returns: object|null