diff --git a/contrib/pyln-client/Makefile b/contrib/pyln-client/Makefile new file mode 100644 index 000000000..d44b21c60 --- /dev/null +++ b/contrib/pyln-client/Makefile @@ -0,0 +1,54 @@ +#!/usr/bin/make + +.PHONY: bdist sdist release check check-source check-flake8 check-mypy +PKG=client +VERSION = $(shell python3 -c 'from pyln import ${PKG};print(${PKG}.__version__)') + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SOURCEDIR = docs +BUILDDIR = build + +SDIST_FILE = "dist/pyln-${PKG}-$(VERSION).tar.gz" +BDIST_FILE = "dist/pyln_${PKG}-$(VERSION)-py3-none-any.whl" +ARTEFACTS = $(BDIST_FILE) $(SDIST_FILE) + +check: check-source check-pytest + +check-source: check-flake8 check-mypy + +check-flake8: + flake8 --ignore=E501,E731,W503 + +check-pytest: + pytest tests + +check-mypy: + MYPYPATH=$(PYTHONPATH) mypy --namespace-packages tests pyln + +$(SDIST_FILE): + python3 setup.py sdist + +$(BDIST_FILE): + python3 setup.py bdist_wheel + +test-release: check $(ARTEFACTS) + python3 -m twine upload --repository testpypi --skip-existing $(ARTEFACTS) + + # Create a test virtualenv, install from the testpypi and run the + # tests against it (make sure not to use any virtualenv that may have + # pyln-${PKG} already installed). + virtualenv testpypi --python=/usr/bin/python3 --download --always-copy --clear + # Install the requirements from the prod repo, they are not being kept up to date on the test repo + testpypi/bin/python3 -m pip install -r requirements.txt flaky pytest-timeout + testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG} + testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')" + testpypi/bin/pytest tests + rm -rf testpypi + +prod-release: test-release $(ARTEFACTS) + python3 -m twine upload $(ARTEFACTS) + +clean: + rm -rf testpypi diff --git a/contrib/pyln-proto/Makefile b/contrib/pyln-proto/Makefile index edc6a565c..d2d4f6aa4 100644 --- a/contrib/pyln-proto/Makefile +++ b/contrib/pyln-proto/Makefile @@ -1,23 +1,31 @@ -#! /usr/bin/make +#!/usr/bin/make .PHONY: bdist sdist release check check-source check-flake8 check-mypy -VERSION = $(shell python3 -c 'from pyln import proto;print(proto.__version__)') +PKG=proto +VERSION = $(shell python3 -c 'from pyln import ${PKG};print(${PKG}.__version__)') -SDIST_FILE = "dist/pyln-proto-$(VERSION).tar.gz" -BDIST_FILE = "dist/pyln_proto-$(VERSION)-py3-none-any.whl" +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SOURCEDIR = docs +BUILDDIR = build + +SDIST_FILE = "dist/pyln-${PKG}-$(VERSION).tar.gz" +BDIST_FILE = "dist/pyln_${PKG}-$(VERSION)-py3-none-any.whl" ARTEFACTS = $(BDIST_FILE) $(SDIST_FILE) -check: - pytest +check: check-source check-pytest check-source: check-flake8 check-mypy check-flake8: flake8 --ignore=E501,E731,W503 -# mypy . does not recurse. I have no idea why... +check-pytest: + pytest tests + check-mypy: - mypy --ignore-missing-imports `find pyln/proto/message/ -name '*.py'` + mypy --namespace-packages tests pyln $(SDIST_FILE): python3 setup.py sdist @@ -30,12 +38,12 @@ test-release: check $(ARTEFACTS) # Create a test virtualenv, install from the testpypi and run the # tests against it (make sure not to use any virtualenv that may have - # pyln-proto already installed). + # pyln-${PKG} already installed). virtualenv testpypi --python=/usr/bin/python3 --download --always-copy --clear # Install the requirements from the prod repo, they are not being kept up to date on the test repo - testpypi/bin/python3 -m pip install -r requirements.txt pytest flaky pytest-timeout - testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-proto - testpypi/bin/python3 -c "from pyln import proto;assert(proto.__version__ == '$(VERSION)')" + testpypi/bin/python3 -m pip install -r requirements.txt flaky pytest-timeout + testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG} + testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')" testpypi/bin/pytest tests rm -rf testpypi diff --git a/contrib/pyln-testing/Makefile b/contrib/pyln-testing/Makefile index 79eba98b6..f0062b531 100644 --- a/contrib/pyln-testing/Makefile +++ b/contrib/pyln-testing/Makefile @@ -1,23 +1,31 @@ -#! /usr/bin/make +#!/usr/bin/make .PHONY: bdist sdist release check check-source check-flake8 check-mypy -VERSION = $(shell python3 -c 'from pyln import testing;print(testing.__version__)') +PKG=testing +VERSION = $(shell python3 -c 'from pyln import ${PKG};print(${PKG}.__version__)') -SDIST_FILE = "dist/pyln-testing-$(VERSION).tar.gz" -BDIST_FILE = "dist/pyln_testing-$(VERSION)-py3-none-any.whl" +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SOURCEDIR = docs +BUILDDIR = build + +SDIST_FILE = "dist/pyln-${PKG}-$(VERSION).tar.gz" +BDIST_FILE = "dist/pyln_${PKG}-$(VERSION)-py3-none-any.whl" ARTEFACTS = $(BDIST_FILE) $(SDIST_FILE) -check: -# pytest +check: check-source check-pytest check-source: check-flake8 check-mypy check-flake8: flake8 --ignore=E501,E731,W503 -# mypy . does not recurse. I have no idea why... +check-pytest: + pytest tests + check-mypy: - mypy --ignore-missing-imports `find pyln/testing -name '*.py'` + mypy --namespace-packages tests pyln $(SDIST_FILE): python3 setup.py sdist @@ -30,12 +38,12 @@ test-release: check $(ARTEFACTS) # Create a test virtualenv, install from the testpypi and run the # tests against it (make sure not to use any virtualenv that may have - # pyln-testing already installed). + # pyln-${PKG} already installed). virtualenv testpypi --python=/usr/bin/python3 --download --always-copy --clear # Install the requirements from the prod repo, they are not being kept up to date on the test repo testpypi/bin/python3 -m pip install -r requirements.txt flaky pytest-timeout - testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-testing - testpypi/bin/python3 -c "from pyln import testing;assert(testing.__version__ == '$(VERSION)')" + testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG} + testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')" testpypi/bin/pytest tests rm -rf testpypi