pm

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 83 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DeclinedExtrasFilename = "declined-extras.json"

DeclinedExtrasFilename is the record of extras dropped with install without

View Source
const DeclinedFilename = "declined-packages.json"

DeclinedFilename records the default packages a user opted out of

View Source
const DefaultConnections = 8

DefaultConnections is the parallel range limit of one download

View Source
const DisabledByUpdateRecord = "disabled_by_update"

Plugins config key mapping each plugin an update disabled to what to undo once it fits

View Source
const EnvDisableLazyInstalls = "ICEBATH_DISABLE_LAZY_INSTALLS"

Environment variable the docker image and hermetic harness set to turn lazy installs off

View Source
const EnvInstallRoot = "ICEBATH_INSTALL_ROOT"

EnvInstallRoot names the tree whose install stamp a steward wrapper keeps outside the binary dir

View Source
const EnvRuntimeDir = "ICEBATH_RUNTIME_DIR"

EnvRuntimeDir points a running process at a non default tool store

View Source
const GCGraceSeconds = 6 * 60 * 60

GCGraceSeconds is how long an untouched partial survives collection

View Source
const ImportHealthEntry = "import-health"

Hidden entry an update's import health probe starts the install binary on, an update process for its dotenv load

View Source
const InstallLockTimeout = 10 * time.Second

InstallLockTimeout is how long a reader of install state waits for a writer before skipping

View Source
const InterruptedPullMarker = "icebath-update-pull"

File an interrupted checkout fast forward leaves in the git dir until its move is repaired

View Source
const LegacyAgentEntry = "__icebath_run_agent__"

LegacyAgentEntry is the argv entry that runs the legacy single query runner the icebath-agent command opens

View Source
const LockSchema = 1

LockSchema is the schema number of lock.json and facts.json

View Source
const MaxLine = 4096

MaxLine bounds one unterminated line, its end being the informative part

View Source
const NPMPublicRegistry = "https://registry.npmjs.org/"

NPMPublicRegistry is the registry lock.json records npm tarballs against

View Source
const PinDefaultHomeFlag = "--icebath-pin-default-home"

Hidden root flag pinning ICEBATH_HOME when unset, to its value or else to the install's default root

View Source
const RetryDownloadRemedy = "check that this machine reaches the address in the error, through its proxy when it uses one, then run the same command again"

RetryDownloadRemedy is the remedy of a download the network or its proxy refused

View Source
const StoreToken = "{{store}}"

StoreToken stands for the store root inside recorded env values

View Source
const TailLines = 80

TailLines is how many output lines a failure prints

View Source
const TermuxIndexURL = TermuxPool + "dists/stable/main/binary-aarch64/Packages"

TermuxIndexURL is the pool's aarch64 package index

View Source
const TermuxPool = "https://packages.termux.dev/apt/termux-main/"

TermuxPool is the Termux main package pool the bionic pins come from

View Source
const TermuxTableName = "termux_runtime_libs.json"

TermuxTableName is the runtime library pin table beside this package

View Source
const TimeoutHint = "uv timed out. If your network needs a package mirror, set index-url in " +
	"pip.conf (bridged to uv automatically) or UV_INDEX_URL; raise UV_HTTP_TIMEOUT " +
	"for slow links."

TimeoutHint tells a user whose uv run timed out how to reach a mirror

View Source
const UndatedIndexHint = "the package index did not report upload times, which locking icebath's " +
	"dependencies needs for its 3-day release-age check. Use https://pypi.org/simple " +
	"or a mirror that serves upload times (pip.conf index-url / UV_INDEX_URL), then retry."

UndatedIndexHint is the remedy when the index omits upload times the release age check needs

View Source
const UserAgent = "Mozilla/5.0 (X11; Linux x86_64) icebath-pm/1.0"

UserAgent is a browser shaped agent every asset CDN accepts, with identity encoding requested

View Source
const WaitForever time.Duration = -1

WaitForever makes a lock wait without a deadline

View Source
const WindowsPython3 = "python3.exe"

POSIX interpreter name the pinned Windows Python also answers to

Variables

View Source
var AllTargets = []string{
	"win32-x64",
	"win32-arm64",
	"linux-x64",
	"linux-arm64",
	"linux-x64-musl",
	"linux-arm64-musl",
	"linux-arm64-bionic",
	"darwin-x64",
	"darwin-arm64",
}

AllTargets lists every platform target PM pins artifacts for

View Source
var Anchors = lockAnchors()

Anchors maps each extra the binary carries to the imports that prove it installed

View Source
var ConfiguredFeaturesMissingDeps func(ctx context.Context) []ConfiguredFeatureGap

Configured platforms whose adapter check fails, assigned by the gateway aware update code

View Source
var CuaDriverChildEnv func() (map[string]string, error)

Computer use driver child environment, set by the extras tier and nil in a build without computer use

View Source
var ForwardedUVSettings = map[string]bool{
	"UV_INDEX_URL": true, "UV_EXTRA_INDEX_URL": true, "UV_DEFAULT_INDEX": true, "UV_INDEX": true, "UV_NO_INDEX": true,
	"UV_FIND_LINKS": true, "UV_INDEX_STRATEGY": true, "UV_KEYRING_PROVIDER": true,
	"UV_NATIVE_TLS": true, "UV_INSECURE_HOST": true, "UV_HTTP_TIMEOUT": true,
}

ForwardedUVSettings are the uv index and transport settings that survive into uv

View Source
var IndexRedirectSettings = map[string]bool{
	"UV_INDEX_URL": true, "UV_EXTRA_INDEX_URL": true, "UV_DEFAULT_INDEX": true, "UV_INDEX": true, "UV_NO_INDEX": true,
	"UV_FIND_LINKS": true, "UV_INDEX_STRATEGY": true, "UV_KEYRING_PROVIDER": true,
}

IndexRedirectSettings redirect where packages resolve from and are stripped by no config isolation

View Source
var JunkNames = map[string]bool{".DS_Store": true, "Thumbs.db": true, "desktop.ini": true, ".localized": true}

JunkNames is inert desktop metadata that never decides a package's layout or digest

View Source
var LooksLikeGatewayCommandLine func(cmdline string) bool

Matches a gateway command line, installed by the gateway status port, nil failing closed

View Source
var MuslTargets = map[string]bool{"linux-x64-musl": true, "linux-arm64-musl": true}

MuslTargets are the native musl userland targets

View Source
var ProxySubprocessEnvAllowlist = []string{
	"PATH", "HOME", "TMPDIR", "TZ", "LANG", "LC_ALL", "LC_CTYPE", "NO_COLOR", "SSL_CERT_DIR", "SSL_CERT_FILE", "SYSTEMROOT", "USERPROFILE",
}

ProxySubprocessEnvAllowlist is the infrastructure only environment an iron-proxy child may see

View Source
var RelayRuntimeSet = &RuntimeSet{extra: relayExtra}

Set the relay environment holds, provisioned only when Relay plugins are switched on

View Source
var ReplaceWhenReleased = func(tmp, dest string, timeout time.Duration) error {
	deadline := time.Now().Add(timeout)
	delay := 100 * time.Millisecond
	for {
		err := renameFile(tmp, dest)
		if err == nil {
			return nil
		}
		if !isAccessError(err) {
			return err
		}
		if !time.Now().Before(deadline) {
			return &chainedError{msg: fmt.Sprintf("The download finished, but another program (usually an antivirus scan) kept %s open and it could not be renamed into place. Please try again.", filepath.Base(tmp)), cause: err}
		}
		time.Sleep(delay)
		delay = min(delay*2, 2*time.Second)
	}
}

Renames a finished download into place, riding out a transient hold until the timeout

View Source
var RetiredDefaults = map[string]string{"agent-browser": "chromium"}

RetiredDefaults carries an old default's opt out over to the package that replaced it

View Source
var StartupImports = [][3]string{
	{"ruamel.yaml", "ruamel.yaml", "YAML"},
	{"python-dotenv", "dotenv", "load_dotenv"},
	{"click", "click", "Command"},
	{"certifi", "certifi", "contents"},
	{"rich", "rich", "print"},
	{"cryptography", "cryptography.hazmat.bindings._rust", "openssl"},
	{"PyJWT", "jwt", "encode"},
}

StartupImports are the distribution, module and attribute triples a dependency environment must import

View Source
var UserFacingCopied = []string{"npm", "node", "python"}

Packages whose packaged dirs a sealed Windows payload swaps for writable copies

Functions

func AcceptWorkerReceipt

func AcceptWorkerReceipt(ctx context.Context, receipt any, updateID *string) error

Files a worker's finished receipt under its update id after checking the correlation

func Activate

func Activate(ctx context.Context, allowIncomplete bool) ([]string, error)

Puts the installed store's tool dirs at the front of the process PATH and returns the check problems

func ActivateDependencies

func ActivateDependencies(ctx context.Context, projectRoot string) error

Selects the committed generation at boot, leasing it and pointing child imports and PATH at it

func ActivationEnvironment

func ActivationEnvironment(ctx context.Context, projectRoot string) ([]string, error)

Environment of the installed PM packages with the committed site packages

func AllPackages

func AllPackages() []string

Sorted names of every registered package

func AnchorImportable

func AnchorImportable(ctx context.Context, anchor string) bool

Reports whether an extra environment or the selected environment holds the module

func AnchorSitePackages

func AnchorSitePackages(ctx context.Context, anchor string) []string

Site packages of every provisioned extra that names the anchor among its imports

func ApplicableRequirements

func ApplicableRequirements(specs []string) ([]string, error)

Index requirements only, direct URLs and the core project itself dropped with markers kept

func ArgparseWidth

func ArgparseWidth() int

ArgparseWidth exports argparseWidth

func Available

func Available(ctx context.Context, extra string) (bool, error)

Reports every anchor of an extra importable here, false in a build that leaves the package manager out

func BaseEnvironment

func BaseEnvironment(env map[string]string) (map[string]string, error)

Environment without ambient interpreter, project and cache selection, index and transport settings kept

func BaseVenv

func BaseVenv(projectRoot string) (string, error)

Payload environment, then the checkout's in tree venv, then the venv path a first install creates

func Bash

func Bash(ctx context.Context) (string, error)

Bash binary commands run with, the store's git bash first, empty when none is available

func BestInMinor

func BestInMinor(versions []string, minor Minor) (string, bool)

Highest version whose major and minor match, ok false when none does

func BinaryInstall

func BinaryInstall() bool

Whether this install is the binary alone, its plugin Python environment built only for a selection declaring packages

func BridgedIndexSettings

func BridgedIndexSettings(ambient map[string]string, sitePrefix string) (map[string]string, error)

Uv index and transport settings the ambient environment asks for, pip knobs translated

func BtbnIndex

func BtbnIndex() (map[string]map[string][2]string, error)

Target to version to tag and asset name map of the newest retained BtbN builds

func BtbnVersions

func BtbnVersions(target string) ([]string, error)

Release versions with a supported BtbN asset for a target, in index order

func CLICommandName

func CLICommandName(projectRoot string) (string, error)

Name a person types to run this install's CLI, a channel build's qualified launcher name included

func CanonicalDefaultName

func CanonicalDefaultName(name string) string

Current name of a default package, a retired name mapping to its successor

func CanonicalizeName

func CanonicalizeName(name string) string

Normalizes a project or extra name like packaging canonicalize_name

func CarriedExtras

func CarriedExtras(ctx context.Context, p StatePackage, recorded []string) ([]string, error)

Recorded extras a sync carries forward, still declared and not dropped with install without

func Check

func Check(ctx context.Context, includeVenv bool) ([]string, error)

Human readable startup diagnostics, one name and reason per problem

func CheckProjectLock

func CheckProjectLock(ctx context.Context, opts CheckProjectLockOptions) error

Checks a project lock is current

func CheckoutGitDir

func CheckoutGitDir(root string) (string, error)

Exported checkoutGitDir

func CheckoutPlaces

func CheckoutPlaces(paths ...string) []string

Exported checkoutPlaces

func ClassifyUVFailure

func ClassifyUVFailure(stage string, code int, output string) error

Classified error of a failed uv stage, a resolver conflict, a build failure or a plain install error

func CmdDoctor

func CmdDoctor(ctx context.Context, repair bool) (int, error)

Checks every locked package's installed state, verification and digest, then the uv cache

func CmdEnv

func CmdEnv(ctx context.Context, names []string) (int, error)

Prints the composed package exports of names, never the caller's environment

func CmdEnvironment

func CmdEnvironment(ctx context.Context, args EnvironmentArgs) (int, error)

Makes a named side environment current and prints only its interpreter on stdout

func CmdGC

func CmdGC(ctx context.Context) (int, error)

Sweeps the writable store, dependency generations, and orphaned install state dirs

func CmdInstall

func CmdInstall(ctx context.Context, args InstallArgs) (int, error)

Installs the tool closure then the venv, the optional defaults last, recording the owning checkout for a full closure

func CmdLock

func CmdLock(ctx context.Context, args LockArgs) (int, error)

Relocks uv.lock with no name, otherwise pins a tool's artifacts in lock.json

func CmdRepair

func CmdRepair(ctx context.Context) (int, error)

Rebuilds the recorded dependency environment without changing its graph

func CmdStatus

func CmdStatus(ctx context.Context) (int, error)

Prints the latest pm receipt in its recorded key order

func CmdUpdate

func CmdUpdate(ctx context.Context, args UpdateArgs, out io.Writer) (int, error)

Runs pm update, re-pinning changed packages unless checking, the termux pool pass running on its own

func CmdUpdateArgs

func CmdUpdateArgs(ctx context.Context, args UpdateArgs) (int, error)

CmdUpdateArgs runs pm update, the driver living in update.go

func CollectGenerations

func CollectGenerations(ctx context.Context, project string, minAge time.Duration) ([]string, error)

Removes unselected lease managed generations older than minAge whose readers have exited

func CollectOrphanInstallStates

func CollectOrphanInstallStates(installs string) ([]string, error)

Removes every unheld orphan state dir under installs, rechecking each under its lock, and returns them

func CollectPartials

func CollectPartials(root string, graceSeconds float64) error

Removes unowned partial pairs older than the grace period, skipping any a downloader owns

func CollectSupersededGenerations

func CollectSupersededGenerations(ctx context.Context, projectRoot string) error

Collects the dependency generations a publish superseded, never failing the committed update

func CommandArgv

func CommandArgv(argv []string) ([]string, error)

Command words of argv as the registered CLI parser splits them, global options removed

func CommittedVenv

func CommittedVenv(ctx context.Context, projectRoot string) (string, error)

Environment PM committed for the install or a sealed payload's own, never the pre PM in tree venv

func CompareVersionKeys

