nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cffi,
8 hatchling,
9 setuptools,
10
11 # dependencies
12 cryptography,
13 hyperlink,
14 pynacl,
15 txaio,
16
17 # optional-dependencies
18 # compress
19 python-snappy,
20 # encryption
21 base58,
22 pyopenssl,
23 qrcode,
24 service-identity,
25 # scram
26 argon2-cffi,
27 passlib,
28 # serialization
29 cbor2,
30 flatbuffers,
31 msgpack,
32 ujson,
33 py-ubjson,
34 # twisted
35 attrs,
36 twisted,
37 zope-interface,
38 # ui
39 pygobject3,
40
41 # tests
42 mock,
43 pytest-asyncio_0,
44 pytestCheckHook,
45}:
46
47buildPythonPackage (finalAttrs: {
48 pname = "autobahn";
49 version = "25.12.2";
50 pyproject = true;
51
52 src = fetchFromGitHub {
53 owner = "crossbario";
54 repo = "autobahn-python";
55 tag = "v${finalAttrs.version}";
56 hash = "sha256-vSS7DpfGfNwQT8OsgEXJaP5J40QFIopdAD94/y7/jFY=";
57 };
58
59 build-system = [
60 cffi
61 hatchling
62 setuptools
63 ];
64
65 dependencies = [
66 cryptography
67 hyperlink
68 pynacl
69 txaio
70 ];
71
72 optional-dependencies = lib.fix (self: {
73 all =
74 self.accelerate
75 ++ self.compress
76 ++ self.encryption
77 ++ self.nvx
78 ++ self.serialization
79 ++ self.scram
80 ++ self.twisted
81 ++ self.ui;
82 accelerate = [
83 # wsaccel
84 ];
85 compress = [ python-snappy ];
86 encryption = [
87 base58
88 # ecdsa (marked as insecure)
89 pynacl
90 pyopenssl
91 qrcode # pytrie
92 service-identity
93 ];
94 nvx = [ cffi ];
95 scram = [
96 argon2-cffi
97 cffi
98 passlib
99 ];
100 serialization = [
101 cbor2
102 flatbuffers
103 msgpack
104 ujson
105 py-ubjson
106 ];
107 twisted = [
108 attrs
109 twisted
110 zope-interface
111 ];
112 ui = [ pygobject3 ];
113 });
114
115 pythonImportsCheck = [ "autobahn" ];
116
117 nativeCheckInputs = [
118 mock
119 pytest-asyncio_0
120 pytestCheckHook
121 ]
122 ++ finalAttrs.passthru.optional-dependencies.encryption
123 ++ finalAttrs.passthru.optional-dependencies.scram
124 ++ finalAttrs.passthru.optional-dependencies.serialization;
125
126 preCheck = ''
127 # Run asyncio tests (requires twisted)
128 export USE_ASYNCIO=1
129 rm src/autobahn/__init__.py
130 '';
131
132 enabledTestPaths = [
133 "src/autobahn"
134 ];
135
136 disabledTestPaths = [
137 "src/autobahn/twisted"
138
139 # Requires insecure ecdsa library
140 "src/autobahn/wamp/test/test_wamp_cryptosign.py"
141 ];
142
143 meta = {
144 description = "WebSocket and WAMP in Python for Twisted and asyncio";
145 homepage = "https://crossbar.io/autobahn";
146 downloadPage = "https://github.com/crossbario/autobahn-python";
147 changelog = "https://github.com/crossbario/autobahn-python/blob/${finalAttrs.src.tag}/docs/changelog.rst";
148 license = lib.licenses.mit;
149 maintainers = [ ];
150 };
151})