1{ lib
2, buildPythonPackage
3, docopt
4, fetchFromGitHub
5, fetchpatch
6, hypothesis
7, passlib
8, poetry-core
9, pytest-logdog
10, pytest-asyncio
11, pytestCheckHook
12, pythonOlder
13, pyyaml
14, setuptools
15, transitions
16, websockets
17}:
18
19buildPythonPackage rec {
20 pname = "amqtt";
21 version = "unstable-2022-05-29";
22 format = "pyproject";
23
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "Yakifo";
28 repo = pname;
29 rev = "09ac98d39a711dcff0d8f22686916e1c2495144b";
30 hash = "sha256-8T1XhBSOiArlUQbQ41LsUogDgOurLhf+M8mjIrrAC4s=";
31 };
32
33 postPatch = ''
34 substituteInPlace pyproject.toml \
35 --replace 'transitions = "^0.8.0"' 'transitions = "*"' \
36 --replace 'websockets = ">=9.0,<11.0"' 'websockets = "*"'
37 '';
38
39 nativeBuildInputs = [
40 poetry-core
41 ];
42
43 propagatedBuildInputs = [
44 docopt
45 passlib
46 pyyaml
47 setuptools
48 transitions
49 websockets
50 ];
51
52 nativeCheckInputs = [
53 hypothesis
54 pytest-logdog
55 pytest-asyncio
56 pytestCheckHook
57 ];
58
59 pytestFlagsArray = [
60 "--asyncio-mode=auto"
61 ];
62
63 disabledTestPaths = [
64 # Test are not ported from hbmqtt yet
65 "tests/test_client.py"
66 ];
67
68 preCheck = ''
69 # Some tests need amqtt
70 export PATH=$out/bin:$PATH
71 '';
72
73 pythonImportsCheck = [
74 "amqtt"
75 ];
76
77 meta = with lib; {
78 description = "Python MQTT client and broker implementation";
79 homepage = "https://amqtt.readthedocs.io/";
80 license = with licenses; [ mit ];
81 maintainers = with maintainers; [ fab ];
82 };
83}