func CompareVersionKeys(a, b []versionKeyPart) int

Orders two version keys the way Python compares their tuples

func ComposeEnv

func ComposeEnv(diffs []EnvDiff, base map[string]string) map[string]string

Composes package env diffs over base, dependents winning and PATH dirs prepended in their order

func ContinueLegacyPostSwap

func ContinueLegacyPostSwap(ctx context.Context, handoffPath string, argvTail []string) (int, error)

Finishes a shipped updater's post swap hand off in a takeover child and returns the child's status

func Copies

func Copies(ctx context.Context, dirs []string) ([]string, error)

Dirs with each packaged npm, node and python dir swapped for its writable copy on a sealed Windows payload

func CoreRequirementError

func CoreRequirementError(ctx context.Context, declaration *PythonDeclaration) (string, error)

Why an applicable icebath-agent requirement of the declaration rejects the running icebath, empty when none does

func CorruptCacheEntries

func CorruptCacheEntries(cache string) map[string][]string

Unpacked cache entries uv cannot install from, package to archive entry names, read only

func CorruptCachedPackages

func CorruptCachedPackages(cache string) map[string]bool

Packages with at least one corrupt unpacked cache entry

func CurrentTarget

func CurrentTarget() (string, error)

Platform target of this host, the libc flavour part of the triple

func DebDataTar

func DebDataTar(name, archive string) ([]byte, error)

The data tar of a deb, zstd payloads decompressed and lzma refused

func DeclineExtras

func DeclineExtras(ctx context.Context, names []string) error

Records install without for extras under the dependency lock so an in flight opt in cannot erase it

func Declined

func Declined(ctx context.Context, projectRoot string) (map[string]bool, error)

Declined default packages, a damaged record refusing rather than re adding a refused package

func DeclinedExtrasPath

func DeclinedExtrasPath(ctx context.Context, projectRoot string) string

Declined extras record of an install, this binary's own tree when projectRoot is empty

func DeclinedPath

func DeclinedPath(ctx context.Context, projectRoot string) string

Opt out record of an install, the binary's own tree when projectRoot is empty

func DefaultPackageNames

func DefaultPackageNames() []string

Every package that may be declined, the default ones of any target

func DefaultPackages

func DefaultPackages(ctx context.Context, names []string, target string, declinedNames map[string]bool) ([]string, error)

Optional defaults among the lockfile's names this install carries, skipping gaps and declined ones

func DependencyHomeRoot

func DependencyHomeRoot(ctx context.Context) string

Data root dependency state is scoped to, the context home override's root when one is active

func DependencyHomes

func DependencyHomes(ctx context.Context) ([]string, error)

DependencyHomes exports the dependency home union for the plugin manager hooks of provider resolution

func DigestMatches

func DigestMatches(root string, recorded *string) (bool, error)

Reports whether a tree matches a recorded digest, including one recorded before metadata was skipped

func DistInstalled

func DistInstalled(req, site string) (installed, known bool)

Whether a distribution the requirement accepts is installed in a site directory, known false when it cannot be probed

func DroppableExtras

func DroppableExtras(projectRoot string) ([]string, error)

Declared extras install without may drop, neither all nor anything all pulls in, every carried extra for a binary install

func DunderVersion

func DunderVersion() string

Install stamp base version of the repo checkout, 0.0.0 when the stamp has none

func DurableWriteBytes

func DurableWriteBytes(path string, data []byte) error

Replaces path atomically and fsyncs file and directory so a crash leaves either old or new bytes

func EdgeBlock

func EdgeBlock(err error) string

Explains a 403 or 429 that a CDN firewall sent instead of the server, empty otherwise

func EnabledMemberDirs

func EnabledMemberDirs(ctx context.Context, selection MemberSelection) ([]string, error)

Selected plugins that install packages, misfits sitting out and a too new manifest refused

func EnabledPluginDirs

func EnabledPluginDirs(ctx context.Context, opts EnabledPluginsOptions) ([]string, error)

Effective plugin selection as distinct plugin trees for the plugin installer

func EncodePluginInput

func EncodePluginInput(p PluginInput) map[string]any

JSON form of a plugin input for the worker request, paths made absolute

func EnsureEnvironment

func EnsureEnvironment(ctx context.Context, opts EnsureEnvironmentOptions) (string, error)

Selects a complete isolated dependency generation, retaining the previous one

func EnsureExtra

func EnsureExtra(ctx context.Context, name string, opts ExtraOptions) (string, error)

Provisions an extra in this process with progress on the output, the step a user switching its feature on runs

func EnsureExtrasEnvironment

func EnsureExtrasEnvironment(ctx context.Context, name string, extras []string, out io.Writer) (string, error)

Side environment NAME holding the pinned packages of the named extras, the pm environment extra mode of a binary install

func EnsureInstallLaunchers

func EnsureInstallLaunchers(ctx context.Context, repoRoot, outDir string) ([]string, error)

Publishes the install's own commands then conveniences in outDir, empty when any own command failed

func EnsureProjectRootOnPath

func EnsureProjectRootOnPath()

Puts the running tree first on the import path, dropping entries that resolve to the same tree

func EnsurePythonTool

func EnsurePythonTool(ctx context.Context, opts EnsurePythonToolOptions) (string, error)

Installs an isolated Python tool and returns its validated executable

func EnsureRuntimeEnvironment

func EnsureRuntimeEnvironment(ctx context.Context, opts RuntimeEnvironmentOptions) (string, error)

Relay environment made to hold the pinned set in this process, the step the user switching Relay on runs

func EnsureToolsForSync

func EnsureToolsForSync(ctx context.Context) error

Publishes every required tool of this tree's lockfile and puts them on PATH before a venv sync

func EntryPointCount

func EntryPointCount() int

Number of commands every install publishes

func EnvFor

func EnvFor(names []string, base map[string]string) map[string]string

Composed env of already installed packages over base, raising only when the store itself cannot be read

func EnvList

func EnvList(env map[string]string) []string

Environment map as sorted KEY=VALUE entries for exec

func EnvironmentPython

func EnvironmentPython(name, root string) (string, bool, error)

Selected interpreter of a named side environment without acquiring tools or writing state, ok false when absent

func EnvironmentRuntimeFactsPath

func EnvironmentRuntimeFactsPath(ctx context.Context, projectRoot string) string

Installed state file of one checkout's dependency state

func EnvironmentStoreRoot

func EnvironmentStoreRoot(ctx context.Context, projectRoot string, honorRuntimeOverride bool) (string, error)

Store of a tree from the context or process runtime override, a payload manifest, an install stamp, or the default root

func ErrorClass

func ErrorClass(err error) string

ErrorClass exports errorClass

func ExeIsVenvBound

func ExeIsVenvBound(exe, venvDir string) bool

ExeIsVenvBound reports a launcher exe embedding the venv interpreter of the pre pm installer, which must be replaced

func ExposeOnPathDisabled

func ExposeOnPathDisabled(ctx context.Context) (bool, error)

ExposeOnPathDisabled exports exposeOnPathDisabled

func ExtraInterpreter

func ExtraInterpreter(ctx context.Context, name string) (string, bool)

Interpreter of a provisioned extra, false when the extra is unknown or not provisioned

func ExtraKey

func ExtraKey(name string) string

PEP 685 name uv matches an extra by, separator runs folded to one dash and lowercased

func ExtraProvisioned

func ExtraProvisioned(ctx context.Context, name string) bool

Whether an extra's environment is provisioned on this install

func ExtraPythonCommand

func ExtraPythonCommand(ctx context.Context, name string) ([]string, error)

Isolated interpreter command of a provisioned extra, an install error naming the command to run when it is missing

func ExtraSitePackages

func ExtraSitePackages(ctx context.Context, name string) (string, bool)

Site packages of a provisioned extra, false when it is not provisioned

func ExtraSupported

func ExtraSupported(ctx context.Context, extra string) (bool, error)

Reports an extra installable on this machine, false in a build that leaves the package manager out

func ExtraSupportedIn

func ExtraSupportedIn(ctx context.Context, extra string, environment map[string]string, importable func(string) bool) (bool, error)

ExtraSupportedIn reports an extra installable under an explicit marker environment and importability probe

func Extract

func Extract(archive, dest string) error

Empties dest and extracts a tar or zip archive chosen by its file name

func ExtractTar

func ExtractTar(r io.ReadSeeker, dest string) error

Extracts a seekable tar stream the way tarfile extractall does under the store extraction filter, unsafe members refused

func ExtractTarFile

func ExtractTarFile(archive, dest string) error

Extracts a tarball file under the one containment policy every PM tar consumer shares

func ExtrasLockPath

func ExtrasLockPath(root string) string

Extras lock of a source checkout, the file pm embeds

func ExtrasRoot

func ExtrasRoot(ctx context.Context) string

Directory of the install state holding one environment per provisioned extra

func FactsPath

func FactsPath(ctx context.Context) (string, error)

Installed state file of the byte store

func FailedCachedPackages

func FailedCachedPackages(output string) map[string]bool

Packages uv failed to install because their cached copy is corrupt, empty for any other failure

func FileDigest

func FileDigest(path string) (string, bool, error)

Hex sha256 of a file with ok false when it does not exist

func FinalizeReceipt

func FinalizeReceipt(ctx context.Context, outcome string, exitCode int, token *ReceiptToken) string

Writes and rotates the receipt, a token restoring the outer receipt and panicking on reuse or another scope

func FlattenSingleDir

func FlattenSingleDir(dest string) error

Hoists a lone top level directory's contents unless it is the layout, refusing on any collision

func GetText

func GetText(url string, headers map[string]string) (string, error)

Text of an index URL read with credentialed open, index headers, the operation's response cache and retries

func GitArgvBytes

func GitArgvBytes(cmdline []byte) []string

Exported gitArgvBytes for the probe tests of other packages

func GitNeverLocks

func GitNeverLocks(sub string) bool

Reports whether a subcommand is a daemon that never takes a lock

func GitProgram

func GitProgram(arg0 string) string

Exported gitProgram for the lock sweeps of other packages

func GitSubcommandOf

func GitSubcommandOf(cmdline []string) string

Exported gitSubcommandOf

func GitWorksIn

func GitWorksIn(args []string, cwd string, env map[string]string, places []string) bool

Reports whether a git works in places by cwd, a path argument or a GIT_DIR style variable

func GithubReleaseTags

func GithubReleaseTags(repo, stripPrefix string) ([]string, error)

Newest first version shaped release tags of a GitHub repo, a prefix stripped and drafts and prereleases skipped

func HashURL

func HashURL(rawURL string) (string, error)

Streams a URL's content into sha256, the way pm lock pins an artifact

func ImportPathEntries

func ImportPathEntries() []string

ImportPathEntries exports importPathEntries

func IndexLockHolder

func IndexLockHolder(gitDir, root string) string

Exported indexLockHolder

func InstallConfiguredFeaturesMissingDeps

func InstallConfiguredFeaturesMissingDeps(ctx context.Context, projectRoot string) error

Adds the extras configured features need to the dependency environment, then lists the features still missing theirs

func InstallHint

func InstallHint(extra string) string

The one command users run for a missing extra

func InstallKey

func InstallKey(projectRoot string) string

First sixteen hex digits of the sha256 of the resolved checkout path

func InstallLibatomicBeforeLock

func InstallLibatomicBeforeLock(ctx context.Context)

Installs libatomic interactively before PM takes its lock, only where sudo would actually prompt

func InstallNodeSidecar

func InstallNodeSidecar(ctx context.Context, pluginDir string, explicit bool) string

Installs a plugin's Node dependencies with PM's npm, returning a diagnostic or empty on success

func InstallPackage

func InstallPackage(ctx context.Context, p Package, lockfile *Lockfile, facts *Facts, store *Store, target string, opts InstallPackageOptions) (string, error)

Realizes one pin, host installs committing facts and cross target stages carrying a pin marker

func InstallRoot

func InstallRoot() string

Tree whose install stamp belongs to this process, the steward override or the binary dir

func InstallRuntimeCommand

func InstallRuntimeCommand(repoRoot string, args []string, opts LaunchCommandOptions) []string

Installation bound argv safe to persist, the install binary pinning its home before the subcommand and args

func InstallStampPath

func InstallStampPath(projectRoot string) string

Install stamp shared by every stamp reader, the executing tree resolving through the install root

func InstallStateDir

func InstallStateDir(ctx context.Context, projectRoot string) string

Dependency state directory of one checkout

func InstallStatePermissionMessage

func InstallStatePermissionMessage(ctx context.Context, projectRoot string, err error) string

Describes an access failure inside this install's dependency state, empty when the failure lies elsewhere

func InstallationCommand

func InstallationCommand(repoRoot string, args []string, opts LaunchCommandOptions) []string

Persisted install command, the install's own binary when present and the runtime command otherwise

func InstallsRoot

func InstallsRoot(ctx context.Context) string

Directory holding every checkout's dependency state

func InterruptedPullMarkerPath

func InterruptedPullMarkerPath(root string) (string, error)

Path of the interrupted pull marker inside root's git dir

func IronProxyAllowlistedEnv

func IronProxyAllowlistedEnv() map[string]string

Infrastructure only environment of this process, never the operator's secrets

func IsDownloadKind

func IsDownloadKind(err error, kind DownloadErrorKind) bool

Reports whether err is a downloader failure of the given kind

func IsForwarded

func IsForwarded(key string) bool

Reports whether an ambient uv setting crosses into uv, index credentials matching by prefix

func IsIndexRedirect

func IsIndexRedirect(key string) bool

Reports whether a setting redirects package resolution rather than shaping transport

func IsInstalled

func IsInstalled(ctx context.Context, name string) (bool, error)

Reports whether the current pin of a package is installed

func IsJunction

func IsJunction(path string) bool

Reports a Windows mount point reparse tag, false for anything that cannot be inspected or on POSIX

func IsSealedTree

func IsSealedTree(projectRoot string) (bool, error)

IsSealedTree exports isSealedTree

func IsTransient

func IsTransient(err error) bool

Reports whether a failure is a transient network condition worth retrying

func KnownExtras

func KnownExtras() []string

Canonical names of every extra the binary carries, sorted

func LastCompletedObject

func LastCompletedObject(ctx context.Context) *pyjson.Object

Insertion ordered deep copy of the last receipt finalized in this scope

func LastForUpdate

func LastForUpdate(ctx context.Context, updateID string, consume bool) map[string]any

Last receipt completed in this scope under an update id, optionally consuming it

func LastForUpdateObject

func LastForUpdateObject(ctx context.Context, updateID string, consume bool) *pyjson.Object

Insertion ordered form of the last receipt completed under an update id, optionally consuming it

func LatestReceipt

