summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/etcd3/default.nix
blob: 6550edc9473ccc2d3fb2ee7c39c2de61268ada7c (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
{
  lib,
  buildPythonPackage,
  etcd,
  fetchFromGitHub,
  grpcio,
  hypothesis,
  mock,
  pifpaf,
  protobuf,
  pytestCheckHook,
  six,
  tenacity,
  setuptools,
}:

buildPythonPackage rec {
  pname = "etcd3";
  version = "0.12.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "kragniz";
    repo = "python-etcd3";
    tag = "v${version}";
    hash = "sha256-YM72+fkCDYXl6DORJa/O0sqXqHDWQcFLv2ifQ9kEHBo=";
  };

  build-system = [ setuptools ];

  env = {
    # make protobuf compatible with old versions
    # https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
    PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";
  };

  dependencies = [
    grpcio
    protobuf
    six
    tenacity
  ];

  # various failures and incompatible with newer hypothesis versions
  doCheck = false;

  nativeCheckInputs = [
    etcd
    hypothesis
    mock
    pifpaf
    pytestCheckHook
  ];

  preCheck = ''
    pifpaf -e PYTHON run etcd --cluster
  '';

  pythonImportsCheck = [ "etcd3" ];

  meta = {
    description = "Python client for the etcd API v3";
    homepage = "https://github.com/kragniz/python-etcd3";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ moraxyc ];
  };
}