Manages snakebridge.lock with runtime identity, hardware info, and library versions.
The lock file captures:
- Hardware identity (accelerator, CUDA version, CPU features)
- Platform information (OS, architecture)
- Python environment (version, packages)
- Library configurations
Hardware-Aware Lock Files
The lock file includes hardware information to detect compatibility issues:
%{
"environment" => %{
"hardware" => %{
"accelerator" => "cuda",
"cuda_version" => "12.1",
"gpu_count" => 2,
"cpu_features" => ["avx", "avx2"]
},
"platform" => %{
"os" => "linux",
"arch" => "x86_64"
}
}
}Use SnakeBridge.Lock.Verifier to verify compatibility.
Summary
Functions
Builds the compatibility section with minimum requirements.
Builds the hardware section for the lock file.
Builds the platform section for the lock file.
Deterministic hash from sorted package versions.
Computes the generator hash from generator and adapter source contents.
Gets package metadata for the lockfile.
Checks if the lock was generated with the current generator version.
Functions
@spec build(SnakeBridge.Config.t()) :: map()
Builds the compatibility section with minimum requirements.
@spec build_hardware_section() :: map()
Builds the hardware section for the lock file.
Returns a map with hardware identity including accelerator type, CUDA version if available, GPU count, and CPU features.
@spec build_platform_section() :: map()
Builds the platform section for the lock file.
Deterministic hash from sorted package versions.
@spec generator_hash() :: String.t()
Computes the generator hash from generator and adapter source contents.
@spec get_package_metadata(SnakeBridge.Config.t()) :: map()
Gets package metadata for the lockfile.
@spec load() :: map() | nil
@spec update(SnakeBridge.Config.t()) :: :ok
Checks if the lock was generated with the current generator version.
@spec write(map()) :: :ok