1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4
5# build-system
6, setuptools
7
8# runtime
9, audioread
10, decorator
11, joblib
12, lazy-loader
13, matplotlib
14, msgpack
15, numba
16, numpy
17, pooch
18, scikit-learn
19, scipy
20, soundfile
21, soxr
22, typing-extensions
23
24# tests
25, ffmpeg-headless
26, packaging
27, pytest-mpl
28, pytestCheckHook
29, resampy
30, samplerate
31}:
32
33buildPythonPackage rec {
34 pname = "librosa";
35 version = "0.10.0";
36 format = "pyproject";
37
38 src = fetchFromGitHub {
39 owner = "librosa";
40 repo = "librosa";
41 rev = "refs/tags/${version}";
42 fetchSubmodules = true; # for test data
43 hash = "sha256-MXzPIcbG8b1JwhEyAZG4DRObGaHq+ipVHMrZCzaxLdE=";
44 };
45
46 nativeBuildInputs = [
47 setuptools
48 ];
49
50 postPatch = ''
51 substituteInPlace setup.cfg \
52 --replace "--cov-report term-missing --cov librosa --cov-report=xml " ""
53 '';
54
55 propagatedBuildInputs = [
56 audioread
57 decorator
58 joblib
59 lazy-loader
60 msgpack
61 numba
62 numpy
63 pooch
64 scipy
65 scikit-learn
66 soundfile
67 soxr
68 typing-extensions
69 ];
70
71 passthru.optional-dependencies.matplotlib = [
72 matplotlib
73 ];
74
75 # check that import works, this allows to capture errors like https://github.com/librosa/librosa/issues/1160
76 pythonImportsCheck = [
77 "librosa"
78 ];
79
80 nativeCheckInputs = [
81 ffmpeg-headless
82 packaging
83 pytest-mpl
84 pytestCheckHook
85 resampy
86 samplerate
87 ] ++ passthru.optional-dependencies.matplotlib;
88
89 preCheck = ''
90 export HOME=$TMPDIR
91 '';
92
93 disabledTests = [
94 # requires network access
95 "test_example"
96 "test_example_info"
97 "test_load_resample"
98 ];
99
100 meta = with lib; {
101 description = "Python library for audio and music analysis";
102 homepage = "https://github.com/librosa/librosa";
103 changelog = "https://github.com/librosa/librosa/releases/tag/${version}";
104 license = licenses.isc;
105 maintainers = with maintainers; [ GuillaumeDesforges ];
106 };
107
108}