1{ stdenv
2, lib
3, buildPythonPackage
4, fetchPypi
5, fetchpatch
6, librosa
7, numpy
8, torch
9}:
10
11buildPythonPackage rec {
12 pname = "torchlibrosa";
13 version = "0.0.9";
14 format = "setuptools";
15
16 src = fetchPypi {
17 inherit pname version;
18 hash = "sha256-+LzejKvLlJIIwWm9rYPCWQDSueIwnG5gbkwNE+wbv0A=";
19 };
20
21 propagatedBuildInputs = [
22 librosa
23 numpy
24 torch
25 ];
26
27 patches = [
28 # Fix run against librosa 0.9.0, https://github.com/qiuqiangkong/torchlibrosa/pull/8
29 (fetchpatch {
30 url = "https://github.com/qiuqiangkong/torchlibrosa/commit/eec7e7559a47d0ef0017322aee29a31dad0572d5.patch";
31 hash = "sha256-c1x3MA14Plm7+lVuqiuLWgSY6FW615qnKbcWAfbrcas=";
32 })
33 ];
34
35 # Project has no tests.
36 # In order to make pythonImportsCheck work, NUMBA_CACHE_DIR env var need to
37 # be set to a writable dir (https://github.com/numba/numba/issues/4032#issuecomment-488102702).
38 # pythonImportsCheck has no pre* hook, use checkPhase to workaround that.
39 checkPhase = ''
40 export NUMBA_CACHE_DIR="$(mktemp -d)"
41 '';
42 pythonImportsCheck = [ "torchlibrosa" ];
43
44 meta = with lib; {
45 description = "PyTorch implemention of part of librosa functions";
46 homepage = "https://github.com/qiuqiangkong/torchlibrosa";
47 license = licenses.mit;
48 maintainers = with maintainers; [ azuwis ];
49 };
50}