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.8.0";
43 pyproject = true;
44
45 src = fetchFromGitHub {
46 owner = "ethereum";
47 repo = "web3.py";
48 tag = "v${version}";
49 hash = "sha256-Rk12QZK47oF0ri1+kCquW4vaqPPPO5UPYOhq4StR1+U=";
50 };
51
52 build-system = [ setuptools ];
53
54 pythonRelaxDeps = [
55 "websockets"
56 ];
57
58 dependencies =
59 [
60 aiohttp
61 eth-abi
62 eth-account
63 eth-hash
64 ]
65 ++ eth-hash.optional-dependencies.pycryptodome
66 ++ [
67 eth-typing
68 eth-utils
69 hexbytes
70 jsonschema
71 lru-dict
72 protobuf
73 pydantic
74 requests
75 types-requests
76 websockets
77 ];
78
79 # Note: to reflect the extra_requires in main/setup.py.
80 optional-dependencies = {
81 ipfs = [ ipfshttpclient ];
82 };
83
84 nativeCheckInputs = [
85 eth-tester
86 flaky
87 hypothesis
88 py-evm
89 pytest-asyncio_0_21
90 pytest-mock
91 pytest-xdist
92 pytestCheckHook
93 pyunormalize
94 ];
95
96 disabledTests = [
97 # side-effect: runs pip online check and is blocked by sandbox
98 "test_install_local_wheel"
99
100 # not sure why they fail
101 "test_async_init_multiple_contracts_performance"
102 "test_init_multiple_contracts_performance"
103
104 # AssertionError: assert '/build/geth.ipc' == '/tmp/geth.ipc
105 "test_get_dev_ipc_path"
106
107 # Require network access
108 "test_websocket_provider_timeout"
109 ];
110
111 disabledTestPaths = [
112 # requires geth library and binaries
113 "tests/integration/go_ethereum"
114
115 # requires local running beacon node
116 "tests/beacon"
117 ];
118
119 pythonImportsCheck = [ "web3" ];
120
121 meta = {
122 description = "Python interface for interacting with the Ethereum blockchain and ecosystem";
123 homepage = "https://web3py.readthedocs.io/";
124 changelog = "https://web3py.readthedocs.io/en/stable/release_notes.html";
125 license = lib.licenses.mit;
126 maintainers = with lib.maintainers; [ hellwolf ];
127 };
128}