1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, logbook
5, aiofiles
6, aiohttp
7, aiohttp-socks
8, aioresponses
9, atomicwrites
10, attrs
11, cachetools
12, faker
13, future
14, git
15, h11
16, h2
17, hypothesis
18, jsonschema
19, peewee
20, poetry-core
21, py
22, pycryptodome
23, pytest-aiohttp
24, pytest-benchmark
25, pytestCheckHook
26, python-olm
27, unpaddedbase64
28}:
29
30buildPythonPackage rec {
31 pname = "matrix-nio";
32 version = "0.20.1";
33 format = "pyproject";
34
35 src = fetchFromGitHub {
36 owner = "poljar";
37 repo = "matrix-nio";
38 rev = version;
39 hash = "sha256-6oMOfyl8yR8FMprPYD831eiXh9g/bqslvxDmVcrNK80=";
40 };
41
42 postPatch = ''
43 substituteInPlace pyproject.toml \
44 --replace 'aiofiles = "^0.6.0"' 'aiofiles = "*"' \
45 --replace 'h11 = "^0.12.0"' 'h11 = "*"' \
46 --replace 'cachetools = { version = "^4.2.1", optional = true }' 'cachetools = { version = "*", optional = true }' \
47 --replace 'aiohttp-socks = "^0.7.0"' 'aiohttp-socks = "*"'
48 '';
49
50 nativeBuildInputs = [
51 git
52 poetry-core
53 ];
54
55 propagatedBuildInputs = [
56 aiofiles
57 aiohttp
58 aiohttp-socks
59 attrs
60 future
61 h11
62 h2
63 jsonschema
64 logbook
65 pycryptodome
66 unpaddedbase64
67 ];
68
69 passthru.optional-dependencies = {
70 e2e = [
71 atomicwrites
72 cachetools
73 python-olm
74 peewee
75 ];
76 };
77
78 nativeCheckInputs = [
79 aioresponses
80 faker
81 hypothesis
82 py
83 pytest-aiohttp
84 pytest-benchmark
85 pytestCheckHook
86 ] ++ passthru.optional-dependencies.e2e;
87
88 pytestFlagsArray = [
89 "--benchmark-disable"
90 ];
91
92 disabledTests = [
93 # touches network
94 "test_connect_wrapper"
95 # time dependent and flaky
96 "test_transfer_monitor_callbacks"
97 ];
98
99 meta = with lib; {
100 homepage = "https://github.com/poljar/matrix-nio";
101 changelog = "https://github.com/poljar/matrix-nio/blob/${version}/CHANGELOG.md";
102 description = "A Python Matrix client library, designed according to sans I/O principles";
103 license = licenses.isc;
104 maintainers = with maintainers; [ tilpner emily symphorien ];
105 };
106}