From 399109c44de491d8987437d82b7366d91a4911b4 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 30 Nov 2024 15:34:23 +0100 Subject: [PATCH] python312Packages.powerapi: init at 2.9.1 Python framework for building software-defined power meters https://github.com/powerapi-ng/powerapi --- .../python-modules/powerapi/default.nix | 64 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 66 insertions(+) create mode 100644 pkgs/development/python-modules/powerapi/default.nix diff --git a/pkgs/development/python-modules/powerapi/default.nix b/pkgs/development/python-modules/powerapi/default.nix new file mode 100644 index 000000000000..cdda78ab7e3c --- /dev/null +++ b/pkgs/development/python-modules/powerapi/default.nix @@ -0,0 +1,64 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + influxdb-client, + kubernetes, + mock, + prometheus-client, + pymongo, + pytest-cov-stub, + pytest-timeout, + pytestCheckHook, + pythonOlder, + pyzmq, + setproctitle, + setuptools, +}: + +buildPythonPackage rec { + pname = "powerapi"; + version = "2.9.1"; + pyproject = true; + + disabled = pythonOlder "3.10"; + + src = fetchFromGitHub { + owner = "powerapi-ng"; + repo = "powerapi"; + rev = "refs/tags/v${version}"; + hash = "sha256-iFWCrO9frMK68kefmKQrXra1g5efDCj2ZOlVwxDNvXw="; + }; + + build-system = [ setuptools ]; + + dependencies = [ + pyzmq + setproctitle + ]; + + optional-dependencies = { + influxdb = [ influxdb-client ]; + kubernetes = [ kubernetes ]; + mongodb = [ pymongo ]; + # opentsdb = [ opentsdb-py ]; + prometheus = [ prometheus-client ]; + }; + + nativeCheckInputs = [ + mock + pytest-cov-stub + pytestCheckHook + pytest-timeout + ] ++ lib.flatten (builtins.attrValues optional-dependencies); + + pythonImportsCheck = [ "powerapi" ]; + + meta = { + description = "Python framework for building software-defined power meters"; + homepage = "https://github.com/powerapi-ng/powerapi"; + changelog = "https://github.com/powerapi-ng/powerapi/releases/tag/v${version}"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 62a1df04f4d3..2bee3ced1d94 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10829,6 +10829,8 @@ self: super: with self; { power = callPackage ../development/python-modules/power { }; + powerapi = callPackage ../development/python-modules/powerapi { }; + powerline = callPackage ../development/python-modules/powerline { }; powerline-mem-segment = callPackage ../development/python-modules/powerline-mem-segment { };