Skip to content

Commit cc9bdb8

Browse files
cdeckerrustyrussell
authored andcommitted
pyln: Update the makefile to use poetry for publishing
1 parent 6ced555 commit cc9bdb8

File tree

9 files changed

+53
-35
lines changed

9 files changed

+53
-35
lines changed

contrib/pyln-client/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
poetry.lock
2+
requirements.txt
3+

contrib/pyln-client/Makefile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,35 @@ check: check-source check-pytest
1919
check-source: check-flake8 check-mypy
2020

2121
check-flake8:
22-
flake8 --ignore=E501,E731,W503,E741
22+
flake8 --ignore=E501,E731,W503,E741 pyln tests
2323

2424
check-pytest:
2525
pytest tests
2626

2727
check-mypy:
28-
MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
28+
# MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
2929

30-
$(SDIST_FILE):
31-
python3 setup.py sdist
30+
pyproject.toml: pyln/${PKG}/__init__.py
31+
poetry version ${VERSION}
3232

33-
$(BDIST_FILE):
34-
python3 setup.py bdist_wheel
33+
$(SDIST_FILE) $(BDIST_FILE): pyproject.toml
34+
poetry build
3535

36-
test-release: check $(ARTEFACTS)
37-
python3 -m twine upload --repository testpypi --skip-existing $(ARTEFACTS)
36+
test-release: check $(ARTEFACTS) pyproject.toml
37+
# No way of saying "it's ok if files exist" yet
38+
poetry publish --repository testpypi || /bin/true
39+
echo Sleeping for PyPI index to update
40+
sleep 10
41+
42+
# 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.
43+
poetry export -f requirements.txt --output requirements.txt --without-hashes
3844

3945
# Create a test virtualenv, install from the testpypi and run the
4046
# tests against it (make sure not to use any virtualenv that may have
4147
# pyln-${PKG} already installed).
4248
virtualenv testpypi --python=/usr/bin/python3 --download --always-copy --clear
43-
# Install the requirements from the prod repo, they are not being kept up to date on the test repo
4449
testpypi/bin/python3 -m pip install -r requirements.txt flaky pytest-timeout
45-
testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}
50+
testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}==${VERSION}
4651
testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')"
4752
testpypi/bin/pytest tests
4853
rm -rf testpypi

contrib/pyln-client/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyln-client"
3-
version = "0.10.2.post1"
3+
version = "0.11.0"
44
description = "Client library and plugin library for Core Lightning"
55
authors = ["Christian Decker <[email protected]>"]
66
license = "BSD-MIT"
@@ -12,7 +12,7 @@ packages = [
1212

1313
[tool.poetry.dependencies]
1414
python = "^3.7"
15-
pyln-bolt7 = "^1.0.186"
15+
pyln-bolt7 = "^1.0"
1616
pyln-proto = "^0.10.2"
1717

1818
[tool.poetry.dev-dependencies]

contrib/pyln-proto/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
poetry.lock
2+
requirements.txt

contrib/pyln-proto/Makefile

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,35 @@ check: check-source check-pytest
1919
check-source: check-flake8 check-mypy
2020

2121
check-flake8:
22-
flake8 --ignore=E501,E731,W503,E741
22+
flake8 --ignore=E501,E731,W503,E741 pyln tests
2323

2424
check-pytest:
2525
pytest tests
2626

2727
check-mypy:
28-
#mypy --namespace-packages tests pyln
29-
echo mypy disabled for pyln-proto
28+
# MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
3029

31-
$(SDIST_FILE):
32-
python3 setup.py sdist
30+
pyproject.toml: pyln/${PKG}/__init__.py
31+
poetry version ${VERSION}
3332

34-
$(BDIST_FILE):
35-
python3 setup.py bdist_wheel
33+
$(SDIST_FILE) $(BDIST_FILE): pyproject.toml
34+
poetry build
3635

37-
test-release: check $(ARTEFACTS)
38-
python3 -m twine upload --repository testpypi --skip-existing $(ARTEFACTS)
36+
test-release: check $(ARTEFACTS) pyproject.toml
37+
# No way of saying "it's ok if files exist" yet
38+
poetry publish --repository testpypi || /bin/true
39+
echo Sleeping for PyPI index to update
40+
sleep 10
41+
42+
# 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.
43+
poetry export -f requirements.txt --output requirements.txt --without-hashes
3944

4045
# Create a test virtualenv, install from the testpypi and run the
4146
# tests against it (make sure not to use any virtualenv that may have
4247
# pyln-${PKG} already installed).
4348
virtualenv testpypi --python=/usr/bin/python3 --download --always-copy --clear
44-
# Install the requirements from the prod repo, they are not being kept up to date on the test repo
4549
testpypi/bin/python3 -m pip install -r requirements.txt flaky pytest-timeout
46-
testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}
50+
testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}==${VERSION}
4751
testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')"
4852
testpypi/bin/pytest tests
4953
rm -rf testpypi

