Skip to content

Commit 67c9ca0

Browse files
authored
python3Packages.kernels: build from local source (#227)
1 parent 37696a0 commit 67c9ca0

3 files changed

Lines changed: 49 additions & 11 deletions

File tree

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@
190190

191191
packages = rec {
192192
inherit (buildSet.pkgs) build2cmake kernel-abi-check;
193+
inherit (buildSet.pkgs.python3.pkgs) kernels;
193194

194195
update-build = pkgs.writeShellScriptBin "update-build" ''
195196
${build2cmake}/bin/build2cmake update-build ''${1:-build.toml}
@@ -210,7 +211,6 @@
210211
value = buildSet.torch;
211212
}) buildSets
212213
);
213-
214214
};
215215
}
216216
)

nix/overlay.nix

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,7 @@ in
8181

8282
kernel-abi-check = callPackage ./pkgs/python-modules/kernel-abi-check { };
8383

84-
kernels = python-super.kernels.overrideAttrs (oldAttrs: rec {
85-
version = "0.11.6";
86-
87-
src = final.fetchFromGitHub {
88-
owner = "huggingface";
89-
repo = "kernels";
90-
rev = "ff4de4eafdfe5c2346b252cf09c6c412e13f3135";
91-
hash = "sha256-hn9PZsGnd2BsBejjDQXVKye8abnS5K9jWga7YVkvXOg=";
92-
};
93-
});
84+
kernels = callPackage ./pkgs/python-modules/kernels { };
9485

9586
pyclibrary = python-self.callPackage ./pkgs/python-modules/pyclibrary { };
9687

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
lib,
3+
buildPythonPackage,
4+
setuptools,
5+
6+
huggingface-hub,
7+
kernel-abi-check,
8+
pyyaml,
9+
torch,
10+
}:
11+
12+
let
13+
version =
14+
(builtins.fromTOML (builtins.readFile ../../../../kernels/pyproject.toml)).project.version;
15+
in
16+
buildPythonPackage {
17+
pname = "kernels";
18+
inherit version;
19+
pyproject = true;
20+
21+
src =
22+
let
23+
sourceFiles =
24+
file: file.hasExt "lock" || file.hasExt "json" || file.hasExt "toml" || file.hasExt "py";
25+
in
26+
lib.fileset.toSource {
27+
root = ../../../../kernels;
28+
fileset = lib.fileset.fileFilter sourceFiles ../../../../kernels;
29+
};
30+
31+
build-system = [ setuptools ];
32+
33+
dependencies = [
34+
huggingface-hub
35+
kernel-abi-check
36+
pyyaml
37+
torch
38+
];
39+
40+
pythonImportsCheck = [
41+
"kernels"
42+
];
43+
44+
meta = with lib; {
45+
description = "Python client for the Kernel Hub";
46+
};
47+
}

0 commit comments

Comments
 (0)