1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 attrs,
7 argon2-cffi,
8 cbor2,
9 cffi,
10 cryptography,
11 flatbuffers,
12 hyperlink,
13 mock,
14 msgpack,
15 passlib,
16 py-ubjson,
17 pynacl,
18 pygobject3,
19 pyopenssl,
20 qrcode,
21 pytest-asyncio,
22 python-snappy,
23 pytestCheckHook,
24 pythonOlder,
25 service-identity,
26 setuptools,
27 twisted,
28 txaio,
29 ujson,
30 zope-interface,
31}:
32
33buildPythonPackage rec {
34 pname = "autobahn";
35 version = "24.4.2";
36 pyproject = true;
37
38 disabled = pythonOlder "3.9";
39
40 src = fetchFromGitHub {
41 owner = "crossbario";
42 repo = "autobahn-python";
43 tag = "v${version}";
44 hash = "sha256-aeTE4a37zr83KZ+v947XikzFrHAhkZ4mj4tXdkQnB84=";
45 };
46
47 patches = [
48 (fetchpatch2 {
49 # removal of broken pytest-asyncio markers
50 url = "https://github.com/crossbario/autobahn-python/commit/7bc85b34e200640ab98a41cfddb38267f39bc92e.patch";
51 hash = "sha256-JbuYWQhvjlXuHde8Z3ZSJAyrMOdIcE1GOq+Eh2HTz8c=";
52 })
53 ];
54
55 build-system = [ setuptools ];
56
57 dependencies = [
58 cryptography
59 hyperlink
60 pynacl
61 txaio
62 ];
63
64 nativeCheckInputs = [
65 mock
66 pytest-asyncio
67 pytestCheckHook
68 ]
69 ++ optional-dependencies.scram
70 ++ optional-dependencies.serialization;
71
72 preCheck = ''
73 # Run asyncio tests (requires twisted)
74 export USE_ASYNCIO=1
75 '';
76
77 enabledTestPaths = [
78 "./autobahn"
79 ];
80
81 disabledTestPaths = [
82 "./autobahn/twisted"
83 ];
84
85 pythonImportsCheck = [ "autobahn" ];
86
87 optional-dependencies = lib.fix (self: {
88 all =
89 self.accelerate
90 ++ self.compress
91 ++ self.encryption
92 ++ self.nvx
93 ++ self.serialization
94 ++ self.scram
95 ++ self.twisted
96 ++ self.ui;
97 accelerate = [
98 # wsaccel
99 ];
100 compress = [ python-snappy ];
101 encryption = [
102 pynacl
103 pyopenssl
104 qrcode # pytrie
105 service-identity
106 ];
107 nvx = [ cffi ];
108 scram = [
109 argon2-cffi
110 cffi
111 passlib
112 ];
113 serialization = [
114 cbor2
115 flatbuffers
116 msgpack
117 ujson
118 py-ubjson
119 ];
120 twisted = [
121 attrs
122 twisted
123 zope-interface
124 ];
125 ui = [ pygobject3 ];
126 });
127
128 meta = with lib; {
129 changelog = "https://github.com/crossbario/autobahn-python/blob/${src.rev}/docs/changelog.rst";
130 description = "WebSocket and WAMP in Python for Twisted and asyncio";
131 homepage = "https://crossbar.io/autobahn";
132 license = licenses.mit;
133 maintainers = [ ];
134 };
135}