summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/scikit-misc/default.nix
blob: b8c124b57d9a5c6e737c8f866a430019a2ee9770 (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  cython,
  gfortran,
  git,
  meson-python,
  pkg-config,
  numpy,
  setuptools,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "scikit-misc";
  version = "0.5.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "has2k1";
    repo = "scikit-misc";
    tag = "v${version}";
    hash = "sha256-G0zK13upo0tPd8x87X8cTBKWK63E5JPmAr1IVEijtaw=";
  };

  postPatch = ''
    patchShebangs .

    # unbound numpy and disable coverage testing in pytest
    substituteInPlace pyproject.toml \
      --replace-fail 'numpy>=2.0' 'numpy' \
      --replace-fail 'addopts = "' '#addopts = "'

    # provide a version to use when git fails to get the tag
    [[ -f skmisc/_version.py ]] || \
      echo '__version__ = "${version}"' > skmisc/_version.py
  '';

  nativeBuildInputs = [
    gfortran
    git
    pkg-config
  ];

  build-system = [
    cython
    meson-python
    numpy
    setuptools
  ];

  dependencies = [ numpy ];

  nativeCheckInputs = [ pytestCheckHook ];

  # can not run tests from source directory
  preCheck = ''
    cd "$(mktemp -d)"
  '';

  pytestFlags = [
    "--pyargs"
    "skmisc"
  ];

  pythonImportsCheck = [ "skmisc" ];

  meta = {
    description = "Miscellaneous tools for scientific computing";
    homepage = "https://github.com/has2k1/scikit-misc";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ onny ];
  };
}