about summary refs log tree commit diff
path: root/pkgs/development/python-modules/web3/default.nix
blob: ae709ef4088651c6418315e5443ed92766864788 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, aiohttp
, eth-abi
, eth-account
, eth-hash
, eth-typing
, eth-utils
, hexbytes
, ipfshttpclient
, jsonschema
, lru-dict
, protobuf
, requests
, websockets
}:

buildPythonPackage rec {
  pname = "web3";
  version = "6.5.0";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "ethereum";
    repo = "web3.py";
    rev = "v${version}";
    hash = "sha256-RNWCZQjcse415SSNkHhMWckDcBJGFZnjisckF7gbYY8=";
  };

  # Note: to reflect the extra_requires in main/setup.py.
  passthru.optional-dependencies = {
    ipfs = [ ipfshttpclient ];
  };

  propagatedBuildInputs = [
    aiohttp
    eth-abi
    eth-account
    eth-hash ] ++ eth-hash.optional-dependencies.pycryptodome ++ [
    eth-typing
    eth-utils
    hexbytes
    jsonschema
    lru-dict
    protobuf
    requests
    websockets
  ];

  # TODO: package eth-tester required for tests
  doCheck = false;

  postPatch = ''
    substituteInPlace setup.py --replace "types-protobuf==3.19.13" "types-protobuf"
  '';

  pythonImportsCheck = [
    "web3"
  ];

  meta = with lib; {
    description = "A python interface for interacting with the Ethereum blockchain and ecosystem";
    homepage = "https://web3py.readthedocs.io/";
    license = licenses.mit;
    maintainers = with maintainers; [ hellwolf ];
  };
}