summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/sasmodels/default.nix
blob: 7518db80c66251f77a6096208f58443ddd2eabb9 (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
94
95
{
  lib,
  fetchFromGitHub,
  buildPythonPackage,

  # build-system
  columnize,
  hatch-requirements-txt,
  hatch-sphinx,
  hatch-vcs,
  hatchling,
  siphash24,
  sphinx,

  numpy,
  scipy,
  bumps,
  docutils,
  matplotlib,
  opencl-headers,
  pycuda,
  pyopencl,

  # optional-dependencies

  # tests
  pytestCheckHook,
  writableTmpDirAsHomeHook,
}:

buildPythonPackage rec {
  pname = "sasmodels";
  version = "1.0.12";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "SasView";
    repo = "sasmodels";
    tag = "v${version}";
    hash = "sha256-2AeFYFyK3jgJB/t4wMiHyKuKBD7CVLKl6cRSeICO+zQ=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail '"tccbox",' ""
  '';

  build-system = [
    columnize
    hatch-requirements-txt
    hatch-sphinx
    hatch-vcs
    hatchling
    siphash24
    sphinx
  ];

  buildInputs = [ opencl-headers ];

  pythonRemoveDeps = [
    "tccbox" # unpackaged
  ];
  dependencies = [
    numpy
    scipy
  ];

  optional-dependencies = {
    full = [
      docutils
      bumps
      matplotlib
      columnize
    ];
    server = [ bumps ];
    opencl = [ pyopencl ];
    cuda = [ pycuda ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    writableTmpDirAsHomeHook
  ]
  ++ optional-dependencies.full;

  pythonImportsCheck = [ "sasmodels" ];

  meta = {
    description = "Library of small angle scattering models";
    homepage = "https://github.com/SasView/sasmodels";
    changelog = "https://github.com/SasView/sasmodels/blob/${src.tag}/CHANGES.rst";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ rprospero ];
  };
}