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
22}:
23
24buildPythonPackage rec {
25 version = "1.0.1";
26 pname = "rl-coach";
27
28 src = fetchPypi {
29 inherit pname version;
30 sha256 = "0i47hf0l76ydyrky6f8h760bfr0zg5g3vy675x6m6pgm9wrklkqc";
31 };
32
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 ];
51
52 checkInputs = [
53 pytest
54 ];
55
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 '';
75
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
80
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
83
84 # backports of python3 features not needed
85 # https://github.com/NervanaSystems/coach/issues/324
86 sed -i '/futures/d' requirements.txt
87 '';
88
89 disabled = pythonOlder "3.5"; # minimum required version
90
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 };
99}