contrib/pyln-proto/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyln-proto"
3-
version = "0.10.2.post1"
3+
version = "0.11.0"
44
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!)."
55
authors = ["Christian Decker <[email protected]>"]
66
license = "BSD-MIT"

contrib/pyln-testing/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
poetry.lock
2+
requirements.txt

contrib/pyln-testing/Makefile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,35 @@ check: check-source check-pytest
1919
check-source: check-flake8 check-mypy
2020

2121
check-flake8:
22-
flake8 --ignore=E501,E731,W503,E741
22+
flake8 --ignore=E501,E731,W503,E741 pyln tests
2323

2424
check-pytest:
2525
pytest tests
2626

2727
check-mypy:
28-
MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
28+
# MYPYPATH=$(PYTHONPATH) mypy --namespace-packages --follow-imports=skip tests pyln
2929

30-
$(SDIST_FILE):
31-
python3 setup.py sdist
30+
pyproject.toml: pyln/${PKG}/__init__.py
31+
poetry version ${VERSION}
3232

33-
$(BDIST_FILE):
34-
python3 setup.py bdist_wheel
33+
$(SDIST_FILE) $(BDIST_FILE): pyproject.toml
34+
poetry build
3535

36-
test-release: check $(ARTEFACTS)
37-
python3 -m twine upload --repository testpypi --skip-existing $(ARTEFACTS)
36+
test-release: check $(ARTEFACTS) pyproject.toml
37+
# No way of saying "it's ok if files exist" yet
38+
poetry publish --repository testpypi || /bin/true
39+
echo Sleeping for PyPI index to update
40+
sleep 10
41+
42+
# 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.
43+
poetry export -f requirements.txt --output requirements.txt --without-hashes
3844

3945
# Create a test virtualenv, install from the testpypi and run the
4046
# tests against it (make sure not to use any virtualenv that may have
4147
# pyln-${PKG} already installed).
4248
virtualenv testpypi --python=/usr/bin/python3 --download --always-copy --clear
43-
# Install the requirements from the prod repo, they are not being kept up to date on the test repo
4449
testpypi/bin/python3 -m pip install -r requirements.txt flaky pytest-timeout
45-
testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}
50+
testpypi/bin/python3 -m pip install -I --index-url https://test.pypi.org/simple/ --no-deps pyln-${PKG}==${VERSION}
4651
testpypi/bin/python3 -c "from pyln import ${PKG};assert(${PKG}.__version__ == '$(VERSION)')"
4752
testpypi/bin/pytest tests
4853
rm -rf testpypi

contrib/pyln-testing/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyln-testing"
3-
version = "0.10.2"
3+
version = "0.11.0"
44
description = "Test your Core Lightning integration, plugins or whatever you want"
55
authors = ["Christian Decker <[email protected]>"]
66
license = "BSD-MIT"

0 commit comments

Comments
 (0)