From 81f7978cc8a94ab96a03e856ddc2f829ac88dcc3 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sat, 26 Oct 2019 16:42:58 +0200 Subject: [PATCH] pyln: Migrate implementation from pylightning to pyln-client This should not affect any consumer of the API since we just shift the actual implementation from one side to the other, and keep aliases in place so scripts don't break. We also bump the version number from 0.0.7.3 to 0.7.4 which allows us to be in sync with c-lightning itself, and remove the superfluous `0` in front. --- Makefile | 4 ++-- contrib/pylightning/lightning/__init__.py | 3 +-- contrib/pylightning/requirements.txt | 1 + contrib/pyln-client/pyln/client/__init__.py | 4 +++- .../lightning => pyln-client/pyln/client}/lightning.py | 2 +- .../lightning => pyln-client/pyln/client}/plugin.py | 2 +- contrib/pyln-client/requirements.txt | 1 - .../{pylightning => pyln-client}/tests/test_millisatoshi.py | 2 +- contrib/{pylightning => pyln-client}/tests/test_plugin.py | 4 ++-- contrib/{pylightning => pyln-client}/tests/test_units.py | 2 +- 10 files changed, 13 insertions(+), 12 deletions(-) rename contrib/{pylightning/lightning => pyln-client/pyln/client}/lightning.py (99%) rename contrib/{pylightning/lightning => pyln-client/pyln/client}/plugin.py (99%) rename contrib/{pylightning => pyln-client}/tests/test_millisatoshi.py (76%) rename contrib/{pylightning => pyln-client}/tests/test_plugin.py (99%) rename contrib/{pylightning => pyln-client}/tests/test_units.py (97%) diff --git a/Makefile b/Makefile index 7c19a5d6d..9bbea7196 100644 --- a/Makefile +++ b/Makefile @@ -263,7 +263,7 @@ ifeq ($(PYTEST),) exit 1 else # Explicitly hand DEVELOPER and VALGRIND so you can override on make cmd line. - PYTHONPATH=`pwd`/contrib/pylightning:$$PYTHONPATH TEST_DEBUG=1 DEVELOPER=$(DEVELOPER) VALGRIND=$(VALGRIND) $(PYTEST) tests/ $(PYTEST_OPTS) + PYTHONPATH=`pwd`/contrib/pyln-client:$$PYTHONPATH TEST_DEBUG=1 DEVELOPER=$(DEVELOPER) VALGRIND=$(VALGRIND) $(PYTEST) tests/ $(PYTEST_OPTS) endif # Keep includes in alpha order. @@ -316,7 +316,7 @@ check-python: @# W503: line break before binary operator @flake8 --ignore=E501,E731,W503 --exclude=contrib/pylightning/lightning/__init__.py ${PYSRC} - PYTHONPATH=contrib/pylightning:$$PYTHONPATH $(PYTEST) contrib/pylightning/ + PYTHONPATH=contrib/pyln-client:$$PYTHONPATH $(PYTEST) contrib/pyln-client/ check-includes: @tools/check-includes.sh diff --git a/contrib/pylightning/lightning/__init__.py b/contrib/pylightning/lightning/__init__.py index e70aa2007..2836c5e16 100644 --- a/contrib/pylightning/lightning/__init__.py +++ b/contrib/pylightning/lightning/__init__.py @@ -1,2 +1 @@ -from .lightning import LightningRpc, RpcError, Millisatoshi, __version__ -from .plugin import Plugin, monkey_patch +from pyln.client import LightningRpc, RpcError, Millisatoshi, __version__, Plugin, monkey_patch diff --git a/contrib/pylightning/requirements.txt b/contrib/pylightning/requirements.txt index e69de29bb..fe552d366 100644 --- a/contrib/pylightning/requirements.txt +++ b/contrib/pylightning/requirements.txt @@ -0,0 +1 @@ +pyln-client==0.7.3 diff --git a/contrib/pyln-client/pyln/client/__init__.py b/contrib/pyln-client/pyln/client/__init__.py index 0c8a5c505..2b6adc41b 100644 --- a/contrib/pyln-client/pyln/client/__init__.py +++ b/contrib/pyln-client/pyln/client/__init__.py @@ -1,4 +1,6 @@ -from lightning import LightningRpc, Plugin, RpcError, Millisatoshi, __version__, monkey_patch +from .lightning import LightningRpc, RpcError, Millisatoshi, __version__ +from .plugin import Plugin, monkey_patch + __all__ = [ "LightningRpc", diff --git a/contrib/pylightning/lightning/lightning.py b/contrib/pyln-client/pyln/client/lightning.py similarity index 99% rename from contrib/pylightning/lightning/lightning.py rename to contrib/pyln-client/pyln/client/lightning.py index 9e7e45465..4912e18b6 100644 --- a/contrib/pylightning/lightning/lightning.py +++ b/contrib/pyln-client/pyln/client/lightning.py @@ -5,7 +5,7 @@ import warnings from decimal import Decimal from math import floor, log10 -__version__ = "0.0.7.4" +__version__ = "0.7.3" class RpcError(ValueError): diff --git a/contrib/pylightning/lightning/plugin.py b/contrib/pyln-client/pyln/client/plugin.py similarity index 99% rename from contrib/pylightning/lightning/plugin.py rename to contrib/pyln-client/pyln/client/plugin.py index 1f2ff0e12..3ca1da458 100644 --- a/contrib/pylightning/lightning/plugin.py +++ b/contrib/pyln-client/pyln/client/plugin.py @@ -1,6 +1,6 @@ from collections import OrderedDict from enum import Enum -from lightning import LightningRpc, Millisatoshi +from .lightning import LightningRpc, Millisatoshi from threading import RLock import inspect diff --git a/contrib/pyln-client/requirements.txt b/contrib/pyln-client/requirements.txt index 010c05fc7..e69de29bb 100644 --- a/contrib/pyln-client/requirements.txt +++ b/contrib/pyln-client/requirements.txt @@ -1 +0,0 @@ -pylightning==0.0.7.3 diff --git a/contrib/pylightning/tests/test_millisatoshi.py b/contrib/pyln-client/tests/test_millisatoshi.py similarity index 76% rename from contrib/pylightning/tests/test_millisatoshi.py rename to contrib/pyln-client/tests/test_millisatoshi.py index 726213cad..f8f877ff0 100644 --- a/contrib/pylightning/tests/test_millisatoshi.py +++ b/contrib/pyln-client/tests/test_millisatoshi.py @@ -1,4 +1,4 @@ -from lightning import Millisatoshi +from pyln.client import Millisatoshi def test_sum_radd(): diff --git a/contrib/pylightning/tests/test_plugin.py b/contrib/pyln-client/tests/test_plugin.py similarity index 99% rename from contrib/pylightning/tests/test_plugin.py rename to contrib/pyln-client/tests/test_plugin.py index ff7d02a25..e1f6245d6 100644 --- a/contrib/pylightning/tests/test_plugin.py +++ b/contrib/pyln-client/tests/test_plugin.py @@ -1,5 +1,5 @@ -from lightning import Plugin -from lightning.plugin import Request, Millisatoshi +from pyln.client import Plugin +from pyln.client.plugin import Request, Millisatoshi import itertools import pytest diff --git a/contrib/pylightning/tests/test_units.py b/contrib/pyln-client/tests/test_units.py similarity index 97% rename from contrib/pylightning/tests/test_units.py rename to contrib/pyln-client/tests/test_units.py index e28d49af2..0af11e168 100644 --- a/contrib/pylightning/tests/test_units.py +++ b/contrib/pyln-client/tests/test_units.py @@ -1,4 +1,4 @@ -from lightning import Millisatoshi +from pyln.client import Millisatoshi def test_to_approx_str():