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