func LatestReceipt(ctx context.Context) map[string]any

Newest receipt of any kind, a pure read that never creates the receipts dir

func LauncherBinary

func LauncherBinary(target string) string

LauncherBinary exports launcherBinary

func LauncherStart

func LauncherStart(repoRoot string, args []string) ([]string, bool)

Launcher steps before the bootstrap, argv returned without a runtime command's leading home pin and whether it had one

func LaunchersMain

func LaunchersMain(ctx context.Context, repoRoot string, argv []string, stdout, stderr io.Writer) int

Prints the runtime command or publishes the install's launchers into an output directory

func LazyInstallsAllowed

func LazyInstallsAllowed() bool

Reports whether PM may install on demand for the process home and environment

func LazyInstallsAllowedFor

func LazyInstallsAllowedFor(ctx context.Context) bool

Reports whether PM may install on demand under a context's home and worker policy, a broken config failing closed

func LeaseDirectory

func LeaseDirectory(generation string) (func(), error)

Pins a lease managed generation directory until release or process exit

func LeaseGeneration

func LeaseGeneration(environment string) (func(), error)

Pins a generation's parent directory for this process, the returned release letting go early

func LeasesHeld

func LeasesHeld(generation string) (bool, error)

Reports whether any process still holds a lease on the generation

func LegacyPostSwapInvocation

func LegacyPostSwapInvocation(argv []string) (string, []string, bool)

Hand off file and update flags of the exact fresh checkout command shipped updaters emit

func LegacySelection

func LegacySelection(ctx context.Context, projectRoot string) ([]string, error)

Extras PM's first generation selects when replacing a pre PM venv, all plus every supported opt in it held

func LiveCheckoutUnderTest

func LiveCheckoutUnderTest(root string) bool

Reports root as the checkout this binary runs from while go test or a pytest case drives the process

func LlamaAppBucketVersions

func LlamaAppBucketVersions() []string

Build numbers the llama installer bucket tree lists, newest first, empty when unreachable

func LlamaAppLatest

func LlamaAppLatest() (string, bool)

Build tag the llama installer's latest pointer resolves to as a bare build number, ok false when unreachable

func LoadPackageDefinitions

func LoadPackageDefinitions(definitions []PackageDefinition) error

Restores explicit registrations by identity, refusing any this binary does not carry

func LockAndSync

func LockAndSync(ctx context.Context, pluginDirs []MemberDir, extras []string, opts LockAndSyncOptions) error

Prepares a fresh generation from explicit inputs or a recorded workspace and syncs it with the prepared engine

func LockFD

func LockFD(f *os.File, wait bool, timeout time.Duration) (bool, error)

Takes the exclusive byte lock, polling until the timeout, WaitForever never gives up and zero tries once

func LockPath

func LockPath(path string, timeout time.Duration, createDir bool) (*os.File, error)

Opens or creates path and returns it with its lock held, nil when the wait expired

func LockProject

func LockProject(ctx context.Context, opts LockProjectOptions) error

Resolves a project's lock without creating or selecting an environment

func LockUsageError

func LockUsageError(args LockArgs) string

LockUsageError is the pm lock usage refusal for a bump name without a version or the reverse

func LockfilePath

func LockfilePath() string

Path of the lockfile pm lock writes and every install reads

func LongRoot

func LongRoot(path string) string

Spells a PM owned root in extended length form on Windows so deep paths beneath it survive MAX_PATH

func MachineMatchesBinary

func MachineMatchesBinary(bin, target string) (match bool, known bool)

Reports whether the executable's architecture matches target, known false for scripts and shims

func Main

func Main(ctx context.Context, command func(context.Context) (int, error)) (code int, err error)

Runs one pm command, reporting install errors and install state permission failures with status 1

func ManagerLinked

func ManagerLinked() bool

Whether this build links the package manager, false where plugin changes publish with no dependency environment

func ManifestVersionError

func ManifestVersionError(manifest map[string]any, name string) (string, error)

Why a manifest cannot load here, its required icebath version or a manifest_version newer than supported

func MarkerOwnerIsLive

func MarkerOwnerIsLive(marker string) (bool, error)

MarkerOwnerIsLive exports markerOwnerIsLive

func MartinRiedlIndex

func MartinRiedlIndex() map[string]map[string]string

Target to version to epoch map of the martin riedl ffmpeg builds page

func MartinRiedlVersions

func MartinRiedlVersions(target string) []string

Release versions the martin riedl page lists for a target, in page order

func MembersStamp

func MembersStamp(pluginDirs []MemberDir) (string, error)

Hash of the member inputs a generation copies, keyed by identity so staging paths never change it

func MergeTree

func MergeTree(src, dst string) error

Moves src's files into dst keeping both layouts, a file present in both failing loudly

func MissingCompilerRemedy

func MissingCompilerRemedy(output string) string

Install hint for a build that failed because no compiler exists, empty otherwise

func MustRegister

func MustRegister(p Package)

Registers a package from an init function, panicking on a definition without a name

func NPMRegistry

func NPMRegistry(env map[string]string) string

Registry npm resolves for this environment, npm_config_registry beating the user npmrc

func NPMRegistryURL

func NPMRegistryURL(rawURL string, env map[string]string) string

A public npm registry URL rebased onto the configured registry, other URLs unchanged

func Native

func Native(path string) string

Ordinary spelling of a path for argv, environment values, records and messages

func NativeManifestFile

func NativeManifestFile(pluginDir string) (string, error)

Native plugin.yaml or plugin.yml of a plugin dir, empty when neither exists

func NativeManifestFileFS

func NativeManifestFileFS(tree fs.FS, pluginDir string) (string, error)

Native plugin.yaml or plugin.yml of a plugin dir inside a tree, empty when neither exists

func NodeLatestVersions

func NodeLatestVersions() ([]string, error)

Newest first node versions from nodejs.org's index

func NormalizePackageName

func NormalizePackageName(name string) string

PEP 503 normal form, the spelling uv's cache uses

func NpmDistTags

func NpmDistTags(name string) (map[string]any, error)

Dist tags of an npm package from the configured registry

func NpmEnv

func NpmEnv(cacheDir string, base map[string]string) map[string]string

Environment for PM's npm child with ambient Node and npm options removed and its cache pinned

func OverriddenVersions

func OverriddenVersions(lock string) (map[string]map[string]bool, error)

Locked versions of every dependency the lock's manifest overrides, keyed by normalized name

func OverrideCoreRepo

func OverrideCoreRepo(root string) (restore func())

Points the core project root at dir until restore runs, the way tests patch the repo root

func OverridePublicationWrite

func OverridePublicationWrite(fn func(path string, data []byte) error) (restore func())

Routes every publication durable write through fn until restore runs, the way tests patch durable_write_bytes

func OverrideUVToolchain

func OverrideUVToolchain(uv, python string) (restore func())

Answers every toolchain lookup with the given uv and python binaries until restore runs, the way tests patch _toolchain

func OwningHomeRoot

func OwningHomeRoot(ctx context.Context, projectRoot string) string

Data root owning a borrowed checkout's committed state, empty when the active root's state is that state

func OwnsLauncher

func OwnsLauncher(target, root string) bool

OwnsLauncher exports ownsLauncher

func OwnsUserPath

func OwnsUserPath(root string) bool

True when new consoles resolve root, so it may put its commands on the User PATH

func PackageOf

func PackageOf(rawURL string) (string, error)

Pool package a pinned URL names, empty for any other source, an error where urlsplit raises

func ParseRequirement

func ParseRequirement(text string) (*pyRequirement, error)

Parses a dependency specifier like packaging Requirement

func ParseTermuxIndex

func ParseTermuxIndex(text string) map[string]PoolPackage

Package name to served archive from the RFC822 style index, stanzas without file or hash dropped

func PartialLock

func PartialLock(root, key string, cancelled func() bool, wait bool) (release func(), acquired bool, err error)

Takes the cross process ownership lock of one partial key, the release closing it

func PartialsRoot

func PartialsRoot() string

Machine scoped downloader partials area under the default root, writable even when the store is sealed

func PatchRepoRoot

func PatchRepoRoot(dir string) func()

Makes dir the tree the running binary reports until the returned restore runs

func PayloadCommandDir

func PayloadCommandDir(projectRoot string) (string, error)

Directory holding a sealed payload's own launchers, empty for every other tree

func PayloadVenv

func PayloadVenv(projectRoot string) (string, error)

Environment a sealed payload ships beside its tree, empty when there is none

func PbsVersions

func PbsVersions(minor, triple string) ([]string, error)

Exact interpreter identity the newest matching python build standalone release advertises

func PinLauncherHome

func PinLauncherHome()

Pins an unset ICEBATH_HOME to the install's default root, the home every launch of an install command settles on

func PinnedBuildDefaults

func PinnedBuildDefaults(python string, env map[string]string) (map[string]string, error)

Defaults for build variables the pinned interpreter records but this host lacks

func PinnedPythonFullVersion

func PinnedPythonFullVersion() (string, error)

Full version of the pinned Python PM builds environments with, a RuntimeError when the lock pins none

func PinnedPythonVersion

func PinnedPythonVersion() (major, minor string, err error)

Major and minor version of the pinned Python for callers outside pm, a RuntimeError when the lock pins none

func PipConfIndexURL

func PipConfIndexURL(env map[string]string, sitePrefix string) (string, error)

Index URL from the global section of pip config files, a decode failure raising like Python

func PipConfigCandidates

func PipConfigCandidates(env map[string]string, sitePrefix string) []string

Pip config files lowest precedence first, sitePrefix naming the interpreter whose site file applies

func PluginSpellings

func PluginSpellings(pluginDir, key string) (map[string]bool, error)

Spellings of a plugin directory and key that other packages match against plugins.disabled

func PoolAssetName

func PoolAssetName(rawURL, sha string) string

Asset name a pool archive is republished under, its sha256 keeping the name unique and free of special characters

func PrepareWindowsEnvironment

func PrepareWindowsEnvironment(source, state string, env map[string]string) (map[string]string, error)

Runs the checkout's Windows ARM64 build dependency provider and returns the environment it prepared

func ProbeReason

func ProbeReason(bin string, exitCode int, stdout, stderr []byte) string

Why a version probe failed, its exit code plus the tail of its output

func ProjectPython

func ProjectPython(ctx context.Context, projectRoot string) (string, error)

Interpreter of the install's selected dependency environment

func ProjectVenvDir

func ProjectVenvDir(root string) (string, error)

ProjectVenvDir exports projectVenvDir

func PruneSitePth

func PruneSitePth(venv string)

Drops the pth files that must never run inside a shipped payload, keeping every other one

func PublishLaunchers

func PublishLaunchers(ctx context.Context, projectRoot string, create bool) error

PublishLaunchers exports publishLaunchers

func PythonTool

func PythonTool(name, executable, root string) (string, bool, error)

Selected tool entry point of a named side environment, never an installer executable

func ReadBytesOrNone

func ReadBytesOrNone(path string) ([]byte, bool, error)

File bytes with ok false when the file does not exist, other read failures returned as errors

func ReadGitRevisionFingerprint

func ReadGitRevisionFingerprint(repoRoot string) (string, bool)

Cheap checkout fingerprint read from git metadata without spawning git, false on any OSError

func ReadHomeSelection

func ReadHomeSelection(ctx context.Context, homeDir string) (map[string]any, error)

Plugin and memory selection a home's config declares, nil when the home has no config yet

func ReadInstallStamp

func ReadInstallStamp(projectRoot string) *pyjson.Object

Install stamp of a tree as a JSON object, empty when missing, unreadable or not an object

func ReadNativeManifest

func ReadNativeManifest(path string) (map[string]any, error)

Parsed native manifest, empty YAML an empty mapping and anything else but a mapping refused

func ReadNativeManifestFS

func ReadNativeManifestFS(tree fs.FS, name string) (map[string]any, error)

Manifest mapping of a native manifest inside a tree, read and decoded the way ReadNativeManifest reads a file

func RecordDeclined

func RecordDeclined(ctx context.Context, add, remove []string, projectRoot string) (map[string]bool, error)

Updates the recorded opt outs, writing only on change, and returns the new set

func RecordFeatureList

func RecordFeatureList(ctx context.Context, extras []string)

Records the selected extras, nil standing for none recorded

func RecordPluginChecks

func RecordPluginChecks(ctx context.Context, results []any)

Records plugin update check results, each serialized when it knows how

func RecordRefusal

func RecordRefusal(ctx context.Context, code, detail string)

Records why this sync refused to act

func RecordStep

func RecordStep(ctx context.Context, name string, ok bool, detail string)

Records one named step and its result

func RecordVenvRebuild

func RecordVenvRebuild(ctx context.Context, ok bool, reason string)

Records whether the dependency environment rebuild succeeded and why

func RecordWarning

func RecordWarning(ctx context.Context, message string)

Records a warning that reached the user during this sync

func RecoverIfNeeded

func RecoverIfNeeded(ctx context.Context, projectRoot string, argv []string, explicit bool) (bool, error)

RecoverIfNeeded exports recoverIfNeeded

func RefreshDependencies

func RefreshDependencies(ctx context.Context, projectRoot string) (string, error)

Re-resolves the durable selection after an external update replaced its inputs and reports what happened

func Register

func Register(p Package) error

Registers a package definition under its name, a later registration of the same name winning

func RelayVenv

func RelayVenv(ctx context.Context) string

Environment the relay runtime set lives in, inside the install state and apart from the plugin environment

func ReleaseAllLeases

func ReleaseAllLeases()

Releases every lease this process still holds, for the binary to call as it exits

func ReleaseAssetURL

func ReleaseAssetURL(name string) string

Asset URL on the release of this build, a source build reading the latest release

func ReleaseDeadLock

func ReleaseDeadLock(lock, root string, anyGit bool) (bool, error)

Exported releaseDeadLock

func RemoveCorruptEntries

func RemoveCorruptEntries(cache string, names map[string]bool) error

Deletes the corrupt archive entries of names that uv cache clean left behind, under uv's cache lock

func RemoveExtra

func RemoveExtra(ctx context.Context, name string) error

Deletes an extra's environment so nothing of it stays on disk

func RemoveTree

func RemoveTree(path string) error

Removes a tree, refusing a missing path, a symlink or a junction the way shutil rmtree does

func RepairDependencies

func RepairDependencies(ctx context.Context, projectRoot string) error

Restores this installation's recorded dependency set and collects what the repair superseded

func RepairTermuxPins

func RepairTermuxPins(table *OrderedObject, lockfile *Lockfile, stale []Retired, verify func(string) (string, error)) (int, error)

Repins every retired row to the pool's current archive after hashing its bytes, returning the count

func RepoRoot

func RepoRoot() string

