2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2023-03-15 16:39:30 +00:00
|
|
|
, fetchFromGitHub
|
2023-08-22 20:05:09 +00:00
|
|
|
, fetchpatch
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
# build-system
|
|
|
|
, setuptools
|
|
|
|
|
|
|
|
# runtime
|
|
|
|
, audioread
|
|
|
|
, decorator
|
2020-04-24 23:36:52 +00:00
|
|
|
, joblib
|
2023-03-15 16:39:30 +00:00
|
|
|
, lazy-loader
|
2020-04-24 23:36:52 +00:00
|
|
|
, matplotlib
|
2023-03-15 16:39:30 +00:00
|
|
|
, msgpack
|
|
|
|
, numba
|
|
|
|
, numpy
|
|
|
|
, pooch
|
2021-05-20 23:08:51 +00:00
|
|
|
, scikit-learn
|
2023-03-15 16:39:30 +00:00
|
|
|
, scipy
|
2020-04-24 23:36:52 +00:00
|
|
|
, soundfile
|
2023-03-15 16:39:30 +00:00
|
|
|
, soxr
|
|
|
|
, typing-extensions
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, ffmpeg-headless
|
|
|
|
, packaging
|
|
|
|
, pytest-mpl
|
|
|
|
, pytestCheckHook
|
|
|
|
, resampy
|
|
|
|
, samplerate
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "librosa";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "0.10.1";
|
2023-03-15 16:39:30 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "librosa";
|
|
|
|
repo = "librosa";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
fetchSubmodules = true; # for test data
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-zbmU87hI9A1CVcBZ/5FU8z0t6SS4jfJk9bj9kLe/EHI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
2023-11-16 04:20:00 +00:00
|
|
|
# https://github.com/librosa/librosa/issues/1754
|
|
|
|
# https://github.com/librosa/librosa/pull/1755
|
|
|
|
name = "matplotlib-3.8-compat.patch";
|
|
|
|
url = "https://github.com/librosa/librosa/commit/beef47885ce1255b43b65e48ea2054ddace37c6c.patch";
|
|
|
|
hash = "sha256-rrnlUHXHY2me4BWGs3wFq8WJmz75CbXTWKFp3VdJKzE=";
|
2023-08-22 20:05:09 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace "--cov-report term-missing --cov librosa --cov-report=xml " ""
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
audioread
|
|
|
|
decorator
|
|
|
|
joblib
|
|
|
|
lazy-loader
|
|
|
|
msgpack
|
|
|
|
numba
|
|
|
|
numpy
|
|
|
|
pooch
|
|
|
|
scipy
|
|
|
|
scikit-learn
|
|
|
|
soundfile
|
|
|
|
soxr
|
|
|
|
typing-extensions
|
|
|
|
];
|
|
|
|
|
|
|
|
passthru.optional-dependencies.matplotlib = [
|
|
|
|
matplotlib
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
# check that import works, this allows to capture errors like https://github.com/librosa/librosa/issues/1160
|
2023-03-15 16:39:30 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"librosa"
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
ffmpeg-headless
|
|
|
|
packaging
|
|
|
|
pytest-mpl
|
|
|
|
pytestCheckHook
|
|
|
|
resampy
|
|
|
|
samplerate
|
|
|
|
] ++ passthru.optional-dependencies.matplotlib;
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
'';
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# requires network access
|
|
|
|
"test_example"
|
|
|
|
"test_example_info"
|
|
|
|
"test_load_resample"
|
2024-02-07 01:22:34 +00:00
|
|
|
# does not converge
|
|
|
|
"test_nnls_vector"
|
2023-03-15 16:39:30 +00:00
|
|
|
];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-03-15 16:39:30 +00:00
|
|
|
description = "Python library for audio and music analysis";
|
|
|
|
homepage = "https://github.com/librosa/librosa";
|
|
|
|
changelog = "https://github.com/librosa/librosa/releases/tag/${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.isc;
|
2020-09-25 04:45:31 +00:00
|
|
|
maintainers = with maintainers; [ GuillaumeDesforges ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|