Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / python-modules / rl-coach / default.nix
blob0724abec19a9bc283934324c2abf540cd621f488
1 { lib
2 , buildPythonPackage
3 , pythonOlder
4 , fetchPypi
5 , tensorflow
6 , annoy
7 , pillow
8 , matplotlib
9 , numpy
10 , pandas
11 , pygame
12 , pyopengl
13 , scipy
14 , scikitimage
15 , gym
16 , bokeh
17 , kubernetes
18 , redis
19 , minio
20 , pytest
21 , psutil
24 buildPythonPackage rec {
25   version = "1.0.1";
26   pname = "rl-coach";
28   src = fetchPypi {
29     inherit pname version;
30     sha256 = "0i47hf0l76ydyrky6f8h760bfr0zg5g3vy675x6m6pgm9wrklkqc";
31   };
33   propagatedBuildInputs = [
34     tensorflow
35     annoy
36     pillow
37     matplotlib
38     numpy
39     pandas
40     pygame
41     pyopengl
42     scipy
43     scikitimage
44     gym
45     bokeh
46     kubernetes
47     redis
48     minio
49     psutil
50   ];
52   checkInputs = [
53     pytest
54   ];
56   # run only some tests that do not need any optional dependencies
57   # available tests: https://github.com/NervanaSystems/coach/tree/master/rl_coach/tests
58   testsToRun = [
59     # test only the tensorflow backend (not mxnet)
60     "architectures/tensorflow_components"
61     "agents"
62     "exploration_policies"
63     "filters"
64     "memories"
65     "utils"
66   ];
67   checkPhase = let
68     fullTestPaths = map (testfile: "rl_coach/tests/${testfile}") testsToRun;
69     escapedPaths = map lib.escapeShellArg fullTestPaths;
70     pytestArgs = builtins.concatStringsSep " " escapedPaths;
71   in
72   ''
73     pytest ${pytestArgs}
74   '';
76   postPatch = ''
77     # pinned to 8.0.1 for unknown reason, at least basic functionallity seems to work without it
78     # https://github.com/NervanaSystems/coach/pull/149#issuecomment-495915804
79     sed -i '/kubernetes/d' requirements.txt
81     # this is just an "intel-optimized" version of tensorflow, e.g. an implementation detail
82     sed -i 's/intel-tensorflow/tensorflow/g' setup.py
84     # backports of python3 features not needed
85     # https://github.com/NervanaSystems/coach/issues/324
86     sed -i '/futures/d' requirements.txt
87   '';
89   disabled = pythonOlder "3.5"; # minimum required version
91   meta = with lib; {
92     description = "Enables easy experimentation with state of the art Reinforcement Learning algorithms";
93     homepage = "https://nervanasystems.github.io/coach/";
94     license = licenses.asl20;
95     maintainers = with maintainers; [ timokau ];
96     # pythonPackages.gym is too new
97     broken = true; # since 2020-04-20
98   };