Tree the running binary lives in

func RequirementAppliesHere

func RequirementAppliesHere(ctx context.Context, req string) bool

Whether the environment marker of a requirement admits this machine, true for one no marker probe can judge

func RequirementDistName

func RequirementDistName(req string) string

Distribution name a requirement string starts with

func ResolveInstallBinary

func ResolveInstallBinary(root string) string

Install binary of a tree when present as a regular file, empty for an externally owned runtime

func RetryHeld

func RetryHeld(operation func() error) error

Runs a rename like mutation and rides out transient Windows holds for about three seconds

func RetryNetwork

func RetryNetwork[T any](operation func() (T, error), opts RetryOptions) (T, error)

Retries a whole idempotent request on transient failures, durable progress renewing the budget

func ReuseIndexResponses

func ReuseIndexResponses[T any](operation func() (T, error)) (T, error)

Runs one resolve or pin operation sharing successful index reads only inside it

func RunContained

func RunContained(cmd *exec.Cmd, label string, opts ContainOptions) (string, error)

Runs a prepared child under the output policy and returns its captured output, failing on nonzero exit

func RunningFromSelectedEnvironment

func RunningFromSelectedEnvironment(ctx context.Context, projectRoot string) (bool, string, error)

Exported form for pkg/memory setup, same answer as the package function

func RuntimeEnvironment

func RuntimeEnvironment(ctx context.Context) (map[string]string, error)

Environment of an isolated runtime child, ambient interpreter selection stripped and the home and store pinned

func RuntimeEnvironmentReady

func RuntimeEnvironmentReady(ctx context.Context) (string, bool, error)

Relay environment and whether it holds the pinned set with no provisioning changing it or left unfinished

func RuntimeFactsPath

func RuntimeFactsPath(ctx context.Context) string

Installed state file of this binary's own dependency state

func RuntimeLock

func RuntimeLock(ctx context.Context, project string, timeout time.Duration) (held bool, release func(), err error)

Holds the per install dependency lock, held false when the wait expired

func RuntimeSetStore

func RuntimeSetStore(venv string) string

Store beside the environment with its own facts, holding the interpreter and uv the environment is built on

func SaveTermuxTable

func SaveTermuxTable(table *OrderedObject, path string) error

Writes the pin table indented in its key order with a trailing newline

func Sealed

func Sealed(ctx context.Context) (bool, error)

Reports the bundled layout, a store beside the bundle manifest that ships read only

func SealedDirs

func SealedDirs(ctx context.Context, name string) ([]string, error)

PATH dirs of the sealed store's install of a package, none when it is not installed there Sealed payload dirs holding a package's executables, the exported face for pkg/mcp

func SelectedPluginDir

func SelectedPluginDir(pluginsDir, name, installing string) (string, error)

Tree a selection key names, the home's own plugins dir first then the bundled plugins, empty when neither has it

func SelectedSitePackages

func SelectedSitePackages(ctx context.Context) (string, error)

Site packages directory of the dependency environment the install currently selects

func SelectedVenv

func SelectedVenv(ctx context.Context, projectRoot string) (string, error)

Committed environment of the install, or its original environment before the first sync

func ServeWorker

func ServeWorker(ctx context.Context, controls io.ReadCloser, wire io.Writer) error

Serves one JSON line PM request read from controls, writing callbacks and the result to wire

func SetBuildTag

func SetBuildTag(version string)

Records the version stamped into the binary so pool archives resolve to that release's copies

func SetCommandArgv

func SetCommandArgv(split func([]string) []string)

Installs the CLI parser's split of top level flags from the command a launch runs

func SetPluginManifestHost

func SetPluginManifestHost(host *PluginManifestHost)

Installs the plugin manifest surface that declarations, admission and fit checks read

func SetUpdateLockHooks

func SetUpdateLockHooks(hooks UpdateLockHooks)

Installs the checkout lock calls a takeover child is bound, resumed and handed lock descriptors through

func SetUpdateReceiptHooks

func SetUpdateReceiptHooks(hooks UpdateReceiptHooks)

Installs the receipt call an incomplete handoff records its stop reason with

func ShouldSkipExternalSecretSources

func ShouldSkipExternalSecretSources() bool

Reports an update process, whose dotenv loads must never resolve external secret sources

func SignManagedPython

func SignManagedPython(python string) bool

Ad hoc signs a managed Python with a stable identifier on macOS, false elsewhere or when signing fails

func SitePackages

func SitePackages(venv string) (string, error)

Site packages directory of a venv for the interpreter version the tree actually holds

func SourceInstallPackages

func SourceInstallPackages(names []string) ([]string, error)

Supported required roots for a source install, optional and internal tools entering only on request or through dependencies

func SpecifierSetAdmits

func SpecifierSetAdmits(spec, version string) (admits, invalid bool, err error)

Whether a PEP 440 specifier set admits version with prereleases allowed, invalid true for an unparsable set

func StageLauncher

func StageLauncher(ctx context.Context, name, root, outDir string) (string, error)

StageLauncher exports stageLauncher

func StopForRelaunchIncomplete

func StopForRelaunchIncomplete(ctx context.Context) error

Stops an update that has no completion request, naming the old version handoff and exiting 1

func StoreFirstPath

func StoreFirstPath(ctx context.Context, path string) (string, error)

PATH with the installed store's tool dirs moved to the front for children that prepend after activation

func StorePathDirs

func StorePathDirs(ctx context.Context) ([]string, error)

Deduped PATH dirs of installed store packages whose whole chain is installed, dependents first

func StoreRoot

func StoreRoot(ctx context.Context) (string, error)

Byte store of this process for the binary's own tree

func SwapAnchorImportable

func SwapAnchorImportable(fn func(ctx context.Context, anchor string) bool) func(ctx context.Context, anchor string) bool

SwapAnchorImportable installs the anchor importability probe, returning the one it replaced

func SwapCountsAsHolder

func SwapCountsAsHolder(fn func(args []string, anyGit bool) bool) func(args []string, anyGit bool) bool

Replaces the holder rule the probes consult and returns the previous one

func SwapExposeCLI

func SwapExposeCLI(fn func(ctx context.Context, projectRoot string, create bool) (ExposeResult, error)) func(ctx context.Context, projectRoot string, create bool) (ExposeResult, error)

Replaces the PATH exposure of the launcher refresh and returns the previous one

func SwapInstallCommandSteps

func SwapInstallCommandSteps(steps InstallCommandSteps) func()

Replaces the install command steps until the returned restore runs

func SwapLockRunner

Replaces the subprocess runner of the lsof and ps probes and returns the previous one

func SwapLockWhich

func SwapLockWhich(fn func(name string) (string, bool)) func(name string) (string, bool)

Replaces the executable lookup of the lsof and ps probes and returns the previous one

func SwapLockfilePath

func SwapLockfilePath(fn func() string) func() string

Replaces the lockfile path every install reads and returns the previous lookup

func SwapPlatformGates

func SwapPlatformGates(gates map[string]string) map[string]string

SwapPlatformGates installs the extra to marker table the gates read, returning the table it replaced

func SwapPublishOwnLaunchers

func SwapPublishOwnLaunchers(fn func(ctx context.Context, repoRoot, outDir string) ([]string, error)) func(ctx context.Context, repoRoot, outDir string) ([]string, error)

Replaces the own command publication of the launcher refresh and returns the previous one

func SwapToolchain

func SwapToolchain(fn func(context.Context, bool, bool) (string, string, bool, error)) func(context.Context, bool, bool) (string, string, bool, error)

Replaces the toolchain lookup the Python environment engine calls and returns the previous one

func SwapUpdateResolution

func SwapUpdateResolution(resolve func(Package, []string, *string, map[string]any) (*Resolved, error),
	pin func(Package, *Resolved, map[string]any) (map[string]any, error)) func()

Replaces the release resolver and the artifact pinner of the update driver until the returned restore runs

func SyncOutput

func SyncOutput(ctx context.Context) io.Writer

Writer a dependency sync prints operator messages to, the process stdout unless redirected

func SyncVenv

func SyncVenv(ctx context.Context, opts SyncVenvOptions) error

Syncs an application caller's dependency environment, a foreign checkout through its worker, a projectless tree to its runtime set

func TermuxTablePath

func TermuxTablePath() string

Path of the runtime library pin table

func ToolRoots

func ToolRoots(names []string) ([]string, error)

Packages to publish before a venv sync, which is not one of them

func Toolchain

func Toolchain(ctx context.Context, realize, explicit bool) (uv, python string, found bool, err error)

Pinned uv and Python binaries without host discovery, a read only probe reporting found false instead of installing

func TreeDigest

func TreeDigest(root string) (string, error)

Deterministic sha256 over a tree, skipping desktop metadata and bytecode caches

func TryInstallLibatomic

func TryInstallLibatomic(ctx context.Context) (bool, string)

Tries the distro libatomic package once per process and returns whether it ran and the remedy hint

func UnexpectedIncompatibilities

func UnexpectedIncompatibilities(report, lock string) ([]string, error)

Report lines a lock does not account for, nil when the report cannot be read line by line

func UnlockFD

func UnlockFD(f *os.File)

Releases the byte lock ignoring failures since closing the file releases it as well

func UnpackDeb

func UnpackDeb(name, archive, staged string) error

Stages a deb by ar and tar extraction under the one tar containment policy

func UnsupportedRequirements

func UnsupportedRequirements(specs []string) ([]string, error)

Requirements that name a direct URL, which the shared environment refuses

func UpdateMechanisms

func UpdateMechanisms() []string

Install stamp updateMechanism values a build lane may write, as a fresh slice

func UpdateRetryRecovered

func UpdateRetryRecovered() bool

Reports whether the last startup repair ran for an update command

func UserFacingApplies

func UserFacingApplies(ctx context.Context) (bool, error)

Reports a sealed payload on Windows, the only layout whose packaged executables user commands cannot start

func UserFacingPath

func UserFacingPath(ctx context.Context, path string) (string, error)

PATH with the store's tool dirs moved behind the user's entries, PM Python stopping just before the Store alias dir

func UvCacheDir

func UvCacheDir(ctx context.Context) (string, error)

Machine scoped uv cache, merged once per uv.lock from the payload's shipped cache before it is used

func UvCachePath

func UvCachePath() string

Machine scoped uv cache under the default root, never seeded or written here

func UvLauncher

func UvLauncher(ctx context.Context, name string) (string, error)

Installed uv or uvx launcher for a user declared MCP stdio command, empty when it is not installed

func ValidateEnvironment

func ValidateEnvironment(ctx context.Context, python string, argvPrefix []string, env map[string]string, cwd string) error

Runs the startup import checks inside a candidate, through its argv prefix or else its isolated interpreter

func VenvBinDir

func VenvBinDir(venv string, windows bool) string

Scripts on Windows and bin elsewhere, returned whether or not the venv exists

func VenvCommand

func VenvCommand(ctx context.Context, projectRoot, venv string, options []string) ([]string, error)

Argv prefix running Python inside a venv, a sealed payload's venv first healed onto the payload's store interpreter

func VenvIsCurrent

func VenvIsCurrent(ctx context.Context, opts VenvIsCurrentOptions) (bool, error)

Probes dependency currency without bootstrapping, a cold foreign worker answering not current

func VenvPython

func VenvPython(venv string) string

Interpreter inside a venv laid out for this platform, which may not exist

func VenvPythonVersion

func VenvPythonVersion(venv string) (major, minor string, ok bool, err error)

Major and minor version a POSIX venv holds from pyvenv.cfg or its lib directory, ok false when neither says

func VerboseOutput

func VerboseOutput(env map[string]string) bool

Reports whether child output streams unchanged, forced by ICEBATH_VERBOSE or implied by CI

func VersionKey

func VersionKey(version string) []versionKeyPart

Sortable key of a version, numeric segments before alphabetic ones so a prerelease never beats its release

func WindowsBashCandidates

func WindowsBashCandidates(onPath string, env map[string]string) []string

Ordered bash.exe candidates for a Windows host, the override and Git roots first and a launcher PATH bash never

func WindowsBinLaunchers

func WindowsBinLaunchers() []string

WindowsBinLaunchers lists the launcher names the managed bin directory publishes

func WithCLIStderr

func WithCLIStderr(ctx context.Context, w io.Writer) context.Context

Context whose pm command errors print to w instead of the process stderr

func WithIcebathNodePath

func WithIcebathNodePath(env map[string]string) map[string]string

Installed pm npm and its Node dependency composed over env without provisioning anything

func WithReceiptScope

func WithReceiptScope(ctx context.Context) context.Context

Context with a fresh receipt scope whose bindings copy the parent's, so records stay local to it

func WithRuntimeStore

func WithRuntimeStore(ctx context.Context, dir string) context.Context

Context whose runtime store is dir, the way ICEBATH_RUNTIME_DIR points a whole process at one

func WithUpdateCorrelation

func WithUpdateCorrelation(ctx context.Context, provider func() string) context.Context

Context whose ambient update correlation id comes from the open update receipt the provider reads

func WorkerContext

func WorkerContext(ctx context.Context, updateID *string) func()

Carries the worker's update correlation into the scope until the returned restore runs

func WorkerMain

func WorkerMain() int

Runs this process as the isolated PM worker over its standard streams and returns its exit status

func WritableStoreRoot

func WritableStoreRoot(ctx context.Context) (string, error)

Store that accepts writes, the default root's tools dir when the store sits inside a sealed payload

Types

type ArgparseColors

type ArgparseColors struct {
	Usage, Prog, Heading, SummaryLong, SummaryShort, SummaryLabel, LongOption, ShortOption, Label, Reset string
}

Color codes of the argparse theme for one stream, all empty when the stream shows no color

func ArgparseThemeFor

func ArgparseThemeFor(stdout io.Writer) ArgparseColors

ArgparseThemeFor exports argparseTheme

type Artifact

type Artifact struct {
	URL    string
	SHA256 string
}

Artifact is one pinned archive of a fetch plan

type BasePackage

type BasePackage struct {
	Name                string
	Deps                []string
	Optional            bool
	Default             bool
	Internal            bool
	OffPath             bool
	URL                 string
	Gaps                map[string]string
	VersionStyle        string
	EmulatedArchTargets []string
	TargetDeps          map[string][]string
	// contains filtered or unexported fields
}

BasePackage carries the declarative fields and default behaviour every catalogue package embeds

func (*BasePackage) Base

func (b *BasePackage) Base() *BasePackage

func (*BasePackage) Binary

func (b *BasePackage) Binary(entry, target string) string

func (*BasePackage) BinaryReason

func (b *BasePackage) BinaryReason(bin, entry, target string) string

Empty when the binary is present and arch plausible on target, else the diagnosis

