pyln: Update the makefile to use poetry for publishing

This commit is contained in:
Christian Decker 2022-04-25 14:38:41 +02:00 committed by Rusty Russell
parent 6ced5558fb
commit cc9bdb8298
9 changed files with 53 additions and 35 deletions

View File

@ -1 +1,3 @@
poetry.lock
requirements.txt

View File

@ -19,30 +19,35 @@ check: check-source check-pytest
check-source: check-flake8 check-mypy
check-flake8:
flake8 --ignore=E501,E731,W503,E741
flake8 --ignore=E501,E731,W503,E741 pyln tests
check-pytest:
pytest tests
check-mypy:
MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
# MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
$(SDIST_FILE):
python3 setup.py sdist
pyproject.toml: pyln/${PKG}/__init__.py
poetry version ${VERSION}
$(BDIST_FILE):
python3 setup.py bdist_wheel
$(SDIST_FILE) $(BDIST_FILE): pyproject.toml
poetry build
test-release: check $(ARTEFACTS)
python3 -m twine upload --repository testpypi --skip-existing $(ARTEFACTS)
test-release: check $(ARTEFACTS) pyproject.toml
# No way of saying "it's ok if files exist" yet
poetry publish --repository testpypi || /bin/true
echo Sleeping for PyPI index to update
sleep 10
# Generate a requirements.txt file, needed for us to download requirements from the prod pypi instead of the test pypi, since some packages are not published to test pypi.
poetry export -f requirements.txt --output requirements.txt --without-hashes
# 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 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}==${VERSION}
testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')"
testpypi/bin/pytest tests
rm -rf testpypi

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "pyln-client"
version = "0.10.2.post1"
version = "0.11.0"
description = "Client library and plugin library for Core Lightning"
authors = ["Christian Decker <decker.christian@gmail.com>"]
license = "BSD-MIT"
@ -12,7 +12,7 @@ packages = [
[tool.poetry.dependencies]
python = "^3.7"
pyln-bolt7 = "^1.0.186"
pyln-bolt7 = "^1.0"
pyln-proto = "^0.10.2"
[tool.poetry.dev-dependencies]

View File

@ -1 +1,2 @@
poetry.lock
requirements.txt

View File

@ -19,31 +19,35 @@ check: check-source check-pytest
check-source: check-flake8 check-mypy
check-flake8:
flake8 --ignore=E501,E731,W503,E741
flake8 --ignore=E501,E731,W503,E741 pyln tests
check-pytest:
pytest tests
check-mypy:
#mypy --namespace-packages tests pyln
echo mypy disabled for pyln-proto
# MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
$(SDIST_FILE):
python3 setup.py sdist
pyproject.toml: pyln/${PKG}/__init__.py
poetry version ${VERSION}
$(BDIST_FILE):
python3 setup.py bdist_wheel
$(SDIST_FILE) $(BDIST_FILE): pyproject.toml
poetry build
test-release: check $(ARTEFACTS)
python3 -m twine upload --repository testpypi --skip-existing $(ARTEFACTS)
test-release: check $(ARTEFACTS) pyproject.toml
# No way of saying "it's ok if files exist" yet
poetry publish --repository testpypi || /bin/true
echo Sleeping for PyPI index to update
sleep 10
# Generate a requirements.txt file, needed for us to download requirements from the prod pypi instead of the test pypi, since some packages are not published to test pypi.
poetry export -f requirements.txt --output requirements.txt --without-hashes
# 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 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}==${VERSION}
testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')"
testpypi/bin/pytest tests
rm -rf testpypi

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "pyln-proto"
version = "0.10.2.post1"
version = "0.11.0"
description = "This package implements some of the Lightning Network protocol in pure python. It is intended for protocol testing and some minor tooling only. It is not deemed secure enough to handle any amount of real funds (you have been warned!)."
authors = ["Christian Decker <decker.christian@gmail.com>"]
license = "BSD-MIT"

View File

@ -1 +1,2 @@
poetry.lock
requirements.txt

View File

@ -19,30 +19,35 @@ check: check-source check-pytest
check-source: check-flake8 check-mypy
check-flake8:
flake8 --ignore=E501,E731,W503,E741
flake8 --ignore=E501,E731,W503,E741 pyln tests
check-pytest:
pytest tests
check-mypy:
MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
# MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
$(SDIST_FILE):
python3 setup.py sdist
pyproject.toml: pyln/${PKG}/__init__.py
poetry version ${VERSION}
$(BDIST_FILE):
python3 setup.py bdist_wheel
$(SDIST_FILE) $(BDIST_FILE): pyproject.toml
poetry build
test-release: check $(ARTEFACTS)
python3 -m twine upload --repository testpypi --skip-existing $(ARTEFACTS)
test-release: check $(ARTEFACTS) pyproject.toml
# No way of saying "it's ok if files exist" yet
poetry publish --repository testpypi || /bin/true
echo Sleeping for PyPI index to update
sleep 10
# Generate a requirements.txt file, needed for us to download requirements from the prod pypi instead of the test pypi, since some packages are not published to test pypi.
poetry export -f requirements.txt --output requirements.txt --without-hashes
# 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 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}==${VERSION}
testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')"
testpypi/bin/pytest tests
rm -rf testpypi

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "pyln-testing"
version = "0.10.2"
version = "0.11.0"
description = "Test your Core Lightning integration, plugins or whatever you want"
authors = ["Christian Decker <decker.christian@gmail.com>"]
license = "BSD-MIT"