Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / librosa / default.nix
blob62d712aa7b1f3d4e48391677ca181f9878fd576b
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , fetchFromGitHub
5 , fetchpatch
7 # build-system
8 , setuptools
10 # runtime
11 , audioread
12 , decorator
13 , joblib
14 , lazy-loader
15 , matplotlib
16 , msgpack
17 , numba
18 , numpy
19 , pooch
20 , scikit-learn
21 , scipy
22 , soundfile
23 , soxr
24 , typing-extensions
26 # tests
27 , ffmpeg-headless
28 , packaging
29 , pytest-mpl
30 , pytestCheckHook
31 , resampy
32 , samplerate
35 buildPythonPackage rec {
36   pname = "librosa";
37   version = "0.10.1";
38   format = "pyproject";
40   src = fetchFromGitHub {
41     owner = "librosa";
42     repo = "librosa";
43     rev = "refs/tags/${version}";
44     fetchSubmodules = true; # for test data
45     hash = "sha256-zbmU87hI9A1CVcBZ/5FU8z0t6SS4jfJk9bj9kLe/EHI=";
46   };
48   nativeBuildInputs = [
49     setuptools
50   ];
52   patches = [
53     (fetchpatch {
54       # https://github.com/librosa/librosa/issues/1754
55       # https://github.com/librosa/librosa/pull/1755
56       name = "matplotlib-3.8-compat.patch";
57       url = "https://github.com/librosa/librosa/commit/beef47885ce1255b43b65e48ea2054ddace37c6c.patch";
58       hash = "sha256-rrnlUHXHY2me4BWGs3wFq8WJmz75CbXTWKFp3VdJKzE=";
59     })
60   ];
62   postPatch = ''
63     substituteInPlace setup.cfg \
64       --replace "--cov-report term-missing --cov librosa --cov-report=xml " ""
65   '';
67   propagatedBuildInputs = [
68     audioread
69     decorator
70     joblib
71     lazy-loader
72     msgpack
73     numba
74     numpy
75     pooch
76     scipy
77     scikit-learn
78     soundfile
79     soxr
80     typing-extensions
81   ];
83   passthru.optional-dependencies.matplotlib = [
84     matplotlib
85   ];
87   # check that import works, this allows to capture errors like https://github.com/librosa/librosa/issues/1160
88   pythonImportsCheck = [
89     "librosa"
90   ];
92   nativeCheckInputs = [
93     ffmpeg-headless
94     packaging
95     pytest-mpl
96     pytestCheckHook
97     resampy
98     samplerate
99   ] ++ passthru.optional-dependencies.matplotlib;
101   preCheck = ''
102     export HOME=$TMPDIR
103   '';
105   disabledTests = [
106     # requires network access
107     "test_example"
108     "test_example_info"
109     "test_load_resample"
110     # does not converge
111     "test_nnls_vector"
112   ] ++ lib.optionals stdenv.isDarwin [
113     # https://github.com/librosa/librosa/pull/1808
114     "test_pyin_multi_center"
115   ];
117   meta = with lib; {
118     description = "Python library for audio and music analysis";
119     homepage = "https://github.com/librosa/librosa";
120     changelog = "https://github.com/librosa/librosa/releases/tag/${version}";
121     license = licenses.isc;
122     maintainers = with maintainers; [ GuillaumeDesforges ];
123   };