at 25.11-pre 5.3 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 pythonOlder, 6 pythonAtLeast, 7 python, 8 fetchPypi, 9 autoPatchelfHook, 10 11 # dependencies 12 click, 13 filelock, 14 jsonschema, 15 msgpack, 16 packaging, 17 protobuf, 18 pyyaml, 19 requests, 20 watchfiles, 21 22 # optional-dependencies 23 # cgraph 24 cupy, 25 # client 26 grpcio, 27 # data 28 fsspec, 29 numpy, 30 pandas, 31 pyarrow, 32 # default 33 aiohttp, 34 aiohttp-cors, 35 colorful, 36 opencensus, 37 prometheus-client, 38 pydantic, 39 py-spy, 40 smart-open, 41 virtualenv, 42 # observability 43 memray, 44 opentelemetry-api, 45 opentelemetry-sdk, 46 opentelemetry-exporter-otlp, 47 # rllib 48 dm-tree, 49 gymnasium, 50 lz4, 51 # ormsgpack, 52 scipy, 53 typer, 54 rich, 55 # serve 56 fastapi, 57 starlette, 58 uvicorn, 59 # serve-grpc 60 pyopenssl, 61 # tune 62 tensorboardx, 63}: 64 65let 66 pname = "ray"; 67 version = "2.46.0"; 68in 69buildPythonPackage rec { 70 inherit pname version; 71 format = "wheel"; 72 73 disabled = pythonOlder "3.9" || pythonAtLeast "3.14"; 74 75 src = 76 let 77 pyShortVersion = "cp${builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion}"; 78 platforms = { 79 aarch64-darwin = "macosx_11_0_arm64"; 80 aarch64-linux = "manylinux2014_aarch64"; 81 x86_64-darwin = "macosx_10_15_x86_64"; 82 x86_64-linux = "manylinux2014_x86_64"; 83 }; 84 # ./pkgs/development/python-modules/ray/prefetch.sh 85 # Results are in ./ray-hashes.nix 86 hashes = { 87 x86_64-linux = { 88 cp310 = "sha256-wShQYIxXyK/ZYTqfdX13ZjxQ1L1Od7ovGBQlBSUgwBo="; 89 cp311 = "sha256-1N3tw/TUjfVkvO57ExyYyfiY/vCldIP0ujNfR/lRpi8="; 90 cp312 = "sha256-XOwe3ak/YY/9IwH4HVOYA38D+psWgl5+TYoArnqaQ4E="; 91 cp313 = "sha256-paKMCjEdLDIh3PcpxAiYpt+CRmu1ryHoG+BFPgmFat8="; 92 }; 93 aarch64-linux = { 94 cp310 = "sha256-OWuRKk2/ZJZuL9/Kn6y8r+V7eSykhCrFrhdQf9vf6J8="; 95 cp311 = "sha256-gcjOi3ujPLYH7Hj16yVVRw4wRrsxdzLYKC6BibtYzL0="; 96 cp312 = "sha256-AGy+Go/cN2ZBFKohh3MQDuiROZeF4lbCAuSJWNLawWc="; 97 cp313 = "sha256-gI2uzh8SvYkkucY4Kg+Y2m9caIbPsnHtjYlAeolBPNU="; 98 }; 99 x86_64-darwin = { 100 cp310 = "sha256-cZJEuE33lQLl8JSX8lZhjZTXjWb7ryKUIgCKBWjToP8="; 101 cp311 = "sha256-lCulHeb5zX+y7RdhgYGvSM5rlRd0PTI12EbsMileynY="; 102 cp312 = "sha256-0fN+rSkpljcURyb4CcLg/5WN2cDnWTDvYUFW1qCjpX8="; 103 cp313 = "sha256-svwsQ+oKN1IRk8Ye+aJ7b8qNurEWpYpS/UQ0TNc+Hs4="; 104 }; 105 aarch64-darwin = { 106 cp310 = "sha256-Q3ioaRnmZDI4oQlPcRuH+o3BoYuZjUGQ9pqzPGSiKow="; 107 cp311 = "sha256-r4Tz7QhUu23igZLKngo7+h6zTWnxGK5jSFIhmIlkgMg="; 108 cp312 = "sha256-t6BkrP7ufwZ32ePyXa75xZWTVZ+up2S0Sj4sUzHV2DI="; 109 cp313 = "sha256-QpbdjAF0JWoE7ktUq+ATtoAqRfuF+3z9sTdSMZZdbU0="; 110 }; 111 }; 112 in 113 fetchPypi { 114 inherit pname version format; 115 dist = pyShortVersion; 116 python = pyShortVersion; 117 abi = pyShortVersion; 118 platform = platforms.${stdenv.hostPlatform.system} or { }; 119 sha256 = hashes.${stdenv.hostPlatform.system}.${pyShortVersion} or { }; 120 }; 121 122 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ 123 autoPatchelfHook 124 ]; 125 126 dependencies = [ 127 click 128 filelock 129 jsonschema 130 msgpack 131 packaging 132 protobuf 133 pyyaml 134 requests 135 watchfiles 136 ]; 137 138 optional-dependencies = lib.fix (self: { 139 adag = self.cgraph; 140 air = lib.unique (self.data ++ self.serve ++ self.tune ++ self.train); 141 all = lib.unique ( 142 self.adag 143 ++ self.air 144 ++ self.cgraph 145 ++ self.client 146 ++ self.data 147 ++ self.default 148 ++ self.observability 149 ++ self.rllib 150 ++ self.serve 151 ++ self.train 152 ++ self.tune 153 ); 154 cgraph = [ 155 cupy 156 ]; 157 client = [ grpcio ]; 158 data = [ 159 fsspec 160 numpy 161 pandas 162 pyarrow 163 ]; 164 default = [ 165 aiohttp 166 aiohttp-cors 167 colorful 168 grpcio 169 opencensus 170 prometheus-client 171 pydantic 172 py-spy 173 requests 174 smart-open 175 virtualenv 176 ]; 177 observability = [ 178 memray 179 opentelemetry-api 180 opentelemetry-sdk 181 opentelemetry-exporter-otlp 182 ]; 183 rllib = [ 184 dm-tree 185 gymnasium 186 lz4 187 # ormsgpack 188 pyyaml 189 scipy 190 typer 191 rich 192 ]; 193 serve = lib.unique ( 194 [ 195 fastapi 196 requests 197 starlette 198 uvicorn 199 watchfiles 200 ] 201 ++ self.default 202 ); 203 serve-grpc = lib.unique ( 204 [ 205 grpcio 206 pyopenssl 207 ] 208 ++ self.serve 209 ); 210 train = self.tune; 211 tune = [ 212 fsspec 213 pandas 214 pyarrow 215 requests 216 tensorboardx 217 ]; 218 }); 219 220 postInstall = '' 221 chmod +x $out/${python.sitePackages}/ray/core/src/ray/{gcs/gcs_server,raylet/raylet} 222 ''; 223 224 pythonImportsCheck = [ "ray" ]; 225 226 meta = { 227 description = "Unified framework for scaling AI and Python applications"; 228 homepage = "https://github.com/ray-project/ray"; 229 changelog = "https://github.com/ray-project/ray/releases/tag/ray-${version}"; 230 license = lib.licenses.asl20; 231 maintainers = with lib.maintainers; [ billhuang ]; 232 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 233 platforms = [ 234 "aarch64-darwin" 235 "aarch64-linux" 236 "x86_64-darwin" 237 "x86_64-linux" 238 ]; 239 }; 240}