at master 1.7 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # nativeBuildInputs 7 cmake, 8 pybind11, 9 10 # buildInputs 11 abseil-cpp, 12 13 # build-system 14 setuptools, 15 16 # dependencies 17 absl-py, 18 attrs, 19 numpy, 20 wrapt, 21}: 22buildPythonPackage rec { 23 pname = "dm-tree"; 24 version = "0.1.9"; 25 pyproject = true; 26 27 src = fetchFromGitHub { 28 owner = "deepmind"; 29 repo = "tree"; 30 tag = version; 31 hash = "sha256-cHuaqA89r90TCPVHNP7B1cfK+WxqmfTXndJ/dRdmM24="; 32 }; 33 # Allows to forward cmake args through the conventional `cmakeFlags` 34 postPatch = '' 35 substituteInPlace setup.py \ 36 --replace-fail \ 37 "cmake_args = [" \ 38 'cmake_args = [ *os.environ.get("cmakeFlags", "").split(),' 39 substituteInPlace tree/CMakeLists.txt \ 40 --replace-fail \ 41 "CMAKE_CXX_STANDARD 14" \ 42 "CMAKE_CXX_STANDARD 17" 43 ''; 44 cmakeFlags = [ 45 (lib.cmakeBool "USE_SYSTEM_ABSEIL" true) 46 (lib.cmakeBool "USE_SYSTEM_PYBIND11" true) 47 ]; 48 dontUseCmakeConfigure = true; 49 50 nativeBuildInputs = [ 51 cmake 52 pybind11 53 ]; 54 55 buildInputs = [ 56 abseil-cpp 57 pybind11 58 ]; 59 60 build-system = [ setuptools ]; 61 62 # It is unclear whether those are runtime dependencies or simply test dependencies 63 # https://github.com/google-deepmind/tree/issues/127 64 dependencies = [ 65 absl-py 66 attrs 67 numpy 68 wrapt 69 ]; 70 71 pythonImportsCheck = [ "tree" ]; 72 73 meta = { 74 description = "Tree is a library for working with nested data structures"; 75 homepage = "https://github.com/deepmind/tree"; 76 changelog = "https://github.com/google-deepmind/tree/releases/tag/${version}"; 77 license = lib.licenses.asl20; 78 maintainers = with lib.maintainers; [ 79 samuela 80 ndl 81 ]; 82 }; 83}