about summary refs log tree commit diff
path: root/pkgs/development/python-modules/ray/default.nix
blob: 6a9532f953d52f67ea3d7bafc6af9bd412859b5f (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
{
  lib,
  buildPythonPackage,
  pythonOlder,
  pythonAtLeast,
  python,
  fetchPypi,
  autoPatchelfHook,

  # dependencies
  aiohttp,
  aiohttp-cors,
  aiosignal,
  attrs,
  click,
  cloudpickle,
  colorama,
  colorful,
  cython,
  filelock,
  frozenlist,
  gpustat,
  grpcio,
  jsonschema,
  msgpack,
  numpy,
  opencensus,
  packaging,
  prometheus-client,
  psutil,
  pydantic,
  py-spy,
  pyyaml,
  requests,
  setproctitle,
  smart-open,
  virtualenv,

  # optional-dependencies
  fsspec,
  pandas,
  pyarrow,
  dm-tree,
  gym,
  lz4,
  matplotlib,
  scikit-image,
  scipy,
  aiorwlock,
  fastapi,
  starlette,
  uvicorn,
  tabulate,
  tensorboardx,
}:

let
  pname = "ray";
  version = "2.37.0";
in
buildPythonPackage rec {
  inherit pname version;
  format = "wheel";

  disabled = pythonOlder "3.10" || pythonAtLeast "3.13";

  src =
    let
      pyShortVersion = "cp${builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion}";
      binary-hash = (import ./binary-hashes.nix)."${pyShortVersion}" or { };
    in
    fetchPypi (
      {
        inherit pname version format;
        dist = pyShortVersion;
        python = pyShortVersion;
        abi = pyShortVersion;
        platform = "manylinux2014_x86_64";
      }
      // binary-hash
    );

  nativeBuildInputs = [
    autoPatchelfHook
  ];

  pythonRelaxDeps = [
    "click"
    "grpcio"
    "protobuf"
    "virtualenv"
  ];

  dependencies = [
    aiohttp
    aiohttp-cors
    aiosignal
    attrs
    click
    cloudpickle
    colorama
    colorful
    cython
    filelock
    frozenlist
    gpustat
    grpcio
    jsonschema
    msgpack
    numpy
    opencensus
    packaging
    prometheus-client
    psutil
    pydantic
    py-spy
    pyyaml
    requests
    setproctitle
    smart-open
    virtualenv
  ];

  optional-dependencies = rec {
    air-deps = data-deps ++ serve-deps ++ tune-deps ++ rllib-deps;
    data-deps = [
      fsspec
      pandas
      pyarrow
    ];
    rllib-deps = tune-deps ++ [
      dm-tree
      gym
      lz4
      matplotlib
      pyyaml
      scikit-image
      scipy
    ];
    serve-deps = [
      aiorwlock
      fastapi
      pandas
      starlette
      uvicorn
    ];
    tune-deps = [
      tabulate
      tensorboardx
    ];
  };

  postInstall = ''
    chmod +x $out/${python.sitePackages}/ray/core/src/ray/{gcs/gcs_server,raylet/raylet}
  '';

  pythonImportsCheck = [ "ray" ];

  meta = {
    description = "Unified framework for scaling AI and Python applications";
    homepage = "https://github.com/ray-project/ray";
    changelog = "https://github.com/ray-project/ray/releases/tag/ray-${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ billhuang ];
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    platforms = [ "x86_64-linux" ];
  };
}