1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-core,
8
9 # dependencies
10 aiofiles,
11 aiohttp,
12 aiohttp-socks,
13 h11,
14 h2,
15 jsonschema,
16 pycryptodome,
17 unpaddedbase64,
18
19 # optional-dependencies
20 atomicwrites,
21 cachetools,
22 peewee,
23 python-olm,
24
25 # tests
26 aioresponses,
27 faker,
28 hpack,
29 hyperframe,
30 hypothesis,
31 pytest-aiohttp,
32 pytest-benchmark,
33 pytestCheckHook,
34
35 # passthru tests
36 nixosTests,
37 opsdroid,
38 pantalaimon,
39 weechatScripts,
40 zulip,
41}:
42
43buildPythonPackage rec {
44 pname = "matrix-nio";
45 version = "0.24.0";
46 format = "pyproject";
47
48 src = fetchFromGitHub {
49 owner = "poljar";
50 repo = "matrix-nio";
51 rev = version;
52 hash = "sha256-XlswVHLvKOi1qr+I7Mbm4IBjn1DG7glgDsNY48NA5Ew=";
53 };
54
55 nativeBuildInputs = [ poetry-core ];
56
57 propagatedBuildInputs = [
58 aiofiles
59 aiohttp
60 aiohttp-socks
61 h11
62 h2
63 jsonschema
64 pycryptodome
65 unpaddedbase64
66 ];
67
68 passthru.optional-dependencies = {
69 e2e = [
70 atomicwrites
71 cachetools
72 python-olm
73 peewee
74 ];
75 };
76
77 nativeCheckInputs = [
78 aioresponses
79 faker
80 hpack
81 hyperframe
82 hypothesis
83 pytest-aiohttp
84 pytest-benchmark
85 pytestCheckHook
86 ] ++ passthru.optional-dependencies.e2e;
87
88 pytestFlagsArray = [ "--benchmark-disable" ];
89
90 disabledTests = [
91 # touches network
92 "test_connect_wrapper"
93 # time dependent and flaky
94 "test_transfer_monitor_callbacks"
95 ];
96
97 passthru.tests = {
98 inherit (nixosTests)
99 dendrite
100 matrix-appservice-irc
101 matrix-conduit
102 mjolnir
103 ;
104 inherit (weechatScripts) weechat-matrix;
105 inherit opsdroid pantalaimon zulip;
106 };
107
108 meta = with lib; {
109 homepage = "https://github.com/poljar/matrix-nio";
110 changelog = "https://github.com/poljar/matrix-nio/blob/${version}/CHANGELOG.md";
111 description = "A Python Matrix client library, designed according to sans I/O principles";
112 license = licenses.isc;
113 maintainers = with maintainers; [
114 tilpner
115 emily
116 symphorien
117 ];
118 };
119}