func (*BasePackage) DepsOn

func (b *BasePackage) DepsOn(target string) []string

Dependencies on target, the shared ones then those only that target needs

func (*BasePackage) Env

func (b *BasePackage) Env(entry, target string) EnvDiff

func (*BasePackage) FetchURL

func (b *BasePackage) FetchURL(version, target string) (string, error)

func (*BasePackage) FetchURLs

func (b *BasePackage) FetchURLs(version, target string) ([]string, error)

func (*BasePackage) KnownSHA256

func (b *BasePackage) KnownSHA256(version, url string) (string, error)

func (*BasePackage) LatestVersions

func (b *BasePackage) LatestVersions(target, locked string) ([]string, error)

func (*BasePackage) MissingReason

func (b *BasePackage) MissingReason(target string) string

func (*BasePackage) OnPath

func (b *BasePackage) OnPath() bool

Reports whether the package contributes PATH dirs

func (*BasePackage) RepairStagedVerification

func (b *BasePackage) RepairStagedVerification(entry, target, reason string) (string, string)

func (*BasePackage) Stage

func (b *BasePackage) Stage(store *Store, staged, version, target string) error

func (*BasePackage) StoreEntry

func (b *BasePackage) StoreEntry(version, target string) string

func (*BasePackage) Style

func (b *BasePackage) Style() string

Version labelling style of the lockfile version field, semver unless declared

func (*BasePackage) Unpack

func (b *BasePackage) Unpack(archive, staged, target string) error

func (*BasePackage) Verify

func (b *BasePackage) Verify(entry, target string) string

type BinaryPackage

type BinaryPackage struct {
	BasePackage
	BinaryRel map[string]string
	NoFlatten bool
	NoProbe   bool
	ProbeArgs []string
	ProbeCwd  bool
}

BinaryPackage is a downloaded archive exposing one binary, the shape most tools take

func (*BinaryPackage) Binary

func (b *BinaryPackage) Binary(entry, target string) string

func (*BinaryPackage) Rel

func (b *BinaryPackage) Rel(target string) string

Relative binary path of a binary package for a target, empty when the package ships none there

func (*BinaryPackage) Stage

func (b *BinaryPackage) Stage(store *Store, staged, version, target string) error

func (*BinaryPackage) Verify

func (b *BinaryPackage) Verify(entry, target string) string

Checks file and architecture evidence everywhere and runs the smoke probe only on the native target

type BuildEnvironmentOptions

type BuildEnvironmentOptions struct {
	Source           string
	Out              string
	Python           string
	Cache            string
	Env              map[string]string
	Extras           []string
	Groups           []string
	AllExtras        bool
	NoInstallProject bool
	Frozen           bool
	Sealed           bool
	Offline          bool
	Explicit         bool
	Timeout          time.Duration
}

BuildEnvironmentOptions are build_environment's keywords, nil Env for None and Frozen true for Python's default

type BuildFailure

type BuildFailure struct{ *InstallError }

BuildFailure is a package build backend that ran and failed

func (*BuildFailure) Unwrap

func (e *BuildFailure) Unwrap() error

type Bws

type Bws struct {
	BinaryPackage
}

Bws is the Bitwarden secrets manager CLI, one static musl build serving every Linux userland

func (*Bws) FetchURL

func (b *Bws) FetchURL(version, target string) (string, error)

func (*Bws) Stage

func (b *Bws) Stage(store *Store, staged, version, target string) error

type CalledProcessError

type CalledProcessError struct {
	Argv   []string
	Code   int
	Output string
}

CalledProcessError is a contained child that exited nonzero, with the output it printed

func (*CalledProcessError) Error

func (e *CalledProcessError) Error() string

type Candidates

type Candidates struct{ Dirs []string }

Candidates discovers the enabled members and adds these candidate directories

type CarriedFailure

type CarriedFailure struct {
	Reason  string
	Verdict bool
}

CarriedFailure is why a carried extra keeps the environment from building and whether that is a build verdict

type CarriedTrial

type CarriedTrial struct {
	Extras   []string
	Carried  []string
	Fact     map[string]any
	Explicit bool
}

CarriedTrial is the sync a carried extra failed in, the selection inputs its trials rebuild from

type CheckProjectLockOptions

type CheckProjectLockOptions struct {
	Source   string
	Python   string
	Cache    string
	Env      map[string]string
	Offline  bool
	Explicit bool
	Quiet    bool
}

CheckProjectLockOptions are check_project_lock's keywords, Quiet capturing uv's output

type Chromium

type Chromium struct {
	BasePackage
	CDN    string
	CfT    map[string]string
	Mirror map[string]string
}

Chromium is the Chrome for Testing or Playwright mirror build, laid out the way Playwright resolves browsers

func (*Chromium) Binary

func (p *Chromium) Binary(entry, target string) string

First executable under the entry in path order, whichever enclosing directory the archive used

func (*Chromium) CheckEnv

func (p *Chromium) CheckEnv(entry, target string) error

Refuses an entry with no executable, the error Python's env raises

func (*Chromium) Env

func (p *Chromium) Env(entry, target string) EnvDiff

Points Playwright at the store root that holds the entry

func (*Chromium) FetchURL

func (p *Chromium) FetchURL(version, target string) (string, error)

func (*Chromium) Stage

func (p *Chromium) Stage(store *Store, staged, version, target string) error

func (*Chromium) StoreEntry

func (p *Chromium) StoreEntry(version, target string) string

Entry named by Playwright revision only, all its resolver reads

func (*Chromium) Verify

func (p *Chromium) Verify(entry, target string) string

type ConfiguredFeatureGap

type ConfiguredFeatureGap struct {
	Feature, Hint, Extra string
}

ConfiguredFeatureGap is one configured feature whose dependencies are missing, its label, install hint and candidate extra

type ContainOptions

type ContainOptions struct {
	Stream io.Writer
	Hide   func(string) bool
	Indent string
}

ContainOptions shape a contained child run

type CuaDriver

type CuaDriver struct {
	BinaryPackage
}

CuaDriver is the computer use driver, shipped by default wherever upstream builds it

func (*CuaDriver) FetchURL

func (p *CuaDriver) FetchURL(version, target string) (string, error)

macOS takes the directory archive carrying the signed app identity, other targets the binary archive

func (*CuaDriver) LatestVersions

func (p *CuaDriver) LatestVersions(target, locked string) ([]string, error)

func (*CuaDriver) ProbeEnv

func (p *CuaDriver) ProbeEnv() (map[string]string, error)

The probe is a first run, so it never mints telemetry state

func (*CuaDriver) Stage

func (p *CuaDriver) Stage(store *Store, staged, version, target string) error

Hoists the release directory and drops the bundled SDK

type DebMain

type DebMain interface {
	MainRel(target string) string
}

DebMain names the main file a deb package must stage, relative to its prefix

type DebPackage

type DebPackage struct {
	BasePackage
	DebName   string
	PrefixRel string
}

DebPackage stages a deb by ar and tar extraction, never dpkg and never package scripts

func (*DebPackage) DebPackageName

func (d *DebPackage) DebPackageName() string

Control field name the deb must declare, the package name unless overridden

func (*DebPackage) Prefix

func (d *DebPackage) Prefix() string

Prefix the staged tree keeps the payload under, the Termux usr prefix unless overridden

func (*DebPackage) Unpack

func (d *DebPackage) Unpack(archive, staged, target string) error

func (*DebPackage) Verify

func (d *DebPackage) Verify(entry, target string) string

type DestinationExistsError

type DestinationExistsError struct{ Path string }

DestinationExistsError is a build destination that already exists, a FileExistsError in Python

func (*DestinationExistsError) Error

func (e *DestinationExistsError) Error() string

func (*DestinationExistsError) Is

func (e *DestinationExistsError) Is(target error) bool

type DistributionPin

type DistributionPin struct {
	Name, Version *string
}

Installed distribution as importlib metadata reports its Name and Version headers, nil when a header is absent

func DistributionPins

func DistributionPins(environment string) ([]DistributionPin, error)

Name and version headers of every distribution in a generation's site packages in directory order

type Download

type Download struct {
	Sources     []Source
	Resume      bool
	Connections int
	PartialsDir string
	// contains filtered or unexported fields
}

Download is one resumable job, a plan of sources fetched with parallel ranges and verified before publication

func NewDownload

func NewDownload(sources []Source, opts DownloadOptions) *Download

Plans a download, zero connections taking the default and partials landing in the managed area

func (*Download) Pause

func (d *Download) Pause()

Requests a stop between chunks, Run then failing with a paused error

func (*Download) Run

func (d *Download) Run(progress ProgressFunc) ([]string, error)

Fetches every source and returns the published destination paths

type DownloadError

type DownloadError struct {
	Kind            DownloadErrorKind
	Message         string
	URL             string
	Status          int
	FallbackAllowed bool
	Cause           error
}

DownloadError is every downloader failure, the kind naming its class

func NewDownloadTransportError

func NewDownloadTransportError(rawURL string, cause error) *DownloadError

Wraps an exhausted network failure with its URL, status and whether a pinned mirror may take over

func (*DownloadError) Error

func (e *DownloadError) Error() string

type DownloadErrorKind

type DownloadErrorKind int

DownloadErrorKind distinguishes the downloader failure classes

const (
	// DownloadFailed is a generic downloader failure
	DownloadFailed DownloadErrorKind = iota
	// DownloadRangeFailed means the range or representation identity changed
	DownloadRangeFailed
	// DownloadHashFailed means the bytes did not match the pinned sha256
	DownloadHashFailed
	// DownloadWasPaused means a pause stopped the transfer with partials intact
	DownloadWasPaused
	// DownloadTransportFailed is an exhausted network request with its status and URL
	DownloadTransportFailed
)

type DownloadOptions

type DownloadOptions struct {
	DisableResume bool
	Connections   int
	PartialsDir   string
	Pause         *PauseEvent
}

DownloadOptions shape a download job

type DriftReport

type DriftReport struct {
	Names   []string
	Reasons map[string]string
}

DriftReport maps each unhealthy package to its reason in the order the problems were found

func Drift

func Drift(ctx context.Context, includeVenv bool) (*DriftReport, error)

Cheap stamp comparisons of installed state against the lockfile, never installing or fetching

type EnabledPluginsOptions

type EnabledPluginsOptions struct {
	ProposedHome         string
	Enabled              []string
	Disabled             []string
	Installing           string
	SkipInvalidSecondary bool
}

EnabledPluginsOptions propose a selection for one home, name a plugin being installed and tolerate broken secondaries

type EnsureEnvironmentOptions

type EnsureEnvironmentOptions struct {
	Name         string
	Requirements []string
	Root         string
	Explicit     bool
	Timeout      time.Duration
	Executable   string
}

EnsureEnvironmentOptions are ensure_environment's arguments, empty Root and Executable for None

type EnsureOptions

type EnsureOptions struct {
	BaseEnv          map[string]string
	Explicit         bool
	SkipVerify       bool
	Progress         InstallProgress
	PauseEvent       *PauseEvent
	DownloadProgress ProgressFunc
	// contains filtered or unexported fields
}

EnsureOptions choose the base env, the explicit and verify policy, progress reporting and cancellation

type EnsurePythonToolOptions

type EnsurePythonToolOptions struct {
	Name         string
	Requirements []string
	Executable   string
	Root         string
	Explicit     bool
	Timeout      time.Duration
}

EnsurePythonToolOptions are ensure_python_tool's arguments, empty Root for None

type EntryPoint

type EntryPoint struct {
	Name        string
	Value       string
	Group       string
	DistName    string
	DistVersion string
	DistSummary string
}

One entry point an installed distribution declares, with the distribution it came from

func SelectedEntryPoints

func SelectedEntryPoints(ctx context.Context) ([]EntryPoint, error)

Entry points every distribution of the selected dependency environment declares, in directory order

type EnvChecker

type EnvChecker interface {
	CheckEnv(entry, target string) error
}

EnvChecker is a package whose env refuses an entry that cannot supply it

type EnvDiff

type EnvDiff map[string]any

EnvDiff is one package's environment contribution, PATH holding a list of directories to prepend

func PackageEnv

func PackageEnv(p Package, entry, target string) (EnvDiff, error)

Env diff of an entry, the error a package raises when its entry cannot supply one

type EnvironmentArgs

type EnvironmentArgs struct {
	Name        string
	Extra       []string
	Requirement []string
}

EnvironmentArgs are pm environment's arguments

type EvictingSync

type EvictingSync struct {
	Extras   []string
	Explicit bool
}

EvictingSync is how an update sync was asked, the extras it adds and whether explicit

type ExposeResult

type ExposeResult struct {
	OK      bool
	Skipped string
	Error   string
	Path    string
	Mode    string
	Written []string
}

Result of a PATH exposure pass

func ExposeCLI

func ExposeCLI(ctx context.Context, projectRoot string, create bool) (ExposeResult, error)

Repairs PATH conveniences without taking over another installation's files

type ExtraEntry

type ExtraEntry struct {
	Feature     string                 `json:"feature"`
	Aliases     []string               `json:"aliases,omitempty"`
	Anchors     []string               `json:"anchors"`
	Requires    []string               `json:"requires"`
	Sources     map[string]ExtraSource `json:"sources,omitempty"`
	Tools       []string               `json:"tools,omitempty"`
	Unsupported map[string]string      `json:"unsupported,omitempty"`
	Build       map[string][]string    `json:"build,omitempty"`
	Packages    []LockedPackage        `json:"packages"`
	BuildDeps   []LockedPackage        `json:"build_requires,omitempty"`
}

One optional feature set, its hand written spec and the resolution pm lock writes beside it

func ResolveExtra

func ResolveExtra(name string) (string, *ExtraEntry, bool)

Canonical extra a name or alias selects, false for a name the lock does not carry

type ExtraOptions

type ExtraOptions struct {
	Output io.Writer
}

Output an extra's provisioning reports progress to

type ExtraSource

type ExtraSource struct {
	Index  string `json:"index"`
	Marker string `json:"marker,omitempty"`
}

Package index a requirement of an extra resolves from, limited to the platforms its marker admits

type ExtraState

type ExtraState struct {
	Name        string
	Feature     string
	Provisioned bool
	Current     bool
	Unsupported string
}

Provisioning state of one extra, whether its environment exists and holds the pins this binary carries

func ExtraStates

func ExtraStates(ctx context.Context) ([]ExtraState, error)

State of every extra this binary carries on this install

type FactRecord

type FactRecord struct {
	Target    *string
	Artifacts []string
	Digest    *string
}

FactRecord is the identity and realized digest an install records beside its entry and env

type Facts

type Facts struct {
	Path string
	// contains filtered or unexported fields
}

