summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/gdstk/default.nix
blob: 47390eb908c4d5dbdbaa929c9edb050645bc3f74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
  lib,
  buildPythonPackage,
  libgdstk,

  # build-system
  build,
  scikit-build-core,

  # deps
  numpy,
  typing-extensions,

  # deps (optional)
  matplotlib,
  sphinx,
  sphinx-inline-tabs,
  sphinx-rtd-theme,

  # build-time
  cmake,
  ninja,

  # run-time
  zlib,
  qhull,

  # tests
  pytestCheckHook,
}:

buildPythonPackage {
  pname = "gdstk";
  inherit (libgdstk) src version;

  pyproject = true;
  strictDeps = true;

  # scikit is supposed to handle the module build
  dontUseCmakeConfigure = true;

  build-system = [
    build
    cmake
    ninja
    numpy
    scikit-build-core
  ];

  dependencies = [
    numpy
    typing-extensions
  ];

  optional-dependencies = {
    docs = [
      matplotlib
      sphinx
      sphinx-inline-tabs
      sphinx-rtd-theme
    ];
  };

  buildInputs = [
    zlib
    qhull
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  # remove the `gdstk` source directory, else pytest will attempt to import it
  # instead of the actual module
  preCheck = ''
    rm -rf gdstk
  '';

  pythonImportsCheck = [
    "gdstk"
  ];

  meta = {
    inherit (libgdstk.meta)
      description
      homepage
      changelog
      license
      maintainers
      teams
      ;
  };
}