1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 aiohttp,
11 eth-abi,
12 eth-account,
13 eth-hash,
14 eth-typing,
15 eth-utils,
16 hexbytes,
17 jsonschema,
18 lru-dict,
19 protobuf,
20 pydantic,
21 requests,
22 types-requests,
23 websockets,
24
25 # optional-dependencies
26 ipfshttpclient,
27
28 # tests
29 eth-tester,
30 flaky,
31 hypothesis,
32 py-evm,
33 pytest-asyncio_0_21,
34 pytest-mock,
35 pytest-xdist,
36 pytestCheckHook,
37 pyunormalize,
38}:
39
40buildPythonPackage rec {
41 pname = "web3";
42 version = "7.13.0";
43 pyproject = true;
44
45 src = fetchFromGitHub {
46 owner = "ethereum";
47 repo = "web3.py";
48 tag = "v${version}";
49 hash = "sha256-cG4P/mrvQ3GlGT17o5yVGZtIM5Vgi2+iojUsYSBbhFA=";
50 };
51
52 build-system = [ setuptools ];
53
54 pythonRelaxDeps = [
55 "websockets"
56 ];
57
58 dependencies = [
59 aiohttp
60 eth-abi
61 eth-account
62 eth-hash
63 ]
64 ++ eth-hash.optional-dependencies.pycryptodome
65 ++ [
66 eth-typing
67 eth-utils
68 hexbytes
69 jsonschema
70 lru-dict
71 protobuf
72 pydantic
73 requests
74 types-requests
75 websockets
76 ];
77
78 # Note: to reflect the extra_requires in main/setup.py.
79 optional-dependencies = {
80 ipfs = [ ipfshttpclient ];
81 };
82
83 nativeCheckInputs = [
84 eth-tester
85 flaky
86 hypothesis
87 py-evm
88 pytest-asyncio_0_21
89 pytest-mock
90 pytest-xdist
91 pytestCheckHook
92 pyunormalize
93 ];
94
95 disabledTests = [
96 # side-effect: runs pip online check and is blocked by sandbox
97 "test_install_local_wheel"
98
99 # not sure why they fail
100 "test_async_init_multiple_contracts_performance"
101 "test_init_multiple_contracts_performance"
102
103 # AssertionError: assert '/build/geth.ipc' == '/tmp/geth.ipc
104 "test_get_dev_ipc_path"
105
106 # Require network access
107 "test_websocket_provider_timeout"
108 ];
109
110 disabledTestPaths = [
111 # requires geth library and binaries
112 "tests/integration/go_ethereum"
113
114 # requires local running beacon node
115 "tests/beacon"
116 ];
117
118 pythonImportsCheck = [ "web3" ];
119
120 meta = {
121 description = "Python interface for interacting with the Ethereum blockchain and ecosystem";
122 homepage = "https://web3py.readthedocs.io/";
123 changelog = "https://web3py.readthedocs.io/en/stable/release_notes.html";
124 license = lib.licenses.mit;
125 maintainers = with lib.maintainers; [ hellwolf ];
126 };
127}