1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 aiohttp,
7 eth-abi,
8 eth-account,
9 eth-hash,
10 eth-typing,
11 eth-utils,
12 hexbytes,
13 ipfshttpclient,
14 jsonschema,
15 lru-dict,
16 protobuf,
17 requests,
18 websockets,
19}:
20
21buildPythonPackage rec {
22 pname = "web3";
23 version = "6.5.0";
24 format = "setuptools";
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchFromGitHub {
29 owner = "ethereum";
30 repo = "web3.py";
31 rev = "v${version}";
32 hash = "sha256-RNWCZQjcse415SSNkHhMWckDcBJGFZnjisckF7gbYY8=";
33 };
34
35 # Note: to reflect the extra_requires in main/setup.py.
36 passthru.optional-dependencies = {
37 ipfs = [ ipfshttpclient ];
38 };
39
40 propagatedBuildInputs =
41 [
42 aiohttp
43 eth-abi
44 eth-account
45 eth-hash
46 ]
47 ++ eth-hash.optional-dependencies.pycryptodome
48 ++ [
49 eth-typing
50 eth-utils
51 hexbytes
52 jsonschema
53 lru-dict
54 protobuf
55 requests
56 websockets
57 ];
58
59 # TODO: package eth-tester required for tests
60 doCheck = false;
61
62 postPatch = ''
63 substituteInPlace setup.py --replace "types-protobuf==3.19.13" "types-protobuf"
64 '';
65
66 pythonImportsCheck = [ "web3" ];
67
68 meta = with lib; {
69 description = "Python interface for interacting with the Ethereum blockchain and ecosystem";
70 homepage = "https://web3py.readthedocs.io/";
71 license = licenses.mit;
72 maintainers = with maintainers; [ hellwolf ];
73 };
74}