From 0f2040f80c8e33266655634ee5f780c280caa82d Mon Sep 17 00:00:00 2001 From: Bill Huang Date: Tue, 4 Oct 2022 15:20:28 +0800 Subject: [PATCH] ray-bin: init at 2.0.0 use the correct redis --- .../python-modules/ray/binary-hashes.nix | 11 ++ .../python-modules/ray/default.nix | 166 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 8 + 3 files changed, 185 insertions(+) create mode 100644 pkgs/development/python-modules/ray/binary-hashes.nix create mode 100644 pkgs/development/python-modules/ray/default.nix diff --git a/pkgs/development/python-modules/ray/binary-hashes.nix b/pkgs/development/python-modules/ray/binary-hashes.nix new file mode 100644 index 000000000000..28f9e2103334 --- /dev/null +++ b/pkgs/development/python-modules/ray/binary-hashes.nix @@ -0,0 +1,11 @@ +{ + cp38 = { + sha256 = "da8adfa33ff54bc61cfe80334a0ee889e0060918db6ff9215aebe32e98b1f939"; + }; + cp39 = { + sha256 = "cab13346650f88171b3f348ed352f04695b96d1ab1090ed3b80bdc93e897dbd4"; + }; + cp310 = { + sha256 = "bcf3bff9517d77ea6c98592fa16e1cfb8bc0cfa345d3be69729bfa9c5bd78a7c"; + }; +} diff --git a/pkgs/development/python-modules/ray/default.nix b/pkgs/development/python-modules/ray/default.nix new file mode 100644 index 000000000000..c6b764181875 --- /dev/null +++ b/pkgs/development/python-modules/ray/default.nix @@ -0,0 +1,166 @@ +{ aiohttp +, aiohttp-cors +, aiorwlock +, aiosignal +, attrs +, autoPatchelfHook +, buildBazelPackage +, buildPythonPackage +, fetchPypi +, click +, cloudpickle +, colorama +, colorful +, cython +, dm-tree +, fastapi +, filelock +, frozenlist +, fsspec +, gpustat +, grpc +, grpcio +, gym +, jsonschema +, lib +, lz4 +, matplotlib +, msgpack +, numpy +, opencensus +, packaging +, pandas +, py-spy +, prometheus-client +, protobuf3_20 +, psutil +, pyarrow +, pydantic +, python +, pythonAtLeast +, pythonOlder +, pythonRelaxDepsHook +, pyyaml +, redis +, requests +, scikitimage +, scipy +, setproctitle +, smart-open +, starlette +, stdenv +, tabulate +, tensorboardx +, uvicorn +, virtualenv +}: + +let + pname = "ray"; + version = "2.0.0"; +in +buildPythonPackage rec { + inherit pname version; + format = "wheel"; + + disabled = pythonOlder "3.8" || pythonAtLeast "3.11"; + + src = + let + pyShortVersion = "cp${builtins.replaceStrings ["."] [""] python.pythonVersion}"; + binary-hash = (import ./binary-hashes.nix)."${pyShortVersion}"; + in + fetchPypi ({ + inherit pname version format; + dist = pyShortVersion; + python = pyShortVersion; + abi = pyShortVersion; + platform = "manylinux2014_x86_64"; + } // binary-hash); + + passthru.optional-dependencies = rec { + data-deps = [ + pandas + pyarrow + fsspec + ]; + + serve-deps = [ + aiorwlock + fastapi + pandas + starlette + uvicorn + ]; + + tune-deps = [ + tabulate + tensorboardx + ]; + + rllib-deps = tune-deps ++ [ + dm-tree + gym + lz4 + matplotlib + scikitimage + pyyaml + scipy + ]; + + air-deps = data-deps ++ serve-deps ++ tune-deps ++ rllib-deps; + }; + + nativeBuildInputs = [ + autoPatchelfHook + pythonRelaxDepsHook + ]; + + pythonRelaxDeps = [ "grpcio" "click" "protobuf" ]; + + propagatedBuildInputs = [ + attrs + aiohttp + aiohttp-cors + aiosignal + click + cloudpickle + colorama + colorful + cython + filelock + frozenlist + gpustat + grpcio + jsonschema + msgpack + numpy + opencensus + packaging + py-spy + prometheus-client + protobuf3_20 + psutil + pydantic + pyyaml + requests + setproctitle + smart-open + virtualenv + ]; + + postInstall = '' + chmod +x $out/${python.sitePackages}/ray/core/src/ray/{gcs/gcs_server,raylet/raylet} + ln -sf ${redis}/bin/redis-server $out/${python.sitePackages}/ray/core/src/ray/thirdparty/redis/src/redis-server + ''; + + pythonImportsCheck = [ "ray" ]; + + meta = with lib; { + description = "A unified framework for scaling AI and Python applications"; + homepage = "https://github.com/ray-project/ray"; + license = licenses.asl20; + maintainers = with maintainers; [ billhuang ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 58b814a21b59..08bcbe26dc0d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -433,6 +433,8 @@ in { aiorun = callPackage ../development/python-modules/aiorun { }; + aiorwlock = callPackage ../development/python-modules/aiorwlock { }; + aiosenseme = callPackage ../development/python-modules/aiosenseme { }; aiosenz = callPackage ../development/python-modules/aiosenz { }; @@ -4035,6 +4037,8 @@ in { gpsoauth = callPackage ../development/python-modules/gpsoauth { }; + gpustat = callPackage ../development/python-modules/gpustat { }; + gpxpy = callPackage ../development/python-modules/gpxpy { }; gpy = callPackage ../development/python-modules/gpy { }; @@ -6522,6 +6526,8 @@ in { openbabel = callPackage ../development/libraries/openbabel { inherit (self) python; }; }; + opencensus = callPackage ../development/python-modules/opencensus { }; + opencv3 = toPythonModule (pkgs.opencv3.override { enablePython = true; pythonPackages = self; @@ -9616,6 +9622,8 @@ in { rawkit = callPackage ../development/python-modules/rawkit { }; + ray = callPackage ../development/python-modules/ray { redis = pkgs.redis; }; + rbtools = callPackage ../development/python-modules/rbtools { }; rcssmin = callPackage ../development/python-modules/rcssmin { };