python3Packages.tensorflow-probability: 0.8 -> 0.15.0

tensorflow-probability 0.8 was broken and marked as such (in #108977)
because of a dependency on dm-tree, which seems not to have been
available.
Since dm-tree is now available in nixpkgs (#152971),
tensorflow-probability is easy to fix and to upgrade.

+18 -37
+18 -37
pkgs/development/python-modules/tensorflow-probability/default.nix
··· 1 1 { lib 2 2 , fetchFromGitHub 3 - , fetchpatch 4 - , bazel_0_26 5 3 , buildBazelPackage 6 4 , buildPythonPackage 7 5 , python ··· 11 9 , tensorflow 12 10 , six 13 11 , numpy 12 + , dm-tree 13 + , keras 14 14 , decorator 15 15 , cloudpickle 16 16 , gast 17 17 , hypothesis 18 18 , scipy 19 + , pandas 20 + , mpmath 19 21 , matplotlib 20 22 , mock 21 23 , pytest 22 24 }: 23 25 24 26 let 25 - version = "0.8.0"; 27 + version = "0.15.0"; 26 28 pname = "tensorflow_probability"; 27 29 28 30 # first build all binaries and generate setup.py using bazel 29 31 bazel-wheel = buildBazelPackage { 30 - bazel = bazel_0_26; 31 - 32 32 name = "${pname}-${version}-py2.py3-none-any.whl"; 33 - 34 33 src = fetchFromGitHub { 35 34 owner = "tensorflow"; 36 35 repo = "probability"; 37 - rev = version; 38 - sha256 = "07cm8zba8n0ihzdm3k4a4rsg5v62xxsfvcw4h0niz91c0parqjqy"; 36 + rev = "v" + version; 37 + sha256 = "155fgmra90s08vjnp61qxdrpzq74xa3kdzhgdkavwgc25pvxn3mi"; 39 38 }; 40 - 41 - patches = [ 42 - (fetchpatch { 43 - name = "gast-0.3.patch"; 44 - url = "https://github.com/tensorflow/probability/commit/ae7a9d9771771ec1e7755a3588b9325f050a84cc.patch"; 45 - sha256 = "0kfhx30gshm8f3945na9yjjik71r20qmjzifbigaj4l8dwd9dz1a"; 46 - excludes = ["testing/*"]; 47 - }) 48 - (fetchpatch { 49 - name = "cloudpickle-1.2.patch"; 50 - url = "https://github.com/tensorflow/probability/commit/78ef12b5afe3f567d16c70b74015ed1ddff1b0c8.patch"; 51 - sha256 = "12ms2xcljvvrnig0j78s3wfv4yf3bm5ps4rgfgv5lg2a8mzpc1ga"; 52 - }) 53 - ]; 54 - 55 39 nativeBuildInputs = [ 56 40 # needed to create the output wheel in installPhase 57 41 python ··· 64 48 bazelTarget = ":pip_pkg"; 65 49 66 50 fetchAttrs = { 67 - sha256 = "1qw7vkwnxy45z4vm94isq5m96xiz35sigag7vjg1xb2sklbymxh8"; 51 + sha256 = "0sgxdlw5x3dydy53l10vbrj8smh78b7r1wff8jxcgp4w69mk8zfm"; 68 52 }; 69 53 70 54 buildAttrs = { ··· 98 82 decorator 99 83 cloudpickle 100 84 gast 85 + dm-tree 86 + keras 101 87 ]; 102 88 103 89 # Listed here: 104 - # https://github.com/tensorflow/probability/blob/f01d27a6f256430f03b14beb14d37def726cb257/testing/run_tests.sh#L58 90 + # https://github.com/tensorflow/probability/blob/f3777158691787d3658b5e80883fe1a933d48989/testing/dependency_install_lib.sh#L83 105 91 checkInputs = [ 106 92 hypothesis 107 93 pytest 108 94 scipy 95 + pandas 96 + mpmath 109 97 matplotlib 110 98 mock 111 99 ]; 112 100 113 - # actual checks currently fail because for some reason 114 - # tf.enable_eager_execution is called too late. Probably because upstream 115 - # intents these tests to be run by bazel, not plain pytest. 116 - # checkPhase = '' 117 - # # tests need to import from other test files 118 - # export PYTHONPATH="$PWD/tensorflow-probability:$PYTHONPATH" 119 - # py.test 120 - # ''; 101 + # Ideally, we run unit tests with pytest, but in checkPhase, only the Bazel-build wheel is available. 102 + # But it seems not guaranteed that running the tests with pytest will even work, see 103 + # https://github.com/tensorflow/probability/blob/c2a10877feb2c4c06a4dc58281e69c37a11315b9/CONTRIBUTING.md?plain=1#L69 104 + # Ideally, tests would be run using Bazel. For now, lets's do a... 121 105 122 106 # sanity check 123 - checkPhase = '' 124 - python -c 'import tensorflow_probability' 125 - ''; 107 + pythonImportsCheck = [ "tensorflow_probability" ]; 126 108 127 109 meta = with lib; { 128 - broken = true; # tf-probability 0.8.0 is not compatible with tensorflow 2.3.2 129 110 description = "Library for probabilistic reasoning and statistical analysis"; 130 111 homepage = "https://www.tensorflow.org/probability/"; 131 112 license = licenses.asl20;