31 pname = "tensorflow-probability";
33 # first build all binaries and generate setup.py using bazel
34 bazel-wheel = buildBazelPackage {
35 name = "tensorflow_probability-${version}-py2.py3-none-any.whl";
36 src = fetchFromGitHub {
39 rev = "refs/tags/v${version}";
40 hash = "sha256-DsJd1E5n86xNS7Ci0DXxoUxQ9jH8OwTZq2UuLlQtMUU=";
43 # needed to create the output wheel in installPhase
53 bazelTargets = [ ":pip_pkg" ];
54 LIBTOOL = lib.optionalString stdenv.isDarwin "${cctools}/bin/libtool";
57 sha256 = "sha256-1iO/eXz1wvSIRTmGuGZDF9VeDVTiWYnjw0Cby4n/6HM=";
66 # work around timestamp issues
67 # https://github.com/NixOS/nixpkgs/issues/270#issuecomment-467583872
68 export SOURCE_DATE_EPOCH=315532800
70 # First build, then move. Otherwise pip_pkg would create the dir $out
71 # and then put the wheel in that directory. However we want $out to
72 # point directly to the wheel file.
73 ./bazel-bin/pip_pkg . --release
78 in buildPythonPackage {
79 inherit version pname;
84 propagatedBuildInputs = [
96 # https://github.com/tensorflow/probability/blob/f3777158691787d3658b5e80883fe1a933d48989/testing/dependency_install_lib.sh#L83
107 # Ideally, we run unit tests with pytest, but in checkPhase, only the Bazel-build wheel is available.
108 # But it seems not guaranteed that running the tests with pytest will even work, see
109 # https://github.com/tensorflow/probability/blob/c2a10877feb2c4c06a4dc58281e69c37a11315b9/CONTRIBUTING.md?plain=1#L69
110 # Ideally, tests would be run using Bazel. For now, lets's do a...
113 pythonImportsCheck = [ "tensorflow_probability" ];
116 description = "Library for probabilistic reasoning and statistical analysis";
117 homepage = "https://www.tensorflow.org/probability/";
118 license = licenses.asl20;
119 maintainers = with maintainers; [ GaetanLepage ];