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