2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
2024-07-27 06:49:29 +00:00
|
|
|
fetchpatch2,
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
setuptools,
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# runtime
|
|
|
|
audioread,
|
|
|
|
decorator,
|
|
|
|
joblib,
|
|
|
|
lazy-loader,
|
|
|
|
matplotlib,
|
|
|
|
msgpack,
|
|
|
|
numba,
|
|
|
|
numpy,
|
|
|
|
pooch,
|
|
|
|
scikit-learn,
|
|
|
|
scipy,
|
|
|
|
soundfile,
|
|
|
|
soxr,
|
|
|
|
typing-extensions,
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
ffmpeg-headless,
|
|
|
|
packaging,
|
|
|
|
pytest-mpl,
|
|
|
|
pytestCheckHook,
|
|
|
|
resampy,
|
|
|
|
samplerate,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "librosa";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.10.2.post1";
|
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
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-0FbKVAFWmcFTW2dR27nif6hPZeIxFWYF1gTm4BEJZ/Q=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch2 {
|
|
|
|
# https://github.com/librosa/librosa/issues/1849
|
|
|
|
name = "librosa-scipy-1.14-compat.patch";
|
|
|
|
url = "https://github.com/librosa/librosa/commit/d0a12c87cdff715ffb8ac1c7383bba1031aa71e4.patch";
|
|
|
|
hash = "sha256-NHuGo4U1FRikb5OIkycQBvuZ+0OdG/VykTcuhXkLUug=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
2024-05-15 15:35:15 +00:00
|
|
|
--replace-fail "--cov-report term-missing --cov librosa --cov-report=xml " ""
|
2023-03-15 16:39:30 +00:00
|
|
|
'';
|
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
|
|
|
|
];
|
|
|
|
|
2024-10-04 16:56:33 +00:00
|
|
|
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
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "librosa" ];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
ffmpeg-headless
|
|
|
|
packaging
|
|
|
|
pytest-mpl
|
|
|
|
pytestCheckHook
|
|
|
|
resampy
|
|
|
|
samplerate
|
2024-10-04 16:56:33 +00:00
|
|
|
] ++ optional-dependencies.matplotlib;
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
disabledTests =
|
|
|
|
[
|
|
|
|
# requires network access
|
|
|
|
"test_example"
|
|
|
|
"test_example_info"
|
|
|
|
"test_load_resample"
|
|
|
|
"test_cite_released"
|
|
|
|
"test_cite_badversion"
|
|
|
|
"test_cite_unreleased"
|
|
|
|
]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-06-05 15:53:02 +00:00
|
|
|
# crashing the python interpreter
|
|
|
|
"test_unknown_time_unit"
|
|
|
|
"test_unknown_wavaxis"
|
|
|
|
"test_waveshow_unknown_wavaxis"
|
|
|
|
"test_waveshow_bad_maxpoints"
|
|
|
|
"test_waveshow_deladaptor"
|
|
|
|
"test_waveshow_disconnect"
|
|
|
|
"test_unknown_axis"
|
|
|
|
"test_axis_bound_warning"
|
|
|
|
"test_auto_aspect"
|
|
|
|
];
|
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
|
|
|
};
|
|
|
|
}
|