Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opshin: init at 0.20.0 #291245

Merged
merged 7 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions pkgs/by-name/op/opshin/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{ lib
, fetchFromGitHub
, python3
}:

python3.pkgs.buildPythonApplication rec {
pname = "opshin";
version = "0.20.0";

format = "pyproject";

src = fetchFromGitHub {
owner = "OpShin";
repo = "opshin";
rev = version;
hash = "sha256-fJlPeVAuEf80FVxdXnaKASLmjMEgz6ysXenUY72+sos=";
};

propagatedBuildInputs = with python3.pkgs; [
setuptools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking nit: I generally prefer lists like this to be alphabetically ordered to make updating/reasoning about them a bit easier later on 😄

poetry-core
uplc
pluthon
pycardano
frozenlist2
astunparse
ordered-set
];

meta = with lib; {
description = "A simple pythonic programming language for Smart Contracts on Cardano";
homepage = "https://opshin.dev";
license = licenses.mit;
maintainers = with maintainers; [ t4ccer ];
mainProgram = "opshin";
};
}
32 changes: 32 additions & 0 deletions pkgs/development/python-modules/frozenlist2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{ lib
, fetchFromGitHub
, buildPythonPackage
, setuptools
}:

buildPythonPackage rec {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I know but #271387 is not merged yet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks

pname = "frozenlist2";
version = "1.0.0";

format = "pyproject";

src = fetchFromGitHub {
owner = "rohanpm";
repo = "frozenlist2";
rev = "v${version}";
hash = "sha256-fF0oFZ2q1wRH7IKBlCjm3Za4xtEMSHyEaGL09rHgtTY=";
};

propagatedBuildInputs = [
setuptools
];

pythonImportsCheck = [ "frozenlist2" ];

meta = with lib; {
description = "An immutable list for Python";
homepage = "https://github.com/rohanpm/frozenlist2";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ t4ccer ];
};
}
40 changes: 40 additions & 0 deletions pkgs/development/python-modules/graphlib-backport/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ lib
, fetchFromGitHub
, buildPythonPackage
, setuptools
, poetry-core
}:

buildPythonPackage rec {
pname = "graphlib-backport";
version = "1.1.0";

format = "pyproject";

src = fetchFromGitHub {
owner = "mariushelf";
repo = "graphlib_backport";
rev = version;
hash = "sha256-ssJLtBQH8sSnccgcAKLKfYpPyw5U0RIm1F66/Er81lo=";
};

postPatch = ''
substituteInPlace pyproject.toml \
--replace 'poetry>=1.0' 'poetry-core' \
--replace 'poetry.masonry.api' 'poetry.core.masonry.api'
'';

propagatedBuildInputs = [
setuptools
poetry-core
];

pythonImportsCheck = [ "graphlib" ];

meta = with lib; {
description = "Backport of the Python 3.9 graphlib module for Python 3.6+";
homepage = "https://github.com/mariushelf/graphlib_backport";
license = licenses.psfl;
maintainers = with maintainers; [ t4ccer ];
};
}
39 changes: 39 additions & 0 deletions pkgs/development/python-modules/pluthon/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ lib
, fetchFromGitHub
, buildPythonPackage
, setuptools
, pythonOlder
# Python deps
, uplc
, graphlib-backport
, ordered-set
}:

buildPythonPackage rec {
pname = "pluthon";
version = "0.4.6";

format = "pyproject";

src = fetchFromGitHub {
owner = "OpShin";
repo = "pluthon";
rev = version;
hash = "sha256-ZmBkbglSbBfVhA4yP0tJdwpJiFpJ7vX0A321ldQF0lA=";
};

propagatedBuildInputs = [
setuptools
uplc
ordered-set
] ++ lib.optionals (pythonOlder "3.9") graphlib-backport;

pythonImportsCheck = [ "pluthon" ];

meta = with lib; {
description = "Pluto-like programming language for Cardano Smart Contracts in Python";
homepage = "https://github.com/OpShin/pluthon";
license = licenses.mit;
maintainers = with maintainers; [ t4ccer ];
};
}
7 changes: 7 additions & 0 deletions pkgs/development/python-modules/pycardano/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonRelaxDepsHook
# Python deps
, blockfrost-python
, cachetools
Expand Down Expand Up @@ -41,6 +42,10 @@ in buildPythonPackage rec {
hash = "sha256-LP/W8IC2del476fGFq10VMWwMrbAoCCcZOngA8unBM0=";
};

nativeBuildInputs = [
pythonRelaxDepsHook
];