Facts is the installed state file, written only by pm

func NewFacts

func NewFacts(path string, strict bool) (*Facts, error)

Reads the installed state file, strict refusing a damaged or unreadable one

func (*Facts) EntriesInUse

func (f *Facts) EntriesInUse() map[string]bool

Store entry names recorded by tool facts

func (*Facts) EnvFor

func (f *Facts) EnvFor(name, storeRoot string) EnvDiff

Recorded environment diff of a package with the store token resolved

func (*Facts) Forget

func (f *Facts) Forget(names []string) error

Drops the facts of packages pm no longer defines so gc reclaims their entries

func (*Facts) Get

func (f *Facts) Get(name string) (map[string]any, bool)

Recorded fact of a package

func (*Facts) Installed

func (f *Facts) Installed(name string, expectedVersion *string, storeRoot string, expectedIdentity *Identity) bool

Reports whether a tool fact matches the expected version and identity and its entry exists

func (*Facts) Record

func (f *Facts) Record(name, version, entry string, env EnvDiff, storeRoot string, extra FactRecord) error

Records an installed tool entry, its templated env and the identity it came from

func (*Facts) RecordState

func (f *Facts) RecordState(name, stamp string, extras []string, environment, resolvedLock string) error

Commits a verified state package with its selected environment and resolved lock

func (*Facts) Reload

func (f *Facts) Reload() error

Rereads the file strictly

func (*Facts) Retain

func (f *Facts) Retain(names map[string]bool) error

Drops unselected package facts from an exclusively owned staged store

type Ffmpeg

type Ffmpeg struct {
	// contains filtered or unexported fields
}

Ffmpeg is BtbN on Windows and Linux, martin-riedl on macOS and the termux deb on bionic

func (*Ffmpeg) Binary

func (t *Ffmpeg) Binary(entry, target string) string

func (*Ffmpeg) DebPackageName

func (t *Ffmpeg) DebPackageName() string

Control field name the termux deb declares

func (*Ffmpeg) FetchURL

func (p *Ffmpeg) FetchURL(version, target string) (string, error)

Resolves the exact advertised asset for the version and target, refusing to relabel other bytes

func (*Ffmpeg) LatestVersions

func (p *Ffmpeg) LatestVersions(target, locked string) ([]string, error)

func (*Ffmpeg) MainRel

func (t *Ffmpeg) MainRel(target string) string

func (*Ffmpeg) Stage

func (t *Ffmpeg) Stage(store *Store, staged, version, target string) error

func (*Ffmpeg) Unpack

func (t *Ffmpeg) Unpack(archive, staged, target string) error

func (*Ffmpeg) Verify

func (t *Ffmpeg) Verify(entry, target string) string

type Gh

type Gh struct {
	BinaryPackage
}

Gh is the GitHub CLI, whose libc independent Linux archive serves musl too

func (*Gh) FetchURL

func (p *Gh) FetchURL(version, target string) (string, error)

func (*Gh) LatestVersions

func (p *Gh) LatestVersions(target, locked string) ([]string, error)

type Git

type Git struct {
	BinaryPackage
}

Git is Git for Windows carrying the bash contract, POSIX targets using the system git by choice

func (*Git) Env

func (p *Git) Env(entry, target string) EnvDiff

func (*Git) FetchURL

func (p *Git) FetchURL(version, target string) (string, error)

func (*Git) LatestVersions

func (p *Git) LatestVersions(target, locked string) ([]string, error)

Release tags like v2.53.0.windows.3 become lock versions like 2.53.0+3

func (*Git) Unpack

func (p *Git) Unpack(archive, staged, target string) error

Runs a scratch copy of the PortableGit self extractor into the staged tree, refusing hosts that cannot run PE images

type HTTPError

type HTTPError struct {
	Code   int
	Reason string
	Header http.Header
	URL    string
}

HTTPError is a non success response, carrying its status, reason, headers and request URL

func (*HTTPError) Error

func (e *HTTPError) Error() string

type HomePlugins

type HomePlugins struct {
	PluginsDir string
	Names      []string
}

HomePlugins is one home's plugins dir with its enabled plugin names in config order

func EnabledPluginsOrdered

func EnabledPluginsOrdered(ctx context.Context, opts EnabledPluginsOptions) ([]HomePlugins, error)

Every home's plugins dir with its ordered enabled names, the active memory provider joining its home's list

type Identity

type Identity struct {
	Target  string
	SHA256s []string
}

Identity is the target and artifact digests a lock currently pins for a package

type IncompleteReadError

type IncompleteReadError struct {
	Partial  int64
	Expected int64
}

IncompleteReadError is a body that ended before its declared length

func (*IncompleteReadError) Error

func (e *IncompleteReadError) Error() string

type InstallArgs

type InstallArgs struct {
	Names         []string
	Extra         []string
	Without       []string
	ToolsOnly     bool
	TrustRecorded bool
	Target        *string
}

InstallArgs are pm install's arguments, a nil Target when not given

type InstallCommandSteps

type InstallCommandSteps struct {
	InstallNames func(ctx context.Context, names []string, target *string, verify bool) (int, error)
	Activate     func(ctx context.Context, allowIncomplete bool) ([]string, error)
	SyncVenv     func(ctx context.Context, opts SyncVenvOptions) error
	EnsureExtra  func(ctx context.Context, name string, opts ExtraOptions) (string, error)
}

InstallCommandSteps are the tool install, PATH activation, venv sync and extra provisioning steps the install command runs

type InstallError

type InstallError struct {
	Package string
	Cause   string
	Remedy  string
	Err     error
}

InstallError names the package that failed, why, and what the user can do about it

func NewInstallError

func NewInstallError(pkg, cause, remedy string) *InstallError

Builds an install error with the default remedy when none is given

func RefuseLazyFor

func RefuseLazyFor(ctx context.Context, name, what string) *InstallError

Records the refusal of an on demand install in a context's receipt scope and returns it

func UnknownExtraError

func UnknownExtraError(name string) *InstallError

Refusal of an extra name the binary does not carry, listing the names it does

func (*InstallError) Error

func (e *InstallError) Error() string

func (*InstallError) Unwrap

func (e *InstallError) Unwrap() error

Failure the install error reports, nil when it was raised without one

type InstallPackageOptions

type InstallPackageOptions struct {
	Progress         InstallProgress
	PauseEvent       *PauseEvent
	DownloadProgress ProgressFunc
	CopyFrom         *Location
	LockHeld         bool
}

InstallPackageOptions report progress, pause, copy from a verified source, reuse a held lock and force a fresh copy

type InstallProgress

type InstallProgress func(stage string, done, total int64, label string) error

InstallProgress reports download, unpack and verify stages, an error aborting the install

type InstalledPackage

type InstalledPackage struct {
	Path    string
	Version string
	Binary  string
}

InstalledPackage is a selected PM entry in its ordinary spelling, Binary empty for a package without one

func Installed

func Installed(ctx context.Context, name string, allowOutdated bool) (*InstalledPackage, error)

Reads the selected entry of an application package without installing or changing its facts, nil when absent

type InvalidMarkerError

type InvalidMarkerError struct{ Message string }

InvalidMarkerError is packaging's InvalidMarker raised for marker text that does not parse

func (*InvalidMarkerError) Error

func (e *InvalidMarkerError) Error() string

type InvalidRequirementError

type InvalidRequirementError struct{ Message string }

InvalidRequirementError is a dependency specifier packaging refuses

func (*InvalidRequirementError) Error

func (e *InvalidRequirementError) Error() string

type IronProxy

type IronProxy struct {
	SignedBinary
	SigningKeyURL string
}

IronProxy is the egress proxy, its archive checksum enforced and its GPG signature checked when gpg exists

func (*IronProxy) FetchURL

func (p *IronProxy) FetchURL(version, target string) (string, error)

func (*IronProxy) FetchURLs

func (p *IronProxy) FetchURLs(version, target string) ([]string, error)

func (*IronProxy) ProbeEnv

func (p *IronProxy) ProbeEnv() (map[string]string, error)

Probe environment of the proxy binary, infrastructure variables only

func (*IronProxy) VerifyProvenance

func (p *IronProxy) VerifyProvenance(directory string) error

type JSONRecord

type JSONRecord interface {
	ToJSON() map[string]any
}

JSONRecord is a check result that serializes itself into the receipt

type LaunchCommandOptions

type LaunchCommandOptions struct {
	Subcommand []string
	Binary     string
	Home       string
}

LaunchCommandOptions selects the subcommand, the binary and a literal default home of an install command

type LiveTail

type LiveTail struct {
	Label  *string
	Stream io.Writer
	Hide   func(string) bool
	Indent string
	Live   bool
	Tail   []string
	// contains filtered or unexported fields
}

LiveTail contains a child's output behind one status line and prints the tail on failure

func NewLiveTail

func NewLiveTail(label *string, stream io.Writer, hide func(string) bool, indent string) *LiveTail

Opens a status line for label, a nil label running silently until a failure

func (*LiveTail) Close

func (t *LiveTail) Close(ok bool)

Ends the status line with a success mark, or a failure mark and the captured tail

func (*LiveTail) Discard

func (t *LiveTail) Discard()

Clears the status line without a verdict, for a step that will be retried

func (*LiveTail) WriteString

func (t *LiveTail) WriteString(text string)

Takes child output text, bare carriage returns counting as line ends

type LlamaCpp

type LlamaCpp struct {
	BinaryPackage
	Backend string
	Assets  map[string]string
	Libgomp map[string]string
	// contains filtered or unexported fields
}

LlamaCpp is one llama.cpp backend build with every library it loads staged beside llama-server

func (*LlamaCpp) FetchURL

func (p *LlamaCpp) FetchURL(version, target string) (string, error)

func (*LlamaCpp) FetchURLs

func (p *LlamaCpp) FetchURLs(version, target string) ([]string, error)

func (*LlamaCpp) KnownSHA256

func (p *LlamaCpp) KnownSHA256(version, url string) (string, error)

Digest GitHub's release API publishes for the asset, so pinning skips the download

func (*LlamaCpp) LatestVersions

func (p *LlamaCpp) LatestVersions(target, locked string) ([]string, error)

The llama.app latest pointer first, then the bucket tree, then GitHub releases when the bucket shows nothing

func (*LlamaCpp) MissingReason

func (p *LlamaCpp) MissingReason(target string) string

Every known target upstream ships no build of this backend for

func (*LlamaCpp) Stage

func (p *LlamaCpp) Stage(store *Store, staged, version, target string) error

Hoists nested binaries beside llama-server, moves libgomp up and merges CUDA runtime directories in

func (*LlamaCpp) Unpack

func (p *LlamaCpp) Unpack(archive, staged, target string) error

type Location

type Location struct {
	Facts *Facts
	Store *Store
}

Location is a tool package found installed, the facts that vouch for it and its store

func InstalledLocation

func InstalledLocation(ctx context.Context, p Package, lockfile *Lockfile, target string, opts LocationOptions) (*Location, error)

Store and facts holding the current pin of a package, a prior pin when allowed, nil when none

func WritableCopy

func WritableCopy(ctx context.Context, name string, opts WritableCopyOptions) (*Location, error)

Location of PM's verified copy of an installed package in the writable store, copying it on first use

type LocationOptions

type LocationOptions struct {
	Verify        bool
	AllowOutdated bool
	NoHeal        bool
	Roots         []string
}

LocationOptions verify bytes, accept a prior pin, choose roots with nil the default pair, and keep lookups read only

type LockAndSyncOptions

type LockAndSyncOptions struct {
	Root        string
	Source      string
	SeedLock    string
	Replay      string
	Environment *PythonEnvironment
	Frozen      bool
}

LockAndSyncOptions name a fresh generation root, the core source, an optional seed lock or recorded replay, and the engine

type LockArgs

type LockArgs struct {
	Name    *string
	Version *string
}

LockArgs are pm lock's arguments, a nil Name or Version when not given

type LockHold

type LockHold struct {
	Unknown bool
	Holder  string
}

Answer of a lock holder probe, Unknown when no platform proof exists and Holder naming a live owner

func HeldOpen

func HeldOpen(path, root string, anyGit bool) LockHold

Exported heldOpen

func HeldOpenLsof

func HeldOpenLsof(path, root string, anyGit bool) LockHold

Exported heldOpenLsof for the injected process metadata tests of other packages

func (LockHold) Free

func (h LockHold) Free() bool

Reports the proven free answer

func (LockHold) Held

func (h LockHold) Held() bool

Reports whether a named live holder holds the lock

type LockProjectOptions

type LockProjectOptions struct {
	Source   string
	Upgrade  bool
	Python   string
	Env      map[string]string
	Cache    string
	Offline  bool
	Explicit bool
}

LockProjectOptions are lock_project's keywords, nil Env for None

type LockedFile

type LockedFile struct {
	URL    string `json:"url"`
	SHA256 string `json:"sha256"`
}

One locked artifact, its download address and digest

type LockedPackage

type LockedPackage struct {
	Name    string       `json:"name"`
	Version string       `json:"version"`
	Marker  string       `json:"marker,omitempty"`
	Index   string       `json:"index,omitempty"`
	Wheels  []LockedFile `json:"wheels,omitempty"`
	Sdist   *LockedFile  `json:"sdist,omitempty"`
}

One package of a resolved extra with the targets its marker admits and every artifact the lock allows

type Lockfile

type Lockfile struct {
	Path string
	// contains filtered or unexported fields
}

Lockfile is a snapshot of lock.json with conflict checked publication of changed pins

func NewLockfile

func NewLockfile(path string) *Lockfile

Reads the lockfile at path, a damaged or missing file reading as no pins

func (*Lockfile) Artifacts

func (l *Lockfile) Artifacts(name, target string) []map[string]any

Every archive a target needs in extraction order, the any target covering target independent pins

func (*Lockfile) Names

func (l *Lockfile) Names() []string

Sorted pinned package names

func (*Lockfile) PinnedArtifacts

func (l *Lockfile) PinnedArtifacts(name string) map[string]any

Complete pin table of a package including targets without discovery

func (*Lockfile) Save

func (l *Lockfile) Save() error

Merges touched rows under the file's lock, refusing every row a concurrent editor changed

func (*Lockfile) SetPin

func (l *Lockfile) SetPin(name, version string, artifacts map[string]any)

Replaces a package's pin in the snapshot and marks it for publication

func (*Lockfile) Version

func (l *Lockfile) Version(name string) (string, bool)

Pinned version of a package, ok false when unpinned

type ManagedEnvironmentOptions

type ManagedEnvironmentOptions struct {
	Python    string
	Cache     string
	Env       map[string]string
	Offline   bool
	Explicit  bool
	Output    io.Writer
	NoRealize bool
}

