Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 fetchpatch2, 7 8 # build-system 9 setuptools, 10 11 # runtime 12 audioread, 13 decorator, 14 joblib, 15 lazy-loader, 16 matplotlib, 17 msgpack, 18 numba, 19 numpy, 20 pooch, 21 scikit-learn, 22 scipy, 23 soundfile, 24 soxr, 25 typing-extensions, 26 27 # tests 28 ffmpeg-headless, 29 packaging, 30 pytest-mpl, 31 pytestCheckHook, 32 resampy, 33 samplerate, 34}: 35 36buildPythonPackage rec { 37 pname = "librosa"; 38 version = "0.10.2.post1"; 39 format = "pyproject"; 40 41 src = fetchFromGitHub { 42 owner = "librosa"; 43 repo = "librosa"; 44 rev = "refs/tags/${version}"; 45 fetchSubmodules = true; # for test data 46 hash = "sha256-0FbKVAFWmcFTW2dR27nif6hPZeIxFWYF1gTm4BEJZ/Q="; 47 }; 48 49 nativeBuildInputs = [ setuptools ]; 50 51 patches = [ 52 (fetchpatch2 { 53 # https://github.com/librosa/librosa/issues/1849 54 name = "librosa-scipy-1.14-compat.patch"; 55 url = "https://github.com/librosa/librosa/commit/d0a12c87cdff715ffb8ac1c7383bba1031aa71e4.patch"; 56 hash = "sha256-NHuGo4U1FRikb5OIkycQBvuZ+0OdG/VykTcuhXkLUug="; 57 }) 58 ]; 59 60 postPatch = '' 61 substituteInPlace setup.cfg \ 62 --replace-fail "--cov-report term-missing --cov librosa --cov-report=xml " "" 63 ''; 64 65 propagatedBuildInputs = [ 66 audioread 67 decorator 68 joblib 69 lazy-loader 70 msgpack 71 numba 72 numpy 73 pooch 74 scipy 75 scikit-learn 76 soundfile 77 soxr 78 typing-extensions 79 ]; 80 81 passthru.optional-dependencies.matplotlib = [ matplotlib ]; 82 83 # check that import works, this allows to capture errors like https://github.com/librosa/librosa/issues/1160 84 pythonImportsCheck = [ "librosa" ]; 85 86 nativeCheckInputs = [ 87 ffmpeg-headless 88 packaging 89 pytest-mpl 90 pytestCheckHook 91 resampy 92 samplerate 93 ] ++ passthru.optional-dependencies.matplotlib; 94 95 preCheck = '' 96 export HOME=$TMPDIR 97 ''; 98 99 disabledTests = 100 [ 101 # requires network access 102 "test_example" 103 "test_example_info" 104 "test_load_resample" 105 "test_cite_released" 106 "test_cite_badversion" 107 "test_cite_unreleased" 108 ] 109 ++ lib.optionals stdenv.isDarwin [ 110 # crashing the python interpreter 111 "test_unknown_time_unit" 112 "test_unknown_wavaxis" 113 "test_waveshow_unknown_wavaxis" 114 "test_waveshow_bad_maxpoints" 115 "test_waveshow_deladaptor" 116 "test_waveshow_disconnect" 117 "test_unknown_axis" 118 "test_axis_bound_warning" 119 "test_auto_aspect" 120 ]; 121 122 meta = with lib; { 123 description = "Python library for audio and music analysis"; 124 homepage = "https://github.com/librosa/librosa"; 125 changelog = "https://github.com/librosa/librosa/releases/tag/${version}"; 126 license = licenses.isc; 127 maintainers = with maintainers; [ GuillaumeDesforges ]; 128 }; 129}