Skip to content

Commit bd418a3

Browse files
committed
python3Packages.kernels-data: init
1 parent d82fd30 commit bd418a3

7 files changed

Lines changed: 74 additions & 33 deletions

File tree

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
jax
167167
jax-tvm-ffi
168168
kernel-abi-check
169+
kernels-data
169170
matplotlib
170171
mktestdocs
171172
openssl.dev

nix-builder/overlay.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ in
158158

159159
kernels = callPackage ./pkgs/python-modules/kernels { };
160160

161+
kernels-data = callPackage ./pkgs/python-modules/kernels-data { };
162+
161163
pyclibrary = python-self.callPackage ./pkgs/python-modules/pyclibrary { };
162164

163165
mkTorch = callPackage ./pkgs/python-modules/torch/binary { };

nix-builder/pkgs/crate-dirs.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{ lib, sourceFiles }:
2+
3+
with lib.fileset;
4+
toSource {
5+
root = ../..;
6+
fileset = unions [
7+
../../Cargo.lock
8+
../../Cargo.toml
9+
(fileFilter sourceFiles ../../kernel-abi-check)
10+
(fileFilter sourceFiles ../../kernel-builder)
11+
(fileFilter sourceFiles ../../kernels-data)
12+
];
13+
}

nix-builder/pkgs/kernel-abi-check/default.nix

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,8 @@ rustPlatform.buildRustPackage {
2626
|| file.hasExt "rs"
2727
|| file.name == "stable_abi.toml";
2828
in
29-
with lib.fileset;
30-
toSource {
31-
root = ../../..;
32-
fileset = unions [
33-
../../../Cargo.lock
34-
../../../Cargo.toml
35-
(fileFilter sourceFiles ../../../kernel-abi-check)
36-
# Cargo wants access to the whole workspace.
37-
(fileFilter sourceFiles ../../../kernel-builder)
38-
(fileFilter sourceFiles ../../../kernels-data)
39-
];
29+
import ../crate-dirs.nix {
30+
inherit lib sourceFiles;
4031
};
4132

4233
cargoLock = {

nix-builder/pkgs/kernel-builder/default.nix

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,8 @@ rustPlatform.buildRustPackage {
4545
"toml"
4646
]);
4747
in
48-
with lib.fileset;
49-
toSource {
50-
root = ../../..;
51-
fileset = unions [
52-
../../../Cargo.lock
53-
../../../Cargo.toml
54-
(fileFilter sourceFiles ../../../kernel-builder)
55-
# Cargo wants access to the whole workspace.
56-
(fileFilter sourceFiles ../../../kernel-abi-check)
57-
(fileFilter sourceFiles ../../../kernels-data)
58-
];
48+
import ../crate-dirs.nix {
49+
inherit lib sourceFiles;
5950
};
6051

6152
cargoLock = {

nix-builder/pkgs/python-modules/kernel-abi-check/default.nix

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,8 @@ buildPythonPackage {
3030
|| file.hasExt "rs"
3131
|| file.name == "stable_abi.toml";
3232
in
33-
with lib.fileset;
34-
toSource {
35-
root = ../../../..;
36-
fileset = unions [
37-
../../../../Cargo.lock
38-
../../../../Cargo.toml
39-
(fileFilter sourceFiles ../../../../kernel-abi-check)
40-
# Cargo wants access to the whole workspace.
41-
(fileFilter sourceFiles ../../../../kernel-builder)
42-
(fileFilter sourceFiles ../../../../kernels-data)
43-
];
33+
import ../../crate-dirs.nix {
34+
inherit lib sourceFiles;
4435
};
4536

4637
cargoDeps = rustPlatform.importCargoLock {
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
lib,
3+
buildPythonPackage,
4+
rustPlatform,
5+
}:
6+
7+
let
8+
version =
9+
(builtins.fromTOML (builtins.readFile ../../../../kernels-data/Cargo.toml)).package.version;
10+
cargoFlags = [
11+
"-m"
12+
"kernels-data/bindings/python/Cargo.toml"
13+
];
14+
in
15+
buildPythonPackage {
16+
pname = "kernels-data";
17+
inherit version;
18+
format = "pyproject";
19+
20+
src =
21+
let
22+
sourceFiles =
23+
file:
24+
file.name == "Cargo.toml"
25+
|| file.name == "Cargo.lock"
26+
|| file.hasExt "pyi"
27+
|| file.name == "pyproject.toml"
28+
|| file.name == "python_dependencies.json"
29+
|| file.hasExt "rs";
30+
in
31+
import ../../crate-dirs.nix {
32+
inherit lib sourceFiles;
33+
};
34+
35+
cargoDeps = rustPlatform.importCargoLock {
36+
lockFile = ../../../../Cargo.lock;
37+
outputHashes = {
38+
"huggingface-hub-0.0.1" = "sha256-By8b1NUPWu+XF3Om1NcEO+o2qdZUco+FxvrJGNRqxWs=";
39+
};
40+
};
41+
42+
maturinBuildFlags = cargoFlags;
43+
44+
build-system = [
45+
rustPlatform.cargoSetupHook
46+
rustPlatform.maturinBuildHook
47+
];
48+
49+
meta = with lib; {
50+
description = "Kernels data structures";
51+
};
52+
}

0 commit comments

Comments
 (0)