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