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