about summary refs log tree commit diff
path: root/pkgs/development/python-modules/eth-keys/default.nix
blob: edf83f0657019f5a988d4ac41b5e0806ffef763a (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
72
73
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, asn1tools
, coincurve
, eth-hash
, eth-typing
, eth-utils
, factory-boy
, hypothesis
, isPyPy
, pyasn1
, pytestCheckHook
, pythonOlder
}:

buildPythonPackage rec {
  pname = "eth-keys";
  version = "0.5.0";
  pyproject = true;
  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "ethereum";
    repo = "eth-keys";
    rev = "v${version}";
    hash = "sha256-vyyaLCG2uIHXX0t93DmFq8/u0rZL+nsBsH2gfgjziyo=";
  };

  build-system = [ setuptools];

  propagatedBuildInputs = [
    eth-typing
    eth-utils
  ];

  nativeCheckInputs = [
    asn1tools
    factory-boy
    hypothesis
    pyasn1
    pytestCheckHook
  ] ++ passthru.optional-dependencies.coincurve
  ++ lib.optional (!isPyPy) eth-hash.optional-dependencies.pysha3
  ++ lib.optional isPyPy eth-hash.optional-dependencies.pycryptodome;

  disabledTests = [
    # tests are broken
    "test_compress_decompress_inversion"
    "test_public_key_generation_is_equal"
    "test_signing_is_equal"
    "test_native_to_coincurve_recover"
    "test_public_key_compression_is_equal"
    "test_public_key_decompression_is_equal"
    "test_signatures_with_high_s"
    # timing sensitive
    "test_encode_decode_pairings"
  ];

  pythonImportsCheck = [ "eth_keys" ];

  passthru.optional-dependencies = {
    coincurve = [ coincurve ];
  };

  meta = with lib; {
    description = "Common API for Ethereum key operations";
    homepage = "https://github.com/ethereum/eth-keys";
    license = licenses.mit;
    maintainers = with maintainers; [ ];
  };
}