ManagedEnvironmentOptions select the interpreter, cache, env, network and output of a managed environment

type ManagerAbsentError

type ManagerAbsentError struct{ Line string }

ManagerAbsentError is a package manager operation refused by a build that leaves the package manager out

func (*ManagerAbsentError) Error

func (e *ManagerAbsentError) Error() string

type MemberDir

type MemberDir struct {
	Identity string
	Source   string
}

MemberDir is one plugin member, the installed identity it answers to and the tree that supplies it

func BuildMemberDirs

func BuildMemberDirs(ctx context.Context, extras []string, python string) ([]MemberDir, error)

Enabled members for a build selecting core extras, judged on the markers of the build's interpreter

func MemberPaths

func MemberPaths(paths []string) []MemberDir

Member dirs of plain paths, each its own identity

func MemberSources

func MemberSources(pluginDirs []MemberDir) []MemberDir

Installed identities mapped to build inputs, both resolved, a repeated identity taking its last source

type MemberSelection

type MemberSelection struct {
	ProposedHome string
	Enabled      []string
	Disabled     []string
}

MemberSelection proposes one home's enabled and disabled lists, an empty home reading every config as written

type Members

type Members struct {
	Dirs   []MemberDir
	Mapped bool
}

Members builds exactly these members and skips config discovery, Mapped when identities differ from sources

type Minor

type Minor struct {
	Major, Minor *big.Int
	Ok           bool
}

Minor is a major and minor pair, Ok false where Python returns None

func MinorOf

func MinorOf(version string) Minor

Major and minor of a semver like string, absent when it has fewer than two numeric parts

func (Minor) Equal

func (m Minor) Equal(o Minor) bool

Reports equal minors, two absent ones included

type NoCommittedEnvironment

type NoCommittedEnvironment struct{ Message string }

NoCommittedEnvironment refuses PM's store binary with nothing committed, only a repair fixes it

func (*NoCommittedEnvironment) Error

func (e *NoCommittedEnvironment) Error() string

func (*NoCommittedEnvironment) Unwrap

func (e *NoCommittedEnvironment) Unwrap() error

RuntimeError class callers catch it as

type Nodejs

type Nodejs struct {
	// contains filtered or unexported fields
}

Nodejs is nodejs.org for glibc, mac and Windows, unofficial builds for musl and the termux deb on bionic

func (*Nodejs) Binary

func (t *Nodejs) Binary(entry, target string) string

func (*Nodejs) DebPackageName

func (t *Nodejs) DebPackageName() string

Control field name the termux deb declares

func (*Nodejs) FetchURL

func (p *Nodejs) FetchURL(version, target string) (string, error)

func (*Nodejs) LatestVersions

func (p *Nodejs) LatestVersions(target, locked string) ([]string, error)

func (*Nodejs) MainRel

func (t *Nodejs) MainRel(target string) string

func (*Nodejs) RepairStagedVerification

func (p *Nodejs) RepairStagedVerification(entry, target, reason string) (string, string)

Installs the host libatomic official Linux Node needs, then re-probes, never from inspection paths

func (*Nodejs) Stage

func (t *Nodejs) Stage(store *Store, staged, version, target string) error

func (*Nodejs) Unpack

func (t *Nodejs) Unpack(archive, staged, target string) error

func (*Nodejs) Verify

func (t *Nodejs) Verify(entry, target string) string

type Npm

type Npm struct {
	BinaryPackage
}

Npm installs itself with the node it extends, offline from the verified tarball

func (*Npm) LatestVersions

func (p *Npm) LatestVersions(target, locked string) ([]string, error)

func (*Npm) Unpack

func (p *Npm) Unpack(archive, staged, target string) error

Bionic gets the package tree plus termux shell wrappers, every other target runs npm's self install

type OrderedObject

type OrderedObject struct {
	Keys   []string
	Values map[string]any
}

OrderedObject is a JSON object that keeps its key order across a load and save

func LoadTermuxTable

func LoadTermuxTable(path string) (*OrderedObject, error)

Loads the pin table keeping its key order, the default path falling back to the embedded copy

func NewOrderedObject

func NewOrderedObject() *OrderedObject

Empty ordered object

func TOMLLoads

func TOMLLoads(text string) (*OrderedObject, error)

TOMLLoads exports tomlLoads

func (*OrderedObject) Get

func (o *OrderedObject) Get(key string) (any, bool)

Value of a key

func (*OrderedObject) MarshalJSON

func (o *OrderedObject) MarshalJSON() ([]byte, error)

Encodes the object with its keys in their recorded order

func (*OrderedObject) Set

func (o *OrderedObject) Set(key string, value any)

Sets a key, appending it when new

type Package

type Package interface {
	Base() *BasePackage
	MissingReason(target string) string
	LatestVersions(target, locked string) ([]string, error)
	FetchURL(version, target string) (string, error)
	FetchURLs(version, target string) ([]string, error)
	StoreEntry(version, target string) string
	KnownSHA256(version, url string) (string, error)
	Unpack(archive, staged, target string) error
	Stage(store *Store, staged, version, target string) error
	Binary(entry, target string) string
	Verify(entry, target string) string
	RepairStagedVerification(entry, target, reason string) (string, string)
	Env(entry, target string) EnvDiff
}

Package is what a package IS, versions and hashes living in lock.json

func GetPackage

func GetPackage(name string) (Package, error)

Registered definition of a package

func Walk

func Walk(names []string) ([]Package, error)

Dependencies first topological order over the requested packages on this host's target, refusing cycles

func WalkTarget

func WalkTarget(names []string, target string) ([]Package, error)

Dependencies first topological order over the requested packages on target, refusing cycles

type PackageDefinition

type PackageDefinition struct {
	Name     string `json:"name"`
	Module   string `json:"module"`
	Qualname string `json:"qualname"`
}

PackageDefinition is the identity of a non built in registration a fresh worker restores by name

func PackageDefinitions

func PackageDefinitions(names []string) ([]PackageDefinition, error)

Identities of the registrations a fresh worker must restore, all of them or only a closure

type ParserSyntaxError

type ParserSyntaxError struct {
	Message    string
	Source     string
	Start, End int
}

ParserSyntaxError is a specifier syntax error pointing at the offending span of the source

func (*ParserSyntaxError) Error

func (e *ParserSyntaxError) Error() string

type PauseEvent

type PauseEvent struct {
	// contains filtered or unexported fields
}

PauseEvent is a settable flag a download checks between chunks and while waiting

func NewPauseEvent

func NewPauseEvent() *PauseEvent

Fresh unset pause flag

func (*PauseEvent) Clear

func (e *PauseEvent) Clear()

Lowers the flag

func (*PauseEvent) IsSet

func (e *PauseEvent) IsSet() bool

Reports whether the flag is raised

func (*PauseEvent) Set

func (e *PauseEvent) Set()

Raises the flag and wakes every waiter

func (*PauseEvent) Wait

func (e *PauseEvent) Wait(d time.Duration) bool

Waits up to d for the flag and reports whether it is raised

type Pin

type Pin struct {
	Scope   string
	Name    string
	URL     string
	Version string
}

Pin is one URL the Termux pool serves, scoped as a library, the license package or a tool

func TermuxPins

func TermuxPins(table *OrderedObject, lockfile *Lockfile) ([]Pin, error)

Every pinned URL the pool serves, the table's libraries and license plus the lockfile's bionic tools

type PinMismatchError

type PinMismatchError struct{ Message string }

PinMismatchError means the pool serves bytes the package index does not describe

func (*PinMismatchError) Error

func (e *PinMismatchError) Error() string

type PluginEntry

type PluginEntry struct {
	PluginsDir string
	Name       string
	PluginDir  string
}

PluginEntry is one selected plugin, the home plugins dir naming it, its selection key and its tree

type PluginEviction

type PluginEviction struct {
	// contains filtered or unexported fields
}

PluginEviction is one update's config edits, the plugins it disables and the ones it turns back on

func (*PluginEviction) Publish

func (e *PluginEviction) Publish(ctx context.Context, project string) error

Journals every config edit and writes them, refusing any config edit since the update's snapshot

type PluginInput

type PluginInput interface {
	// contains filtered or unexported methods
}

PluginInput is the one source of plugin members a sync or currency probe takes

func DecodePluginInput

func DecodePluginInput(value map[string]any) (PluginInput, error)

Plugin input of its JSON form, nil for null and a ValueError for an unknown kind

type PluginManifestHost

type PluginManifestHost struct {
	SupportedManifestVersion int
	RunningVersion           func() string
	RequiresError            func(manifest map[string]any) string
	ReadAgentManifest        func(pluginDir string) (map[string]any, error)
}

PluginManifestHost is the plugin manifest surface pkg/plugins installs at init, a package pm cannot import

type PluginSelection

type PluginSelection struct {
	Members []MemberDir
	// contains filtered or unexported fields
}

PluginSelection is a proposed plugin enablement for one home with the config bytes it will publish

func (*PluginSelection) Publish

func (s *PluginSelection) Publish(ctx context.Context, project string) error

Journals the selection and writes the proposed config, refusing any config edit since the snapshot

type PoolPackage

type PoolPackage struct {
	Name    string
	Version string
	URL     string
	SHA256  string
}

PoolPackage is the archive the pool currently serves for one package

type ProgressFunc

type ProgressFunc func(done, total int64, ranges []RangeSet) error

ProgressFunc receives overall done and total bytes and every destination's coverage, an error failing the job

type ProvenanceVerifier

type ProvenanceVerifier interface {
	VerifyProvenance(directory string) error
}

ProvenanceVerifier checks a signed binary's pinned provenance files

type PyError

type PyError struct {
	Class   string
	Message string
}

PyError is a failure carrying the Python exception class callers and the worker wire tell apart

func (*PyError) Error

func (e *PyError) Error() string

type Python

type Python struct {
	BionicURL string
	// contains filtered or unexported fields
}

Python is the pinned interpreter for launchers and every PM managed uv command

func (*Python) Binary

func (t *Python) Binary(entry, target string) string

func (*Python) DebPackageName

func (t *Python) DebPackageName() string

Control field name the termux deb declares

func (*Python) FetchURL

func (p *Python) FetchURL(version, target string) (string, error)

func (*Python) LatestVersions

func (p *Python) LatestVersions(target, locked string) ([]string, error)

Keeps the locked minor line and takes the advertised asset's patch and build, bionic staying a manual pin

func (*Python) MainRel

func (t *Python) MainRel(target string) string

func (*Python) Stage

func (p *Python) Stage(store *Store, staged, version, target string) error

Signs on macOS, drops the unloadable x64 VC runtime on ARM64 Windows and stages the python3 copy on Windows

func (*Python) Unpack

func (t *Python) Unpack(archive, staged, target string) error

func (*Python) Verify

func (p *Python) Verify(entry, target string) string

type PythonDeclaration

type PythonDeclaration struct {
	Files             []string
	Pyproject         string
	Requirements      []string
	Manifest          map[string]any
	RequiresPython    *string
	PyprojectInstalls bool
}

PythonDeclaration is a plugin's effective Python surface for consent, membership, builds and currency

func ReadPythonDeclaration

func ReadPythonDeclaration(pluginDir string) (*PythonDeclaration, error)

One effective declaration of a plugin, a packaging pyproject owning it and the manifest lists otherwise

func (*PythonDeclaration) External

func (d *PythonDeclaration) External() bool

Whether the manifest declares an external python_runtime

func (*PythonDeclaration) InstallRequirements

func (d *PythonDeclaration) InstallRequirements() ([]string, error)

Requirements the shared environment installs, none for an external runtime

func (*PythonDeclaration) InstallsPackages

func (d *PythonDeclaration) InstallsPackages() (bool, error)

Whether admission would put packages into the shared environment, which makes the plugin a workspace member

func (*PythonDeclaration) PythonError

func (d *PythonDeclaration) PythonError(version string) (string, error)

Why this member cannot join a workspace built for a Python version, empty when it fits

type PythonEnvironment

type PythonEnvironment struct {
	UV          string
	Python      string
	Destination string
	Cache       string
	Env         map[string]string
	Offline     bool
	Output      io.Writer
	NoConfig    bool
}

PythonEnvironment is one uv driven environment, its tools, destination, cache, child env and output policy

func ManagedEnvironment

func ManagedEnvironment(ctx context.Context, destination string, opts ManagedEnvironmentOptions) (*PythonEnvironment, error)

Environment over PM's pinned toolchain, the pinned interpreter getting compiler defaults this host can run

func (*PythonEnvironment) Check

func (e *PythonEnvironment) Check(ctx context.Context, lock string) error

Validates installed dependencies with uv pip check, the lock's deliberate override mismatches excused

func (*PythonEnvironment) CheckLock

func (e *PythonEnvironment) CheckLock(ctx context.Context, source string) error

Refuses a missing or stale lock without rewriting it

func (*PythonEnvironment) Create

func (e *PythonEnvironment) Create(ctx context.Context) error

Creates the venv at its final destination, which callers must never move

func (*PythonEnvironment) Executable

func (e *PythonEnvironment) Executable() string

Interpreter inside the destination venv

func (*PythonEnvironment) Lock

func (e *PythonEnvironment) Lock(ctx context.Context, source string, upgrade bool, timeout time.Duration) error

Resolves a project's lock, optionally upgrading every pin

func (*PythonEnvironment) PurgeCachedPackages

func (e *PythonEnvironment) PurgeCachedPackages(ctx context.Context, names []string) error

Removes packages from the uv cache through uv, then deletes leftover archives that still fail validation

func (*PythonEnvironment) Sync

func (e *PythonEnvironment) Sync(ctx context.Context, source string, opts SyncOptions) error

Installs the root and every workspace member, resolving only when asked

type Range

type Range struct{ Start, End int64 }

Range is a half open byte interval

type RangeSet

type RangeSet struct {
	Key    string
	Ranges []Range
}

RangeSet is one destination's covered runs, the last set in a report naming the source that ticked

type ReceiptToken

type ReceiptToken struct {
	// contains filtered or unexported fields
}

ReceiptToken restores the receipt that was current before a nested begin

func BeginReceipt

func BeginReceipt(ctx context.Context, kind string) *ReceiptToken

Starts recording a sync of kind stamped with the ambient update id, returning the restoring token

type RemoteDisconnectedError

type RemoteDisconnectedError struct{ Message string }

RemoteDisconnectedError is a connection the server closed before sending a response

func (*RemoteDisconnectedError) Error

func (e *RemoteDisconnectedError) Error() string

type ResolutionConflict

type ResolutionConflict struct{ *InstallError }

ResolutionConflict is a uv resolver verdict that the requested set has no solution

func (*ResolutionConflict) Unwrap

