1{ lib
2, fetchPypi
3, buildPythonPackage
4, pythonOlder
5, pythonAtLeast
6, numpy
7, wheel
8, werkzeug
9, protobuf
10, grpcio
11, markdown
12, absl-py
13, google-auth-oauthlib
14, setuptools
15, tensorboard-data-server
16, tensorboard-plugin-wit
17, tensorboard-plugin-profile
18}:
19
20# tensorflow/tensorboard is built from a downloaded wheel, because
21# https://github.com/tensorflow/tensorboard/issues/719 blocks
22# buildBazelPackage.
23
24buildPythonPackage rec {
25 pname = "tensorboard";
26 version = "2.10.0";
27 format = "wheel";
28 disabled = pythonOlder "3.6" || pythonAtLeast "3.11";
29
30 src = fetchPypi {
31 inherit pname version format;
32 dist = "py3";
33 python = "py3";
34 hash = "sha256-dskaXolZzSIIzDLLF6DLACutq7ZqBqwq8Cp4EPSaWeM=";
35 };
36
37 postPatch = ''
38 chmod u+rwx -R ./dist
39 pushd dist
40 wheel unpack --dest unpacked ./*.whl
41 pushd unpacked/tensorboard-${version}
42
43 substituteInPlace tensorboard-${version}.dist-info/METADATA \
44 --replace "google-auth-oauthlib (<0.5,>=0.4.1)" "google-auth-oauthlib (<1.0,>=0.4.1)" \
45 --replace "protobuf (<3.20,>=3.9.2)" "protobuf (>=3.9.2)"
46
47 popd
48 wheel pack ./unpacked/tensorboard-${version}
49 popd
50 '';
51
52 propagatedBuildInputs = [
53 absl-py
54 grpcio
55 google-auth-oauthlib
56 markdown
57 numpy
58 protobuf
59 setuptools
60 tensorboard-data-server
61 tensorboard-plugin-profile
62 tensorboard-plugin-wit
63 werkzeug
64 # not declared in install_requires, but used at runtime
65 # https://github.com/NixOS/nixpkgs/issues/73840
66 wheel
67 ];
68
69 # in the absence of a real test suite, run cli and imports
70 checkPhase = ''
71 $out/bin/tensorboard --help > /dev/null
72 '';
73
74 pythonImportsCheck = [
75 "tensorboard"
76 "tensorboard.backend"
77 "tensorboard.compat"
78 "tensorboard.data"
79 "tensorboard.plugins"
80 "tensorboard.summary"
81 "tensorboard.util"
82 ];
83
84 meta = with lib; {
85 description = "TensorFlow's Visualization Toolkit";
86 homepage = "https://www.tensorflow.org/";
87 license = licenses.asl20;
88 maintainers = with maintainers; [ abbradar ];
89 };
90}