From f234e59ca5e62a24d8eef0c7490d6f6de3e43c18 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Thu, 5 May 2022 20:43:10 +0200 Subject: [PATCH] nbPython3Packages: fix clightning pkgs Also enable tests for the pyln-* pkgs. --- pkgs/clightning-plugins/default.nix | 5 ++- pkgs/python-packages/coincurve/default.nix | 4 +-- pkgs/python-packages/default.nix | 10 ++++-- pkgs/python-packages/pyln-bolt7/default.nix | 19 ++++------- pkgs/python-packages/pyln-client/default.nix | 19 +++++++++-- pkgs/python-packages/pyln-proto/default.nix | 24 +++++-------- .../specific-versions/base58.nix | 34 ------------------- 7 files changed, 44 insertions(+), 71 deletions(-) delete mode 100644 pkgs/python-packages/specific-versions/base58.nix diff --git a/pkgs/clightning-plugins/default.nix b/pkgs/clightning-plugins/default.nix index eb1d5ac..bf8443b 100644 --- a/pkgs/clightning-plugins/default.nix +++ b/pkgs/clightning-plugins/default.nix @@ -14,7 +14,10 @@ let plugins = with nbPython3Packages; { helpme = { description = "Walks you through setting up a c-lightning node, offering advice for common problems"; }; - monitor = { description = "Helps you analyze the health of your peers and channels"; }; + monitor = { + description = "Helps you analyze the health of your peers and channels"; + extraPkgs = [ packaging ]; + }; prometheus = { description = "Lightning node exporter for the prometheus timeseries server"; extraPkgs = [ prometheus_client ]; diff --git a/pkgs/python-packages/coincurve/default.nix b/pkgs/python-packages/coincurve/default.nix index 042ac67..2e5156d 100644 --- a/pkgs/python-packages/coincurve/default.nix +++ b/pkgs/python-packages/coincurve/default.nix @@ -3,11 +3,11 @@ autoconf, automake, libtool, libffi, requests }: buildPythonPackage rec { pname = "coincurve"; - version = "15.0.0"; + version = "17.0.0"; src = fetchPypi { inherit pname version; - sha256 = "0ras7qb4ib9sik703fcb9f3jrgq7nx5wvdgx9k1pshmrxl8lnlh6"; + hash = "sha256-aNpVr/iYcClS/aPuBP1u1gu2uR+RnGknB4btdmtUi5M"; }; doCheck = false; diff --git a/pkgs/python-packages/default.nix b/pkgs/python-packages/default.nix index c0a7568..39fdcc0 100644 --- a/pkgs/python-packages/default.nix +++ b/pkgs/python-packages/default.nix @@ -4,6 +4,8 @@ let joinmarketPkg = pkg: callPackage pkg { inherit (nbPkgs.joinmarket) version src; }; clightningPkg = pkg: callPackage pkg { inherit (nbPkgs.pinned) clightning; }; + + unstable = (import ../nixpkgs-pinned.nix).nixpkgs-unstable; in { bencoderpyx = callPackage ./bencoderpyx {}; coincurve = callPackage ./coincurve {}; @@ -26,15 +28,17 @@ in { ## Specific versions of packages that already exist in nixpkgs - # base58 2.1.0, required by pyln-proto - base58 = callPackage ./specific-versions/base58.nix {}; - # cryptography 3.3.2, required by joinmarketdaemon # Used in the private python package set for joinmarket (../joinmarket/default.nix) cryptography_3_3_2 = callPackage ./specific-versions/cryptography { cryptography_vectors = callPackage ./specific-versions/cryptography/vectors.nix {}; }; + # cryptography 36.0.0, required by pyln-proto. + cryptography = callPackage "${unstable}/pkgs/development/python-modules/cryptography" { + Security = self.darwin.apple_sdk.frameworks.Security; + }; + # autobahn 20.12.3, required by joinmarketclient autobahn = callPackage ./specific-versions/autobahn.nix {}; diff --git a/pkgs/python-packages/pyln-bolt7/default.nix b/pkgs/python-packages/pyln-bolt7/default.nix index 84cb855..16bf920 100644 --- a/pkgs/python-packages/pyln-bolt7/default.nix +++ b/pkgs/python-packages/pyln-bolt7/default.nix @@ -1,22 +1,17 @@ -{ buildPythonPackage, clightning, pyln-proto }: +{ buildPythonPackage, poetry-core, pytestCheckHook, clightning, pyln-proto }: buildPythonPackage rec { pname = "pyln-bolt7"; - - # See fn `bolt_meta` in - # https://github.com/ElementsProject/lightning/blob/master/contrib/pyln-spec/bolt7/setup.py - version = "1.0.2.186"; + # The version is defined here: + # https://github.com/ElementsProject/lightning/blob/master/contrib/pyln-spec/bolt7/pyproject.toml + version = "1.0.2.186.post0"; + format = "pyproject"; inherit (clightning) src; + nativeBuildInputs = [ poetry-core ]; propagatedBuildInputs = [ pyln-proto ]; + checkInputs = [ pytestCheckHook ]; postUnpack = "sourceRoot=$sourceRoot/contrib/pyln-spec/bolt7"; - - # TODO-EXTERNAL: - # Remove when this fix is released - # https://github.com/ElementsProject/lightning/pull/4910 - postPatch = '' - sed -i 's|pyln.proto|pyln-proto|' requirements.txt - ''; } diff --git a/pkgs/python-packages/pyln-client/default.nix b/pkgs/python-packages/pyln-client/default.nix index 9ca49f8..b997ce4 100644 --- a/pkgs/python-packages/pyln-client/default.nix +++ b/pkgs/python-packages/pyln-client/default.nix @@ -1,14 +1,27 @@ -{ buildPythonPackage, clightning, pyln-bolt7, recommonmark, setuptools-scm }: +{ buildPythonPackage, poetry-core, pytestCheckHook, clightning, pyln-bolt7, pyln-proto }: buildPythonPackage rec { pname = "pyln-client"; version = clightning.version; + format = "pyproject"; inherit (clightning) src; - propagatedBuildInputs = [ pyln-bolt7 recommonmark setuptools-scm ]; + nativeBuildInputs = [ poetry-core ]; - SETUPTOOLS_SCM_PRETEND_VERSION = version; + propagatedBuildInputs = [ + pyln-bolt7 + pyln-proto + ]; + + checkInputs = [ pytestCheckHook ]; postUnpack = "sourceRoot=$sourceRoot/contrib/${pname}"; + + # Fix version typo in pyproject.toml + # TODO-EXTERNAL: + # This is already fixed upstream. Remove this after the next clightning release. + postPatch = '' + sed -i 's|pyln-bolt7 = "^1.0.186"|pyln-bolt7 = "^1.0.2.186"|' pyproject.toml + ''; } diff --git a/pkgs/python-packages/pyln-proto/default.nix b/pkgs/python-packages/pyln-proto/default.nix index 80303a2..29ee61a 100644 --- a/pkgs/python-packages/pyln-proto/default.nix +++ b/pkgs/python-packages/pyln-proto/default.nix @@ -1,38 +1,30 @@ -{ buildPythonPackage, clightning +{ buildPythonPackage +, clightning +, poetry-core +, pytestCheckHook , bitstring , cryptography , coincurve , base58 -, mypy -, pycparser -, setuptools-scm }: buildPythonPackage rec { pname = "pyln-proto"; version = clightning.version; + format = "pyproject"; inherit (clightning) src; + nativeBuildInputs = [ poetry-core ]; + propagatedBuildInputs = [ bitstring cryptography coincurve - pycparser base58 - mypy - setuptools-scm ]; - SETUPTOOLS_SCM_PRETEND_VERSION = version; + checkInputs = [ pytestCheckHook ]; postUnpack = "sourceRoot=$sourceRoot/contrib/pyln-proto"; - postPatch = '' - sed -i ' - s|pycparser==2.20|pycparser~=2.20| - s|coincurve ~= 13.0|coincurve == 15.0.0| - s|base58 ~= 2.0.1|base58 == 2.1.0| - s|mypy==0.790|mypy == 0.812| - ' requirements.txt - ''; } diff --git a/pkgs/python-packages/specific-versions/base58.nix b/pkgs/python-packages/specific-versions/base58.nix deleted file mode 100644 index 1437683..0000000 --- a/pkgs/python-packages/specific-versions/base58.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, pyhamcrest -, pytest-benchmark -, pytestCheckHook -, pythonOlder -}: - -buildPythonPackage rec { - pname = "base58"; - version = "2.1.0"; - disabled = pythonOlder "3.5"; - - src = fetchPypi { - inherit pname version; - sha256 = "sha256-FxpUe0o8YeGuOAciSm967HXjZMQ5XnViZJ1zNXaAAaI="; - }; - - checkInputs = [ - pyhamcrest - pytest-benchmark - pytestCheckHook - ]; - - pythonImportsCheck = [ "base58" ]; - - meta = with lib; { - description = "Base58 and Base58Check implementation"; - homepage = "https://github.com/keis/base58"; - license = licenses.mit; - maintainers = with maintainers; [ nyanloutre ]; - }; -}