summary refs log tree commit diff
path: root/pkgs/development/python-modules/amqtt/default.nix
blob: 6f4a5007e7c6ced2bf3ec3701a9acbcf26ae21b3 (plain) (blame)
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
73
74
75
76
77
78
79
80
81
82
{ lib
, buildPythonPackage
, docopt
, fetchFromGitHub
, fetchpatch
, hypothesis
, passlib
, poetry-core
, pytest-logdog
, pytest-asyncio
, pytestCheckHook
, pythonOlder
, pyyaml
, setuptools
, transitions
, websockets
}:

buildPythonPackage rec {
  pname = "amqtt";
  version = "unstable-2022-05-29";
  format = "pyproject";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "Yakifo";
    repo = pname;
    rev = "09ac98d39a711dcff0d8f22686916e1c2495144b";
    hash = "sha256-8T1XhBSOiArlUQbQ41LsUogDgOurLhf+M8mjIrrAC4s=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace 'transitions = "^0.8.0"' 'transitions = "*"'
  '';

  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs = [
    docopt
    passlib
    pyyaml
    setuptools
    transitions
    websockets
  ];

  checkInputs = [
    hypothesis
    pytest-logdog
    pytest-asyncio
    pytestCheckHook
  ];

  pytestFlagsArray = [
    "--asyncio-mode=auto"
  ];

  disabledTestPaths = [
    # Test are not ported from hbmqtt yet
    "tests/test_client.py"
  ];

  preCheck = ''
    # Some tests need amqtt
    export PATH=$out/bin:$PATH
  '';

  pythonImportsCheck = [
    "amqtt"
  ];

  meta = with lib; {
    description = "Python MQTT client and broker implementation";
    homepage = "https://amqtt.readthedocs.io/";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ fab ];
  };
}