about summary refs log tree commit diff
path: root/pkgs/development/python-modules/tensorflow-probability/default.nix
blob: 4b0e6e7722fe502268e2e56ac4e1bcbfbbce10bd (plain) (blame)
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
{ lib
, fetchFromGitHub
, buildPythonPackage
, python
, tensorflow
, decorator
, cloudpickle
, hypothesis
, scipy
, matplotlib
, mock
, pytest
}:

buildPythonPackage rec {
  pname = "tensorflow-probability";
  version = "0.7";

  src = fetchFromGitHub {
    owner = "tensorflow";
    repo = "probability";
    rev = "v${version}";
    sha256 = "0sy9gmjcvmwciamqvd7kd9qw2wd7ksklk80815fsn7sj0wiqxjyd";
  };

  propagatedBuildInputs = [
    tensorflow
    decorator
    cloudpickle
  ];

  # Listed here:
  # https://github.com/tensorflow/probability/blob/f01d27a6f256430f03b14beb14d37def726cb257/testing/run_tests.sh#L58
  checkInputs = [
    hypothesis
    pytest
    scipy
    matplotlib
    mock
  ];

  # actual checks currently fail because for some reason
  # tf.enable_eager_execution is called too late. Probably because upstream
  # intents these tests to be run by bazel, not plain pytest.
  # checkPhase = ''
  #   # tests need to import from other test files
  #   export PYTHONPATH="$PWD/tensorflow-probability:$PYTHONPATH"
  #   py.test
  # '';

  # sanity check
  checkPhase = ''
    python -c 'import tensorflow_probability'
  '';

  meta = with lib; {
    description = "Library for probabilistic reasoning and statistical analysis";
    homepage = https://www.tensorflow.org/probability/;
    license = licenses.asl20;
    maintainers = with maintainers; [ timokau ];
  };
}