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