1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 pkg-config,
8 rustc,
9 rustPlatform,
10
11 # tests
12 numpy,
13 pytestCheckHook,
14 pytest-benchmark,
15 pytest-rerunfailures,
16}:
17
18buildPythonPackage rec {
19 pname = "gilknocker";
20 version = "0.4.1.post6";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "milesgranger";
25 repo = "gilknocker";
26 tag = "v${version}";
27 hash = "sha256-jJOI7hlm6kcqfBbM56y5mKD+lJe0g+qAQpDF7ePM+GM=";
28 };
29
30 cargoDeps = rustPlatform.fetchCargoVendor {
31 inherit src;
32
33 name = "${pname}-${version}";
34 hash = "sha256-cUv0CT8d6Nxjzh/S/hY9jcpeFX/5KvBxSkqOkt4htyU=";
35 };
36
37 nativeBuildInputs =
38 with rustPlatform;
39 [
40 cargoSetupHook
41 maturinBuildHook
42 ]
43 ++ [
44 pkg-config
45 rustc
46 ];
47
48 pythonImportsCheck = [
49 "gilknocker"
50 ];
51
52 nativeCheckInputs = [
53 numpy
54 pytestCheckHook
55 pytest-benchmark
56 pytest-rerunfailures
57 ];
58
59 meta = {
60 description = "Knock on the Python GIL, determine how busy it is";
61 homepage = "https://github.com/milesgranger/gilknocker";
62 changelog = "https://github.com/milesgranger/gilknocker/releases/tag/v${version}";
63 license = with lib.licenses; [
64 mit
65 unlicense
66 ];
67 maintainers = with lib.maintainers; [ daspk04 ];
68 };
69}