1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 setuptools,
6 # dependencies
7 eth-typing,
8 eth-utils,
9 # nativeCheckInputs
10 asn1tools,
11 factory-boy,
12 hypothesis,
13 pyasn1,
14 pytestCheckHook,
15 coincurve,
16 eth-hash,
17 isPyPy,
18}:
19
20buildPythonPackage rec {
21 pname = "eth-keys";
22 version = "0.6.0";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "ethereum";
27 repo = "eth-keys";
28 tag = "v${version}";
29 hash = "sha256-HyOfuzwldtqjjowW7HGdZ8RNMXNK3y2NrXUoeMlWJjs=";
30 };
31
32 build-system = [ setuptools ];
33
34 dependencies = [
35 eth-typing
36 eth-utils
37 ];
38
39 nativeCheckInputs = [
40 asn1tools
41 factory-boy
42 hypothesis
43 pyasn1
44 pytestCheckHook
45 ]
46 ++ optional-dependencies.coincurve
47 ++ lib.optional (!isPyPy) eth-hash.optional-dependencies.pysha3
48 ++ lib.optional isPyPy eth-hash.optional-dependencies.pycryptodome;
49
50 pythonImportsCheck = [ "eth_keys" ];
51
52 optional-dependencies = {
53 coincurve = [ coincurve ];
54 };
55
56 meta = {
57 description = "Common API for Ethereum key operations";
58 homepage = "https://github.com/ethereum/eth-keys";
59 changelog = "https://github.com/ethereum/eth-keys/blob/v${version}/CHANGELOG.rst";
60 license = lib.licenses.mit;
61 maintainers = with lib.maintainers; [ hellwolf ];
62 };
63}