python312Packages.llm-gguf: init at 0.2 (#364926)
[NixPkgs.git] / pkgs / development / python-modules / pyopencl / default.nix
blob3af43a63a73c07d1a2bb74e60fe2b7878b7d230b
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   buildPythonPackage,
7   # build-system
8   cmake,
9   nanobind,
10   ninja,
11   numpy,
12   scikit-build-core,
14   # buildInputs
15   opencl-headers,
16   pybind11,
17   darwin,
18   ocl-icd,
20   # dependencies
21   platformdirs,
22   pytools,
24   # tests
25   pytestCheckHook,
28 let
29   os-specific-buildInputs =
30     if stdenv.hostPlatform.isDarwin then [ darwin.apple_sdk.frameworks.OpenCL ] else [ ocl-icd ];
32 buildPythonPackage rec {
33   pname = "pyopencl";
34   version = "2024.3";
35   pyproject = true;
37   src = fetchFromGitHub {
38     owner = "inducer";
39     repo = "pyopencl";
40     rev = "refs/tags/v${version}";
41     fetchSubmodules = true;
42     hash = "sha256-HE7dARgKnZxqjAXX4iI1ml0N2BalyTo+ZAzjC2ThEN8=";
43   };
45   build-system = [
46     cmake
47     nanobind
48     ninja
49     numpy
50     scikit-build-core
51   ];
53   dontUseCmakeConfigure = true;
55   buildInputs = [
56     opencl-headers
57     pybind11
58   ] ++ os-specific-buildInputs;
60   dependencies = [
61     numpy
62     platformdirs
63     pytools
64   ];
66   nativeCheckInputs = [ pytestCheckHook ];
68   preCheck = ''
69     export HOME=$(mktemp -d)
71     # https://github.com/NixOS/nixpkgs/issues/255262
72     cd $out
73   '';
75   # https://github.com/inducer/pyopencl/issues/784 Note that these failing
76   # tests are all the tests that are available.
77   doCheck = false;
79   pythonImportsCheck = [
80     "pyopencl"
81     "pyopencl.array"
82     "pyopencl.cltypes"
83     "pyopencl.compyte"
84     "pyopencl.elementwise"
85     "pyopencl.tools"
86   ];
88   meta = {
89     description = "Python wrapper for OpenCL";
90     homepage = "https://github.com/pyopencl/pyopencl";
91     changelog = "https://github.com/inducer/pyopencl/releases/tag/v${version}";
92     license = lib.licenses.mit;
93     maintainers = with lib.maintainers; [ GaetanLepage ];
94     # ld: symbol(s) not found for architecture arm64
95     broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64;
96   };