1{
2 lib,
3 fetchPypi,
4 buildPythonPackage,
5 pythonOlder,
6 rustPlatform,
7 nix-update-script,
8
9 # build-system
10 maturin,
11
12 # nativeCheckInputs
13 pytestCheckHook,
14 pytest-benchmark,
15 pytest-codspeed,
16 pytest-xdist,
17}:
18
19buildPythonPackage rec {
20 pname = "libipld";
21 version = "3.1.1";
22 format = "pyproject";
23 disabled = pythonOlder "3.8";
24
25 # use pypi, GitHub does not include Cargo.lock
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-S5qdoOpdhI6foSxwACdhmh437MHaOdvRQkwOkGLynkQ=";
29 };
30
31 cargoDeps = rustPlatform.fetchCargoVendor {
32 inherit src;
33 hash = "sha256-LMd1M2gCK0i3TJPnUIY/2pskt9Rm/yki4uDX5uQGi8Q=";
34 };
35
36 build-system = [
37 maturin
38 ];
39
40 nativeBuildInputs = with rustPlatform; [
41 cargoSetupHook
42 maturinBuildHook
43 ];
44
45 nativeCheckInputs = [
46 pytestCheckHook
47 pytest-benchmark
48 pytest-codspeed
49 pytest-xdist
50 ];
51
52 pytestFlags = [ "--benchmark-disable" ];
53
54 disabledTests = [
55 # touches network
56 "test_decode_car"
57 ];
58
59 pythonImportsCheck = [ "libipld" ];
60
61 passthru.updateScript = nix-update-script { };
62
63 meta = {
64 description = "Fast Python library to work with IPLD: DAG-CBOR, CID, CAR, multibase";
65 homepage = "https://github.com/MarshalX/python-libipld";
66 changelog = "https://github.com/MarshalX/python-libipld/blob/v${version}/CHANGES.md";
67 license = lib.licenses.mit;
68 maintainers = with lib.maintainers; [ vji ];
69 };
70}