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 [
66 mock
67 pytest-asyncio
68 pytestCheckHook
69 ]
70 ++ optional-dependencies.scram
71 ++ optional-dependencies.serialization;
72
73 preCheck = ''
74 # Run asyncio tests (requires twisted)
75 export USE_ASYNCIO=1
76 '';
77
78 pytestFlagsArray = [
79 "--ignore=./autobahn/twisted"
80 "./autobahn"
81 ];
82
83 pythonImportsCheck = [ "autobahn" ];
84
85 optional-dependencies = lib.fix (self: {
86 all =
87 self.accelerate
88 ++ self.compress
89 ++ self.encryption
90 ++ self.nvx
91 ++ self.serialization
92 ++ self.scram
93 ++ self.twisted
94 ++ self.ui;
95 accelerate = [
96 # wsaccel
97 ];
98 compress = [ python-snappy ];
99 encryption = [
100 pynacl
101 pyopenssl
102 qrcode # pytrie
103 service-identity
104 ];
105 nvx = [ cffi ];
106 scram = [
107 argon2-cffi
108 cffi
109 passlib
110 ];
111 serialization = [
112 cbor2
113 flatbuffers
114 msgpack
115 ujson
116 py-ubjson
117 ];
118 twisted = [
119 attrs
120 twisted
121 zope-interface
122 ];
123 ui = [ pygobject3 ];
124 });
125
126 meta = with lib; {
127 changelog = "https://github.com/crossbario/autobahn-python/blob/${src.rev}/docs/changelog.rst";
128 description = "WebSocket and WAMP in Python for Twisted and asyncio";
129 homepage = "https://crossbar.io/autobahn";
130 license = licenses.mit;
131 maintainers = [ ];
132 };
133}