Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, buildPythonPackage
3, fetchPypi
4, fetchpatch
5, attrs
6, argon2-cffi
7, base58
8, cbor2
9, cffi
10, click
11, cryptography
12, ecdsa
13, eth-abi
14, eth-account
15, flatbuffers
16, jinja2
17, hkdf
18, hyperlink
19, mnemonic
20, mock
21, msgpack
22, passlib
23, py-ecc
24, py-eth-sig-utils
25, py-multihash
26, py-ubjson
27, pynacl
28, pygobject3
29, pyopenssl
30, qrcode
31, pytest-asyncio
32, python-snappy
33, pytestCheckHook
34, pythonOlder
35 # , pytrie
36, rlp
37, service-identity
38, spake2
39, twisted
40, txaio
41, ujson
42 # , web3
43 # , wsaccel
44 # , xbr
45, yapf
46 # , zlmdb
47, zope_interface
48}@args:
49
50buildPythonPackage rec {
51 pname = "autobahn";
52 version = "22.7.1";
53 format = "setuptools";
54
55 disabled = pythonOlder "3.7";
56
57 patches = [
58 (fetchpatch {
59 # https://github.com/crossbario/autobahn-python/pull/1604
60 url = "https://github.com/crossbario/autobahn-python/commit/ffe679fae4ebcdde964d4ee88cb82a9c65c40529.patch";
61 sha256 = "sha256-QNnQkxMZJsFbiYUp4Os+dWo7jdCa96+kyb/2HxSMU8k=";
62 })
63 ];
64
65 src = fetchPypi {
66 inherit pname version;
67 sha256 = "sha256-i0Yuouaq1rTcDtRfuAC2y/6wMl5/5pg5B/Ei8r5KH+k=";
68 };
69
70 postPatch = ''
71 substituteInPlace setup.py \
72 --replace "pytest>=2.8.6,<3.3.0" "pytest"
73 '';
74
75 propagatedBuildInputs = [
76 cryptography
77 hyperlink
78 pynacl
79 txaio
80 ];
81
82 checkInputs = [
83 mock
84 pytest-asyncio
85 pytestCheckHook
86 # FIXME: remove the following dependencies when web3 gets added
87 eth-account
88 ] ++ passthru.optional-dependencies.scram
89 ++ passthru.optional-dependencies.serialization
90 ++ passthru.optional-dependencies.xbr;
91
92 preCheck = ''
93 # Run asyncio tests (requires twisted)
94 export USE_ASYNCIO=1
95 '';
96
97 pytestFlagsArray = [
98 "--pyargs autobahn"
99 ];
100
101 pythonImportsCheck = [
102 "autobahn"
103 ];
104
105 passthru.optional-dependencies = rec {
106 all = accelerate ++ compress ++ encryption ++ nvx ++ serialization ++ scram ++ twisted ++ ui ++ xbr;
107 accelerate = [ /* wsaccel */ ];
108 compress = [ python-snappy ];
109 encryption = [ pynacl pyopenssl qrcode /* pytrie */ service-identity ];
110 nvx = [ cffi ];
111 scram = [ argon2-cffi cffi passlib ];
112 serialization = [ cbor2 flatbuffers msgpack ujson py-ubjson ];
113 twisted = [ attrs args.twisted zope_interface ];
114 ui = [ pygobject3 ];
115 xbr = [ base58 cbor2 click ecdsa eth-abi jinja2 hkdf mnemonic py-ecc py-eth-sig-utils py-multihash rlp spake2 twisted /* web3 xbr */ yapf /* zlmdb */ ];
116 };
117
118 meta = with lib; {
119 description = "WebSocket and WAMP in Python for Twisted and asyncio";
120 homepage = "https://crossbar.io/autobahn";
121 license = licenses.mit;
122 maintainers = with maintainers; [ SuperSandro2000 ];
123 };
124}