propagatedBuildInputs = [
blockfrost-python
cachetools
Expand All @@ -58,6 +63,8 @@ in buildPythonPackage rec {
websocket-client
];

pythonRelaxDeps = [ "typeguard" ];

pythonImportsCheck = [ "pycardano" ];

meta = with lib; {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{ lib
, fetchFromGitHub
, python3
, pkg-config
}:

python3.pkgs.buildPythonPackage {
pname = "python-secp256k1-cardano";
version = "0.2.3";

format = "setuptools";

src = fetchFromGitHub {
owner = "OpShin";
repo = "python-secp256k1";
rev = "5a8f761a4b9a1594653cc4deebadc3398b07533c"; # No tags in repo
hash = "sha256-6bE4/G2gW2F8h5FWtI3TZ6FtijsB/slvFT/SIVv7VIY=";
};

nativeBuildInputs = [ pkg-config ];

propagatedBuildInputs = with python3.pkgs; [ cffi secp256k1 ];

nativeCheckInputs = [ python3.pkgs.pytestCheckHook ];

# Tests expect .so files and are failing
doCheck = false;

preConfigure = ''
cp -r ${python3.pkgs.secp256k1.src} libsecp256k1
export INCLUDE_DIR=${python3.pkgs.secp256k1}/include
export LIB_DIR=${python3.pkgs.secp256k1}/lib
'';

meta = {
homepage = "https://github.com/OpShin/python-secp256k1";
description = "A fork of python-secp256k1, fixing the commit hash of libsecp256k1 to a Cardano compatible version";
license = with lib.licenses; [ mit ];
maintainers = with lib.maintainers; [ t4ccer ];
};
}
55 changes: 55 additions & 0 deletions pkgs/development/python-modules/uplc/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{ lib
, fetchFromGitHub
, buildPythonPackage
, pythonRelaxDepsHook
# Python deps
, frozenlist2
, python-secp256k1-cardano
, setuptools
, poetry-core
, frozendict
, cbor2
, rply
, pycardano
}:

buildPythonPackage rec {
jnsgruk marked this conversation as resolved.
Show resolved Hide resolved
pname = "uplc";
version = "0.6.9";

format = "pyproject";

src = fetchFromGitHub {
owner = "OpShin";
repo = "uplc";
rev = version;
hash = "sha256-djJMNXijMVzMVzw8NZSe3YFRGyAPqdvr0P374Za5XkU=";
};

nativeBuildInputs = [
pythonRelaxDepsHook
];

propagatedBuildInputs = [
setuptools
poetry-core
frozendict
cbor2
frozenlist2
rply
pycardano
python-secp256k1-cardano
];

pythonRelaxDeps = [ "pycardano" "rply" ];

pythonImportsCheck = [ "uplc" ];

meta = with lib; {
description = "Python implementation of untyped plutus language core";
homepage = "https://opshin.dev";
license = licenses.mit;
maintainers = with maintainers; [ t4ccer ];
mainProgram = "opshin";
};
}
10 changes: 10 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4402,6 +4402,8 @@ self: super: with self; {

frozenlist = callPackage ../development/python-modules/frozenlist { };

frozenlist2 = callPackage ../development/python-modules/frozenlist2 { };

fs = callPackage ../development/python-modules/fs { };

fs-s3fs = callPackage ../development/python-modules/fs-s3fs { };
Expand Down Expand Up @@ -4947,6 +4949,8 @@ self: super: with self; {

graphene-django = callPackage ../development/python-modules/graphene-django { };

graphlib-backport = callPackage ../development/python-modules/graphlib-backport { };

graphqlclient= callPackage ../development/python-modules/graphqlclient { };

graphql-core = callPackage ../development/python-modules/graphql-core { };
Expand Down Expand Up @@ -8636,6 +8640,8 @@ self: super: with self; {

python-nvd3 = callPackage ../development/python-modules/python-nvd3 { };

python-secp256k1-cardano = callPackage ../development/python-modules/python-secp256k1-cardano { };

python-tds = callPackage ../development/python-modules/python-tds { };

python-yate = callPackage ../development/python-modules/python-yate { };
Expand Down Expand Up @@ -9810,6 +9816,8 @@ self: super: with self; {

plumbum = callPackage ../development/python-modules/plumbum { };

pluthon = callPackage ../development/python-modules/pluthon { };

plux = callPackage ../development/python-modules/plux { };

ply = callPackage ../development/python-modules/ply { };
Expand Down Expand Up @@ -15952,6 +15960,8 @@ self: super: with self; {

update-dotdee = callPackage ../development/python-modules/update-dotdee { };

uplc = callPackage ../development/python-modules/uplc { };

upnpy = callPackage ../development/python-modules/upnpy { };

uproot = callPackage ../development/python-modules/uproot { };
Expand Down