1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 # Python deps
7 blockfrost-python,
8 cachetools,
9 cbor2,
10 cose,
11 docker,
12 ecpy,
13 frozendict,
14 frozenlist,
15 mnemonic,
16 ogmios,
17 poetry-core,
18 pprintpp,
19 pynacl,
20 requests,
21 setuptools,
22 typeguard,
23 websocket-client,
24 websockets,
25}:
26
27let
28 cose_0_9_dev8 = (cose.override { inherit cbor2; }).overridePythonAttrs (old: rec {
29 version = "0.9.dev8";
30 src = (
31 old.src.override {
32 rev = "v${version}";
33 hash = "sha256-/jwq2C2nvHInsgPG4jZCr+XsvlUJdYewAkasrUPVaHM=";
34 }
35 );
36 pythonImportsCheck = [ "cose" ];
37 });
38in
39buildPythonPackage rec {
40 pname = "pycardano";
41 version = "0.14.0";
42 pyproject = true;
43
44 src = fetchFromGitHub {
45 owner = "Python-Cardano";
46 repo = "pycardano";
47 tag = "v${version}";
48 hash = "sha256-W5N254tND7mI0oR82YhMFWn4zVVs3ygYOqXOBMO3sXY=";
49 };
50
51 build-system = [
52 setuptools
53 ];
54
55 dependencies = [
56 blockfrost-python
57 cachetools
58 cbor2
59 cose_0_9_dev8
60 docker
61 ecpy
62 frozendict
63 frozenlist
64 mnemonic
65 ogmios
66 poetry-core
67 pprintpp
68 pynacl
69 requests
70 typeguard
71 websocket-client
72 websockets
73 ];
74
75 nativeCheckInputs = [
76 pytestCheckHook
77 ];
78
79 pythonRelaxDeps = [
80 "ogmios"
81 "websockets"
82 ];
83
84 pythonImportsCheck = [ "pycardano" ];
85
86 meta = {
87 description = "Lightweight Cardano library in Python";
88 homepage = "https://github.com/Python-Cardano/pycardano";
89 license = lib.licenses.mit;
90 maintainers = with lib.maintainers; [ aciceri ];
91 # https://github.com/Python-Cardano/pycardano/blob/v0.13.2/Makefile#L26-L39
92 # cbor2 with C extensions fail tests due to differences in used sized vs unsized arrays
93 # more info: https://github.com/NixOS/nixpkgs/pull/402433#issuecomment-2916520286
94 broken = cbor2.withCExtensions; # consider overriding cbor2 with cbor2WithoutCExtensions
95 };
96}