Kernels documentation
kernels lock
Get started
Use kernels
QuickstartUse layersLock kernel versionsEnvironment variablesProjects using kernelsMigrate from older versionsFAQ
Python API
kernels CLI
Build kernels
Write kernelsBuild with NixDevelop locallySet up your IDESet up for Metal kernelsDevelop kernels with agentsSecure your kernelsGitHub Actions & HF Jobs
kernel-builder CLI
Kernel specifications
Concepts & design
Resources
You are viewing main version, which requires installation from source. If you'd like
regular pip install, checkout the latest stable version (v0.15.2).
kernels lock
Use kernels lock to generate a kernels.lock file that pins kernel dependencies to specific revisions.
Usage
kernels lock <project_dir>
What It Does
- Reads kernel dependencies from
pyproject.tomlunder[tool.kernels.dependencies] - Resolves each kernel to its current revision SHA
- Writes a
kernels.lockfile with pinned versions and variant information
Examples
Lock kernels in the current project:
kernels lock .
Lock kernels in a specific project:
kernels lock /path/to/my-project
pyproject.toml Format
Add your kernel dependencies to pyproject.toml:
[tool.kernels.dependencies]
"kernels-community/activation" = 1The version can be:
- A version number (e.g.,
1,2)
kernels.lock Format
The generated lock file contains:
[
{
"repo_id": "kernels-community/activation",
"sha": "ece277f908b9453112722d584fee4b5696f21c49",
"variants": {
"torch210-cu128-x86_64-windows": {
"hash": "sha256-cbf085e1d297d990d9cb074fb5079ff48e9682c729f53a0899a36b5164a6fb45",
"hash_type": "git_lfs_concat"
},
// ...
"torch29-metal-aarch64-darwin": {
"hash": "sha256-9f665b54a53246a7d3627422f8a0d41d7956dc5409043dbd14c4ec0327aea310",
"hash_type": "git_lfs_concat"
}
}
}
]Workflow
- Add dependencies to
pyproject.toml - Run
kernels lock .to generate the lock file - Commit both
pyproject.tomlandkernels.lock - Use
kernels download .to install locked kernels
See Also
- kernels download - Download locked kernels
- kernels versions - View available kernel versions