Migrate to poetry (#321)

* added pyproject.toml and poetry.lock

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* added scripts and classifiers to pyproject.toml

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated planetmint-transacitons, updated dockerfile to use poerty, updated changelog

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated CI and Makefile

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated CI audit step to use poetry

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated version number on pyproject.toml

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

* updated version number

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>

---------

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2023-02-15 15:56:01 +01:00 committed by GitHub
parent 811f89e5a6
commit 384b091d74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 3442 additions and 202 deletions

View File

@ -44,14 +44,17 @@ jobs:
- name: Install pip-audit
run: pip install --upgrade pip pip-audit
- name: Setup poetry
uses: Gr1N/setup-poetry@v7
- name: Install dependencies
run: pip install .
run: poetry install
- name: Create requirements.txt
run: pip freeze > requirements.txt
run: poetry run pip freeze > requirements.txt
- name: Audit dependencies
run: pip-audit --ignore-vuln PYSEC-2022-42969 --ignore-vuln PYSEC-2022-203 --ignore-vuln GHSA-r9hx-vwmv-q579
run: poetry run pip-audit --ignore-vuln PYSEC-2022-42969 --ignore-vuln PYSEC-2022-203 --ignore-vuln GHSA-r9hx-vwmv-q579
test:
needs: lint
@ -81,9 +84,11 @@ jobs:
- name: Get Tendermint
run: wget https://github.com/tendermint/tendermint/releases/download/v0.34.15/tendermint_0.34.15_linux_amd64.tar.gz && tar zxf tendermint_0.34.15_linux_amd64.tar.gz
- name: Install Planetmint
run: pip install -e '.[dev]'
- name: Setup poetry
uses: Gr1N/setup-poetry@v7
- name: Install Planetmint
run: poetry install --with dev
- name: Execute Tests
run: make test
@ -106,15 +111,12 @@ jobs:
uses: Gr1N/setup-poetry@v7
- name: Install dependencies
run: pip install -e '.[dev]' && pip install wheel && python setup.py bdist_wheel sdist
run: poetry install --with dev
- name: Upload to PyPI
run: |
twine check dist/*
twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
poetry build
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
- name: Upload to GitHub
uses: softprops/action-gh-release@v1

View File

@ -22,13 +22,16 @@ jobs:
python-version: 3.9
- name: Install pip-audit
run: pip install --upgrade pip pip-audit
run: pip install --upgrade pip
- name: Setup poetry
uses: Gr1N/setup-poetry@v7
- name: Install dependencies
run: pip install .
run: poetry install
- name: Create requirements.txt
run: pip freeze > requirements.txt
run: poetry run pip freeze > requirements.txt
- name: Audit dependencies
run: pip-audit --ignore-vuln PYSEC-2022-42969 --ignore-vuln PYSEC-2022-203 --ignore-vuln GHSA-r9hx-vwmv-q579
run: poetry run pip-audit --ignore-vuln PYSEC-2022-42969 --ignore-vuln PYSEC-2022-203 --ignore-vuln GHSA-r9hx-vwmv-q579

View File

@ -25,8 +25,12 @@ For reference, the possible headings are:
* **Known Issues**
* **Notes**
## [2.2.4] - 2023-15-02
* **Changed** migrated dependency management to poetry
## [2.2.3] - 2023-14-02
* **fixed** fixed voting/election backward compatibility issue (using planetmint-transactions >= 0.7.0) on the 2.2 main branch
* **Fixed** fixed voting/election backward compatibility issue (using planetmint-transactions >= 0.7.0) on the 2.2 main branch
* **Changed** migrated dependency management to poetry
## [2.2.2] - 2023-31-01
* **Fixed** catching tarantool exceptions in case tarantool drivers throw execeptions due to concurrency issues. This issue got idenitfied during the testing of the planetmint-driver-ts.

View File

@ -32,5 +32,5 @@ ENV PLANETMINT_CI_ABCI ${abci_status}
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
RUN pip install -e .[dev]
RUN pip install flask-cors
RUN pip install poetry
RUN poetry install --with dev

View File

@ -32,5 +32,5 @@ ENV PLANETMINT_CI_ABCI ${abci_status}
RUN mkdir -p /usr/src/app
COPY . /usr/src/app/
WORKDIR /usr/src/app
RUN pip install -e .[dev]
RUN pip install flask-cors
RUN pip install poetry
RUN poetry install --with dev

View File

@ -83,9 +83,9 @@ test-unit: check-deps ## Run all tests once or specify a file/test with TEST=tes
@$(DC) up -d tarantool
#wget https://github.com/tendermint/tendermint/releases/download/v0.34.15/tendermint_0.34.15_linux_amd64.tar.gz
#tar zxf tendermint_0.34.15_linux_amd64.tar.gz
pytest -m "not abci"
poetry run pytest -m "not abci"
rm -rf ~/.tendermint && ./tendermint init && ./tendermint node --consensus.create_empty_blocks=false --rpc.laddr=tcp://0.0.0.0:26657 --proxy_app=tcp://localhost:26658&
pytest -m abci
poetry run pytest -m abci
@$(DC) down

3299
poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

112
pyproject.toml Normal file
View File

@ -0,0 +1,112 @@
[tool.poetry]
name = "planetmint"
version = "2.2.4"
description = "Planetmint: The Blockchain Database"
authors = ["Planetmint contributors"]
license = "AGPLv3"
readme = "README.md"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Database",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Software Development",
"Natural Language :: English",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.9",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux"
]
[tool.poetry.scripts]
planetmint = "planetmint.commands.planetmint:main"
[tool.poetry.dependencies]
python = "^3.9"
chardet = "3.0.4"
base58 = "2.1.1"
aiohttp = "3.8.1"
abci = "0.8.3"
flask-cors = "3.0.10"
flask-restful = "0.3.9"
flask = "2.1.2"
gunicorn = "20.1.0"
jsonschema = "4.16.0"
logstats = "0.3.0"
packaging = ">=22.0"
pymongo = "3.11.4"
tarantool = "0.7.1"
python-rapidjson = ">=1.0"
pyyaml = "6.0.0"
requests = "2.25.1"
setproctitle = "1.2.2"
werkzeug = "2.0.3"
nest-asyncio = "1.5.5"
protobuf = "3.20.2"
planetmint-ipld = ">=0.0.3"
pyasn1 = ">=0.4.8"
python-decouple = "^3.7"
planetmint-transactions = ">=0.7.0"
[tool.poetry.group.dev.dependencies]
aafigure = "0.6"
alabaster = "0.7.12"
babel = "2.10.1"
certifi = "2022.12.7"
charset-normalizer = "2.0.12"
commonmark = "0.9.1"
docutils = "0.17.1"
idna = "2.10"
imagesize = "1.3.0"
importlib-metadata = "4.11.3"
jinja2 = "3.0.0"
markdown-it-py = "2.1.0"
markupsafe = "2.1.1"
mdit-py-plugins = "0.3.0"
mdurl = "0.1.1"
myst-parser = "0.17.2"
pockets = "0.9.1"
pygments = "2.12.0"
pyparsing = "3.0.8"
pytz = "2022.1"
pyyaml = ">=5.4.0"
six = "1.16.0"
snowballstemmer = "2.2.0"
sphinx = "4.5.0"
sphinx-rtd-theme = "1.0.0"
sphinxcontrib-applehelp = "1.0.2"
sphinxcontrib-devhelp = "1.0.2"
sphinxcontrib-htmlhelp = "2.0.0"
sphinxcontrib-httpdomain = "1.8.0"
sphinxcontrib-jsmath = "1.0.1"
sphinxcontrib-napoleon = "0.7"
sphinxcontrib-qthelp = "1.0.3"
sphinxcontrib-serializinghtml = "1.1.5"
urllib3 = "1.26.9"
wget = "3.2"
zipp = "3.8.0"
nest-asyncio = "1.5.5"
sphinx-press-theme = "0.8.0"
sphinx-documatt-theme = "^0.0.5"
ipdb = "^0.13.11"
ipython = "^8.9.0"
watchdog = "^2.2.1"
logging_tree = "^1.9"
pre-commit = "^3.0.3"
twine = "^4.0.2"
ptvsd = "^4.3.2"
coverage = "^7.1.0"
pep8 = "^1.7.1"
black = ">=23.1.0"
hypothesis = ">=5.3.0"
pytest = ">=3.0.0"
pytest-cov = "2.8.1"
pytest-mock = "^3.10.0"
pytest-xdist = "^3.1.0"
pytest-flask = "^1.2.0"
pytest-aiohttp = "^1.0.4"
pytest-asyncio = "^0.20.3"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

180
setup.py
View File

@ -1,180 +0,0 @@
# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
"""
Planetmint: The Blockchain Database
For full docs visit https://docs.planetmint.com
"""
import sys
from setuptools import setup, find_packages
if sys.version_info < (3, 9):
sys.exit("Please use Python version 3.9 or higher.")
with open("README.md") as readme_file:
readme = readme_file.read()
# get the version
version = {}
with open("planetmint/version.py") as fp:
exec(fp.read(), version)
def check_setuptools_features():
"""Check if setuptools is up to date."""
import pkg_resources
try:
list(pkg_resources.parse_requirements("foo~=1.0"))
except ValueError:
sys.exit(
"Your Python distribution comes with an incompatible version "
"of `setuptools`. Please run:\n"
" $ pip3 install --upgrade setuptools\n"
"and then run this command again"
)
import pathlib
import pkg_resources
docs_require = [
"aafigure==0.6",
"alabaster==0.7.12",
"Babel==2.10.1",
"certifi==2022.12.7",
"charset-normalizer==2.0.12",
"commonmark==0.9.1",
"docutils==0.17.1",
"idna==2.10", # version conflict with requests lib (required version <3)
"imagesize==1.3.0",
"importlib-metadata==4.11.3",
"Jinja2==3.0.0",
"markdown-it-py==2.1.0",
"MarkupSafe==2.1.1",
"mdit-py-plugins==0.3.0",
"mdurl==0.1.1",
"myst-parser==0.17.2",
"packaging>=22.0",
"pockets==0.9.1",
"Pygments==2.12.0",
"pyparsing==3.0.8",
"pytz==2022.1",
"PyYAML>=5.4.0",
"requests>=2.25.1",
"six==1.16.0",
"snowballstemmer==2.2.0",
"Sphinx==4.5.0",
"sphinx-rtd-theme==1.0.0",
"sphinxcontrib-applehelp==1.0.2",
"sphinxcontrib-devhelp==1.0.2",
"sphinxcontrib-htmlhelp==2.0.0",
"sphinxcontrib-httpdomain==1.8.0",
"sphinxcontrib-jsmath==1.0.1",
"sphinxcontrib-napoleon==0.7",
"sphinxcontrib-qthelp==1.0.3",
"sphinxcontrib-serializinghtml==1.1.5",
"urllib3==1.26.9",
"wget==3.2",
"zipp==3.8.0",
"nest-asyncio==1.5.5",
"sphinx-press-theme==0.8.0",
"sphinx-documatt-theme",
]
check_setuptools_features()
dev_require = ["ipdb", "ipython", "watchdog", "logging_tree", "pre-commit", "twine", "ptvsd"]
tests_require = [
"coverage",
"pep8",
"black>=23.1.0",
"hypothesis>=5.3.0",
"pytest>=3.0.0",
"pytest-cov==2.8.1",
"pytest-mock",
"pytest-xdist",
"pytest-flask",
"pytest-aiohttp",
"pytest-asyncio",
] + docs_require
install_requires = [
"chardet==3.0.4",
"base58==2.1.1",
"aiohttp==3.8.1",
"abci==0.8.3",
"flask-cors==3.0.10",
"flask-restful==0.3.9",
"flask==2.1.2",
"gunicorn==20.1.0",
"jsonschema==4.16.0",
"logstats==0.3.0",
"packaging>=22.0",
"pymongo==3.11.4",
"tarantool==0.7.1",
"python-rapidjson>=1.0",
"pyyaml==6.0.0",
"requests==2.25.1",
"setproctitle==1.2.2",
"werkzeug==2.0.3",
"nest-asyncio==1.5.5",
"protobuf==3.20.2",
"planetmint-ipld>=0.0.3",
"pyasn1>=0.4.8",
"python-decouple",
"planetmint-transactions>=0.7.0",
]
setup(
name="Planetmint",
version=version["__version__"],
description="Planetmint: The Blockchain Database",
long_description=readme,
long_description_content_type="text/markdown",
url="https://github.com/Planetmint/planetmint/",
author="Planetmint Contributors",
author_email="contact@ipdb.global",
license="AGPLv3",
zip_safe=False,
python_requires=">=3.9",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Database",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Software Development",
"Natural Language :: English",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.9",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
],
packages=find_packages(exclude=["tests*"]),
scripts=["pkg/scripts/planetmint-monit-config"],
entry_points={
"console_scripts": ["planetmint=planetmint.commands.planetmint:main"],
},
install_requires=install_requires,
setup_requires=["pytest-runner"],
tests_require=tests_require,
extras_require={
"test": tests_require,
"dev": dev_require + tests_require + docs_require,
"docs": docs_require,
},
package_data={
"transactions.common.schema": [
"v1.0/*.yaml",
"v2.0/*.yaml",
"v3.0/*.yaml",
],
"planetmint.backend.tarantool": ["*.lua"],
},
)