summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/powerapi/default.nix
blob: 5cf9d0aa5104cb03141ec678836ec21d9dae22e3 (plain)
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
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  influxdb-client,
  kubernetes,
  mock,
  prometheus-client,
  pymongo,
  pytest-cov-stub,
  pytest-timeout,
  pytestCheckHook,
  pyzmq,
  setproctitle,
  setuptools,
}:

buildPythonPackage rec {
  pname = "powerapi";
  version = "2.10.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "powerapi-ng";
    repo = "powerapi";
    tag = "v${version}";
    hash = "sha256-rn1qe0RwYuUR23CgzOOeiwe1wuFihnhQ9a6ALgSP/cQ=";
  };

  __darwinAllowLocalNetworking = true;

  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.concatAttrValues optional-dependencies;

  pythonImportsCheck = [ "powerapi" ];

  disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
    "test_puller"
    "TestDispatcher"
    "TestK8sProcessor"
    "TestPusher"
  ];

  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/${src.tag}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ fab ];
  };
}