1{
2 lib,
3 buildPythonPackage,
4 etcd,
5 fetchFromGitHub,
6 grpcio,
7 hypothesis,
8 mock,
9 pifpaf,
10 protobuf,
11 pytestCheckHook,
12 six,
13 tenacity,
14 setuptools,
15}:
16
17buildPythonPackage rec {
18 pname = "etcd3";
19 version = "0.12.0";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "kragniz";
24 repo = "python-etcd3";
25 tag = "v${version}";
26 hash = "sha256-YM72+fkCDYXl6DORJa/O0sqXqHDWQcFLv2ifQ9kEHBo=";
27 };
28
29 build-system = [ setuptools ];
30
31 env = {
32 # make protobuf compatible with old versions
33 # https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
34 PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";
35 };
36
37 dependencies = [
38 grpcio
39 protobuf
40 six
41 tenacity
42 ];
43
44 # various failures and incompatible with newer hypothesis versions
45 doCheck = false;
46
47 nativeCheckInputs = [
48 etcd
49 hypothesis
50 mock
51 pifpaf
52 pytestCheckHook
53 ];
54
55 preCheck = ''
56 pifpaf -e PYTHON run etcd --cluster
57 '';
58
59 pythonImportsCheck = [ "etcd3" ];
60
61 meta = {
62 description = "Python client for the etcd API v3";
63 homepage = "https://github.com/kragniz/python-etcd3";
64 license = lib.licenses.asl20;
65 maintainers = with lib.maintainers; [ moraxyc ];
66 };
67}