1{
2 lib,
3 buildPythonPackage,
4 cbor-diag,
5 cbor2,
6 cryptography,
7 dtlssocket,
8 fetchFromGitHub,
9 filelock,
10 ge25519,
11 pygments,
12 pytestCheckHook,
13 pythonAtLeast,
14 pythonOlder,
15 setuptools,
16 termcolor,
17 websockets,
18}:
19
20buildPythonPackage rec {
21 pname = "aiocoap";
22 version = "0.4.10";
23 pyproject = true;
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchFromGitHub {
28 owner = "chrysn";
29 repo = "aiocoap";
30 rev = "refs/tags/${version}";
31 hash = "sha256-sKDkbv8OyPewfQpunFxezP0wjy3EAQxsQ0UfUm0REPM=";
32 };
33
34 build-system = [ setuptools ];
35
36 passthru.optional-dependencies = {
37 oscore = [
38 cbor2
39 cryptography
40 filelock
41 ge25519
42 ];
43 tinydtls = [ dtlssocket ];
44 ws = [ websockets ];
45 prettyprint = [
46 termcolor
47 cbor2
48 pygments
49 cbor-diag
50 ];
51 };
52
53 nativeCheckInputs = [ pytestCheckHook ];
54
55 disabledTestPaths = [
56 # Don't test the plugins
57 "tests/test_tls.py"
58 "tests/test_reverseproxy.py"
59 "tests/test_oscore_plugtest.py"
60 ];
61
62 disabledTests =
63 [
64 # Communication is not properly mocked
65 "test_uri_parser"
66 # Doctest
67 "test_001"
68 ]
69 ++ lib.optionals (pythonAtLeast "3.12") [
70 # https://github.com/chrysn/aiocoap/issues/339
71 "TestServerTCP::test_big_resource"
72 "TestServerTCP::test_empty_accept"
73 "TestServerTCP::test_error_resources"
74 "TestServerTCP::test_fast_resource"
75 "TestServerTCP::test_js_accept"
76 "TestServerTCP::test_manualbig_resource"
77 "TestServerTCP::test_nonexisting_resource"
78 "TestServerTCP::test_replacing_resource"
79 "TestServerTCP::test_root_resource"
80 "TestServerTCP::test_slow_resource"
81 "TestServerTCP::test_slowbig_resource"
82 "TestServerTCP::test_spurious_resource"
83 "TestServerTCP::test_unacceptable_accept"
84 ];
85
86 pythonImportsCheck = [ "aiocoap" ];
87
88 meta = with lib; {
89 description = "Python CoAP library";
90 homepage = "https://aiocoap.readthedocs.io/";
91 changelog = "https://github.com/chrysn/aiocoap/blob/${version}/NEWS";
92 license = with licenses; [ mit ];
93 maintainers = with maintainers; [ fab ];
94 };
95}