func (e *ResolutionConflict) Unwrap() error

type Resolved

type Resolved struct {
	Name            string
	Locked          *string
	Style           string
	Version         *string
	PerTarget       []TargetVersion
	Reason          string
	ArtifactUpdates map[string][]string
}

Resolved is what pm update decided for one package, nil Locked and Version standing for None

func ResolveBest

func ResolveBest(name string, latestByTarget []TargetCandidates, locked *string, style string) *Resolved

Intersects per target candidate lists into one decision, a target without candidates skipped

func ResolvePackage

func ResolvePackage(p Package, targets []string, locked *string, artifacts map[string]any) (*Resolved, error)

Resolves a package's latest versions and detects new artifacts within a shared minor

func (*Resolved) Changed

func (d *Resolved) Changed() bool

Reports whether the decision moves the lockfile

type Retired

type Retired struct {
	Pin         Pin
	Replacement *PoolPackage
}

Retired is a pin whose archive the pool replaced, a nil replacement meaning the pool dropped it

func RetiredPins

func RetiredPins(table *OrderedObject, lockfile *Lockfile, pool map[string]PoolPackage) ([]Retired, error)

Pins whose archive the pool replaced or dropped

type RetryOptions

type RetryOptions struct {
	Wait              func(time.Duration) error
	Progress          func() int64
	FallbackAvailable bool
}

RetryOptions shape a retried network operation

type Ripgrep

type Ripgrep struct {
	BinaryPackage
}

Ripgrep is BurntSushi's static build, ARM64 Windows carrying the VC runtime it links from python's entry

func (*Ripgrep) FetchURL

func (p *Ripgrep) FetchURL(version, target string) (string, error)

func (*Ripgrep) LatestVersions

func (p *Ripgrep) LatestVersions(target, locked string) ([]string, error)

func (*Ripgrep) Stage

func (p *Ripgrep) Stage(store *Store, staged, version, target string) error

Flattens, then on ARM64 Windows copies python's vcruntime140.dll beside rg.exe

func (*Ripgrep) Verify

func (p *Ripgrep) Verify(entry, target string) string

type Runner

type Runner struct {
	Name string
	Env  map[string]string
}

Runner is what ensure hands back, a composed environment and a command mirror

func Ensure

func Ensure(ctx context.Context, name string, opts EnsureOptions) (*Runner, error)

Ensures a package for an application caller, installed closures answering without crossing the worker boundary

func (*Runner) Command

func (r *Runner) Command(ctx context.Context, name string, args ...string) *exec.Cmd

Command with the runner environment, a bare name searched on the runner PATH like Python subprocess on POSIX

type RuntimeEnvironmentOptions

type RuntimeEnvironmentOptions struct {
	Output io.Writer
}

Output a relay runtime provisioning reports its progress to

type RuntimeRequirement

type RuntimeRequirement struct {
	Name    string   `json:"name"`
	Version string   `json:"version"`
	Marker  string   `json:"marker"`
	Files   []Wheel  `json:"files"`
	Targets []string `json:"targets,omitempty"`
}

One locked package of the runtime set with its marker and every artifact its lock admits

func RuntimeRequirements

func RuntimeRequirements() ([]RuntimeRequirement, error)

Locked relay runtime set the binary embeds

func (RuntimeRequirement) ServesTarget

func (r RuntimeRequirement) ServesTarget(target string) bool

Whether the package installs on target, a wheel only package listing the targets its wheels serve

type RuntimeSet

type RuntimeSet struct {
	// contains filtered or unexported fields
}

Hash pinned package set of one extra of the embedded lock an environment is provisioned with

func (*RuntimeSet) Requirements

func (s *RuntimeSet) Requirements() ([]RuntimeRequirement, error)

Locked packages of the set, each with every wheel and source archive the lock admits

type RuntimeUnprovisioned

type RuntimeUnprovisioned struct {
	Venv string
	Err  error
}

Relay environment a caller needed that is not provisioned, with what left it so

func (*RuntimeUnprovisioned) Error

func (e *RuntimeUnprovisioned) Error() string

func (*RuntimeUnprovisioned) Unwrap

func (e *RuntimeUnprovisioned) Unwrap() error

type Selection

type Selection struct{ Data map[string]any }

Selection publishes a proposed plugin enablement with the members it implies

type SelectionCommit

type SelectionCommit struct {
	Enabled              []string
	Stamp                string
	Inputs               VenvApplyOptions
	Current              bool
	Bare                 bool
	Repair               bool
	Explicit             bool
	SkipInvalidSecondary bool
}

SelectionCommit is what a sync records, the extras, stamp and inputs it built, and how it was asked

type SignedBinary

type SignedBinary struct {
	BinaryPackage
}

SignedBinary acquires pinned provenance files in the same artifact transaction as its archive

func (*SignedBinary) Stage

func (s *SignedBinary) Stage(store *Store, staged, version, target string) error

func (*SignedBinary) Unpack

func (s *SignedBinary) Unpack(archive, staged, target string) error

type Source

type Source struct {
	URL       string
	Dest      string
	SHA256    string
	Fallbacks []string
}

Source is one destination with its URL, optional pinned sha256 and pinned mirror fallbacks

func PinnedSource

func PinnedSource(rawURL, dest, sha string) (Source, error)

Download source of a pin, npm tarballs following the user's registry and pool archives falling back to the release copy

type StageOnlyOptions

type StageOnlyOptions struct {
	Progress         InstallProgress
	PauseEvent       *PauseEvent
	DownloadProgress ProgressFunc
}

StageOnlyOptions report the slow stages of a cross target stage and may pause it

type StagedPlugin

type StagedPlugin struct {
	Members []MemberDir
	Active  bool
	// contains filtered or unexported fields
}

StagedPlugin is a staged plugin tree that replaces its installed copy, with the members it implies when enabled

func (*StagedPlugin) Publish

func (s *StagedPlugin) Publish(ctx context.Context, project string) error

Journals and swaps the staged tree over its install under the metadata lock, refusing any concurrent input edit

type StagedUpdate

type StagedUpdate struct{ Data map[string]any }

StagedUpdate publishes a staged plugin tree over its install

type StaleLockRowError

type StaleLockRowError struct{ Message string }

StaleLockRowError reports a row a concurrent editor changed before this writer published it

func (*StaleLockRowError) Error

func (e *StaleLockRowError) Error() string

type StatePackage

type StatePackage interface {
	Package
	ExpectedStamp(extras []string) (string, error)
	Apply(extras []string, explicit bool) error
}

StatePackage is a state of this install verified by a stamp and made true by Apply

func NewVenv

func NewVenv(root string) StatePackage

State package of the project venv rooted at root, the PM installation's root when empty

type Store

type Store struct {
	Root        string
	PartialsDir string
}

Store is one directory of immutable published entries plus a scratch area

func NewStore

func NewStore(root string) *Store

Store rooted at root, spelled long on Windows

func (*Store) Entry

func (s *Store) Entry(name string) string

Path of a named entry

func (*Store) Fetch

func (s *Store) Fetch(rawURL, sha, scratch string, progress func(done, total int64) error, pause *PauseEvent) (string, error)

Fetches one pinned archive into the hash keyed cache

func (*Store) FetchMany

func (s *Store) FetchMany(artifacts []Artifact, scratch string, progress ProgressFunc, pause *PauseEvent) ([]string, error)

Fetches a pinned plan with one aggregate progress stream, completed archives entering the cache even on a later pause

func (*Store) InstallLock

func (s *Store) InstallLock() (func(), error)

Serializes writers on the store's advisory lock, saying what it waits on after two seconds

func (*Store) Publish

func (s *Store) Publish(staged, name string) (string, error)

Renames a staged tree into place atomically, keeping a concurrent winner's entry

func (*Store) Published

func (s *Store) Published(name string) bool

Reports whether a named entry is published

func (*Store) Scratch

func (s *Store) Scratch() (string, func(), error)

Creates a fresh staging directory inside the store and returns it with its cleanup

type SyncOptions

type SyncOptions struct {
	Extras           []string
	Groups           []string
	Timeout          time.Duration
	Resolve          bool
	AllExtras        bool
	NoInstallProject bool
	Locked           bool
	NoDefaultGroups  bool
}

SyncOptions select what a sync installs, Resolve locking first where Python passes frozen False

type SyncVenvOptions

type SyncVenvOptions struct {
	Extras                   []string
	Explicit                 bool
	Repair                   bool
	Automatic                []string
	Carried                  []string
	ProjectRoot              string
	EvictIncompatiblePlugins bool
	Plugins                  PluginInput
	Stdout                   io.Writer
}

SyncVenvOptions select the extras, plugin source, repair and eviction policy and the output of a venv sync

type SystemExit

type SystemExit struct{ Code int }

Exit status a pm command ends the process with, the error form of a Python SystemExit

func (*SystemExit) Error

func (e *SystemExit) Error() string

type TOMLDecodeError

type TOMLDecodeError struct{ Message string }

TOMLDecodeError is a document tomllib refuses, a ValueError in Python

func (*TOMLDecodeError) Error

func (e *TOMLDecodeError) Error() string

type TarFilterError

type TarFilterError struct {
	Kind   string
	Member string
	Path   string
}

Tar member the data containment policy refuses, with the refusal kind and the offending path

func (*TarFilterError) Error

func (e *TarFilterError) Error() string

type TarReadError

type TarReadError struct {
	Class   string
	Message string
}

Python exception tarfile raises while reading or extracting, its class name and message

func (*TarReadError) Error

func (e *TarReadError) Error() string

type TargetCandidates

type TargetCandidates struct {
	Target   string
	Versions []string
}

TargetCandidates is one target's newest first candidate versions

type TargetVersion

type TargetVersion struct{ Target, Version string }

TargetVersion is one target's exact version in a decision

type UndefinedMarkerError

type UndefinedMarkerError struct {
	Class   string
	Message string
}

UndefinedMarkerError is packaging's UndefinedComparison or UndefinedEnvironmentName raised while evaluating a marker

func (*UndefinedMarkerError) Error

func (e *UndefinedMarkerError) Error() string

type UnknownPackageError

type UnknownPackageError struct{ Name string }

UnknownPackageError reports a name no registered definition carries

func (*UnknownPackageError) Error

func (e *UnknownPackageError) Error() string

type UpdateArgs

type UpdateArgs struct {
	Names      []string
	Check      bool
	Target     string
	SkipTarget []string
	UV         bool
	NPM        bool
	Termux     bool
}

UpdateArgs are pm update's arguments, Target empty for every target

type UpdateLockHooks

type UpdateLockHooks struct {
	BindChild       func(*exec.Cmd) (string, bool)
	ResumeSuspended func(*exec.Cmd) error
	Held            func() bool
	CheckoutLockFDs func(root string) ([]int, error)
}

Checkout lock calls the self update slice installs, each nil when the lock module offers no such call

type UpdateReceiptHooks

type UpdateReceiptHooks struct {
	RecordStopReason func(string)
}

Receipt call the self update slice installs, nil when the receipt module offers no such call

type Uv

type Uv struct {
	// contains filtered or unexported fields
}

Uv is astral's prebuilt uv everywhere upstream builds it and the termux main repo deb on bionic

func (*Uv) Binary

func (t *Uv) Binary(entry, target string) string

func (*Uv) DebPackageName

func (t *Uv) DebPackageName() string

Control field name the termux deb declares

func (*Uv) FetchURL

func (p *Uv) FetchURL(version, target string) (string, error)

func (*Uv) LatestVersions

func (p *Uv) LatestVersions(target, locked string) ([]string, error)

func (*Uv) MainRel

func (t *Uv) MainRel(target string) string

func (*Uv) Stage

func (t *Uv) Stage(store *Store, staged, version, target string) error

func (*Uv) Unpack

func (t *Uv) Unpack(archive, staged, target string) error

func (*Uv) Verify

func (t *Uv) Verify(entry, target string) string

type Venv

type Venv struct {
	BasePackage
	// contains filtered or unexported fields
}

Venv is the project venv made true by a frozen uv sync of pyproject, uv.lock and the enabled extras

func (*Venv) Apply

func (v *Venv) Apply(extras []string, explicit bool) error

func (*Venv) ExpectedStamp

func (v *Venv) ExpectedStamp(extras []string) (string, error)

func (*Venv) Prepare

func (v *Venv) Prepare(ctx context.Context, extras []string, opts VenvApplyOptions) (*VenvGeneration, error)

Prepares one complete environment generation for the caller to commit, removing it on any failure

func (*Venv) ProjectRoot

func (v *Venv) ProjectRoot() string

Project whose venv this state describes

func (*Venv) Stamp

func (v *Venv) Stamp(ctx context.Context, extras []string, pluginDirs []MemberDir) (string, error)

Hash of the core lock, the extras, the pinned python identity and the plugin member inputs

func (*Venv) VenvDir

func (v *Venv) VenvDir(ctx context.Context) (string, error)

Committed environment of the project, or the original install before the first sync

type VenvApplyOptions

type VenvApplyOptions struct {
	PluginDirs           []MemberDir
	Repair               bool
	Explicit             bool
	SkipInvalidSecondary bool
}

VenvApplyOptions shape one environment preparation, nil PluginDirs meaning the enabled members

type VenvGeneration

type VenvGeneration struct {
	Environment  string
	ResolvedLock string
}

VenvGeneration is a prepared environment and the resolved lock it was synced from

type VenvIsCurrentOptions

type VenvIsCurrentOptions struct {
	ProjectRoot string
	Extras      []string
	Plugins     PluginInput
}

VenvIsCurrentOptions name the checkout, the extras to add to the recorded union and the plugin members to probe

type VenvState

type VenvState interface {
	StatePackage
	ProjectRoot() string
	Stamp(ctx context.Context, extras []string, pluginDirs []MemberDir) (string, error)
	Prepare(ctx context.Context, extras []string, opts VenvApplyOptions) (*VenvGeneration, error)
}

VenvState is the dependency environment state package a venv sync drives, the catalogue Venv or a test double

type Wheel

type Wheel struct {
	URL    string `json:"url"`
	SHA256 string `json:"sha256"`
}

Hash pinned wheel of one target

func NemoRelayWheel

func NemoRelayWheel(target string) (Wheel, bool)

Locked nemo-relay wheel of a target, false where the lock carries no wheel for it

type WhisperCppCpu

type WhisperCppCpu struct {
	BinaryPackage
}

WhisperCppCpu is native local speech to text for ARM64 Windows, where faster-whisper has no wheel

type WritableCopyOptions

type WritableCopyOptions struct {
	NoRealize bool
	Explicit  bool
	Why       string
}

WritableCopyOptions shape a writable copy lookup, NoRealize keeping it read only

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL