1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 cython,
7 gfortran,
8 git,
9 meson-python,
10 pkg-config,
11 blas,
12 lapack,
13 numpy,
14 setuptools,
15 wheel,
16 pytestCheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "scikit-misc";
21 version = "0.3.1";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "has2k1";
26 repo = "scikit-misc";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-2L30hvKbFqIGlSEbzc1HvHybBqDGldJfZoUpqJJOv2Q=";
29 };
30
31 postPatch = ''
32 patchShebangs .
33
34 # unbound numpy and disable coverage testing in pytest
35 substituteInPlace pyproject.toml \
36 --replace 'numpy==' 'numpy>=' \
37 --replace 'addopts = "' '#addopts = "'
38
39 # provide a version to use when git fails to get the tag
40 [[ -f skmisc/_version.py ]] || \
41 echo '__version__ = "${version}"' > skmisc/_version.py
42 '';
43
44 nativeBuildInputs = [
45 cython
46 gfortran
47 git
48 meson-python
49 numpy
50 pkg-config
51 setuptools
52 wheel
53 ];
54
55 propagatedBuildInputs = [ numpy ];
56
57 buildInputs = [
58 blas
59 lapack
60 ];
61
62 mesonFlags = [
63 "-Dblas=${blas.pname}"
64 "-Dlapack=${lapack.pname}"
65 ];
66
67 nativeCheckInputs = [ pytestCheckHook ];
68
69 # can not run tests from source directory
70 preCheck = ''
71 cd "$(mktemp -d)"
72 '';
73
74 pytestFlagsArray = [ "--pyargs skmisc" ];
75
76 pythonImportsCheck = [ "skmisc" ];
77
78 meta = with lib; {
79 description = "Miscellaneous tools for scientific computing";
80 homepage = "https://github.com/has2k1/scikit-misc";
81 license = licenses.bsd3;
82 maintainers = with maintainers; [ onny ];
83 };
84}