1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 # Python deps
6 frozenlist2,
7 python-secp256k1-cardano,
8 setuptools,
9 poetry-core,
10 frozendict,
11 cbor2WithoutCExtensions,
12 cbor2,
13 rply,
14 pycardano,
15 uplc,
16}:
17
18buildPythonPackage rec {
19 pname = "uplc";
20 version = "1.0.10";
21
22 format = "pyproject";
23
24 src = fetchFromGitHub {
25 owner = "OpShin";
26 repo = "uplc";
27 tag = version;
28 hash = "sha256-Owo4W4jChrdYnz11BbWQdm2SiwFwOJlqjYutuRyjpxs=";
29 };
30
31 propagatedBuildInputs = [
32 setuptools
33 poetry-core
34 frozendict
35 cbor2
36 frozenlist2
37 rply
38 pycardano
39 python-secp256k1-cardano
40 ];
41
42 # Support cbor2 without C extensions
43 postPatch = lib.optionalString (!cbor2.withCExtensions) ''
44 substituteInPlace uplc/ast.py --replace-fail 'from _cbor2' 'from cbor2'
45 '';
46
47 pythonImportsCheck = [ "uplc" ];
48
49 passthru.tests.withoutCExtensions = uplc.override {
50 cbor2 = cbor2WithoutCExtensions;
51 };
52
53 meta = with lib; {
54 description = "Python implementation of untyped plutus language core";
55 homepage = "https://github.com/OpShin/uplc";
56 license = licenses.mit;
57 maintainers = with maintainers; [ aciceri ];
58 mainProgram = "opshin";
59 };
60}