1{
2 lib,
3 buildPythonPackage,
4 click,
5 dm-tree,
6 docutils,
7 etils,
8 fetchFromGitHub,
9 fetchpatch,
10 numpy,
11 pythonOlder,
12 tabulate,
13 tensorflow,
14 tensorflow-datasets,
15 wrapt,
16}:
17
18buildPythonPackage rec {
19 pname = "dm-sonnet";
20 version = "2.0.2";
21 format = "setuptools";
22
23 disabled = pythonOlder "3.6";
24
25 src = fetchFromGitHub {
26 owner = "deepmind";
27 repo = "sonnet";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-WkloUbqSyPG3cbLG8ktsjdluACkCbUZ7t6rYWst8rs8=";
30 };
31
32 patches = [
33 (fetchpatch {
34 name = "replace-np-bool-with-np-bool_.patch";
35 url = "https://github.com/deepmind/sonnet/commit/df5d099d4557a9a81a0eb969e5a81ed917bcd612.patch";
36 hash = "sha256-s7abl83osD4wa0ZhqgDyjqQ3gagwGYCdQifwFqhNp34=";
37 })
38 ];
39
40 propagatedBuildInputs = [
41 dm-tree
42 etils
43 numpy
44 tabulate
45 wrapt
46 ] ++ etils.optional-dependencies.epath;
47
48 passthru.optional-dependencies = {
49 tensorflow = [ tensorflow ];
50 };
51
52 nativeCheckInputs = [
53 click
54 docutils
55 tensorflow
56 tensorflow-datasets
57 ];
58
59 pythonImportsCheck = [ "sonnet" ];
60
61 meta = with lib; {
62 description = "Library for building neural networks in TensorFlow";
63 homepage = "https://github.com/deepmind/sonnet";
64 license = licenses.asl20;
65 maintainers = with maintainers; [ onny ];
66 };
67}