1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 clang,
7 # dependencies
8 pyyaml,
9 blst,
10 # checkPhase dependencies
11 python,
12}:
13
14buildPythonPackage rec {
15 pname = "ckzg";
16 version = "2.1.4";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "ethereum";
21 repo = "c-kzg-4844";
22 tag = "v${version}";
23 hash = "sha256-692u5EFiA3sfJbd3CUdTO/9LP2y4+WjLZZaFkY9vlP4=";
24 };
25
26 build-system = [ setuptools ];
27
28 nativeBuildInputs = [ clang ];
29
30 dependencies = [
31 pyyaml
32 blst
33 ];
34
35 postPatch =
36 # unvendor "blst"
37 ''
38 substituteInPlace setup.py \
39 --replace-fail '"build_ext": CustomBuild,' ""
40 '';
41
42 checkPhase = ''
43 runHook preCheck
44
45 cd bindings/python
46 ${python.interpreter} tests.py
47
48 runHook postCheck
49 '';
50
51 pythonImportsCheck = [ "ckzg" ];
52
53 meta = {
54 description = "Minimal implementation of the Polynomial Commitments API for EIP-4844 and EIP-7594";
55 homepage = "https://github.com/ethereum/c-kzg-4844";
56 changelog = "https://github.com/ethereum/c-kzg-4844/releases/tag/${src.tag}";
57 license = lib.licenses.asl20;
58 maintainers = with lib.maintainers; [ hellwolf ];
59 };
60}