Skip to content

Commit

Permalink
WIP Move to Poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvoncek committed Nov 1, 2023
1 parent 01a49de commit 8d6879f
Show file tree
Hide file tree
Showing 11 changed files with 2,446 additions and 146 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ jobs:
build:
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11"]
include:
- python-version: 3.7
tox-py: py37
- python-version: 3.8
tox-py: py38
- python-version: 3.9
Expand All @@ -32,27 +30,23 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: snok/install-poetry@v1
- name: Install dependencies
run: |
python -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install tox
poetry install
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore=W503
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore=W503
- name: Run tox
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. venv/bin/activate
tox -e ${{ matrix.tox-py }}
poetry run tox -e ${{ matrix.tox-py }}
- uses: codecov/codecov-action@v1
name: Report code coverage
Expand Down
5 changes: 4 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export DH_VIRTUALENV_INSTALL_ROOT = /usr/share
dh $@ --with python-virtualenv --buildsystem=pybuild

override_dh_virtualenv:
dh_virtualenv \
dh_virtualenv \
--preinstall poetry==9.0.1 \
--preinstall dh-poetry==0.1.1 \
--pip-tool dh-poetry \
--extra-pip-arg "--no-cache-dir" \
--python /usr/bin/python3 --preinstall=setuptools==40.3.0 --preinstall=pip==21.3.1 --preinstall=wheel --builtin-venv

Expand Down
4 changes: 2 additions & 2 deletions packaging/docker-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ RUN apt-get update && \
# install dependencies
RUN apt-get update \
&& apt-get install -y \
libffi-dev \
libssl-dev \
libffi-dev \
libssl-dev \
debhelper \
gdebi-core \
gcc \
Expand Down
2,321 changes: 2,321 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[tool.poetry]
name = "cassandra-medusa"
version = "0.17.0-dev"
description = "Apache Cassandra backup and restore tool"
authors = ["The Last Pickle <[email protected]>"]
license = "Apache"
readme = "README.md"
homepage = "https://github.com/thelastpickle/cassandra-medusa"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.8",
"Topic :: Database",
"Topic :: System :: Archiving :: Backup"
]
packages = [
{ include = "medusa" }
]
include = [
{ path = "medusa-example.ini" },
{ path = "bin/medsua-wrapper" }
]

[tool.poetry.scripts]
main = { reference = "medusa.medusacli:cli", type = "console" }

[tool.poetry.dependencies]
python = "^3.8"
python-dateutil = "2.8.1"
click = "8.1.7"
click-aliases = "1.0.1"
PyYAML = "6.0.1"
cassandra-driver = "3.28.0"
psutil = "5.9.6"
ffwd = "0.0.2"
lockfile = "0.12.2"
pyOpenSSL = "22.0.0"
cryptography = "35.0"
pycryptodome = "3.19.0"
retrying = "1.3.4"
ssh2-python = "1.0.0"
ssh-python = "1.0.0"
parallel-ssh = "2.2.0"
requests = "2.31.0"
wheel = "^0.32.0"
gevent = "23.9.1"
greenlet = "3.0.1"
fasteners = "0.16"
datadog = "0.47.0"
botocore = "1.31.75"
boto3 = "1.28.71"
dnspython = "2.4.2"
asyncio = "3.4.3"
aiohttp = "3.8.5"
gcloud-aio-storage = "8.3.0"
azure-core = "1.29.4"
azure-identity = "1.14.0"
azure-storage-blob = "12.17.0"

[tool.poetry.group.grpc.dependencies]
protobuf = "4.24.3"
grpcio = "1.58.0"
grpcio-health-checking = "1.58.0"
grpcio-tools = "1.58.0"

[tool.poetry.group.grpc-runtime.dependencies]
grpcio = "1.58.0"
grpcio-health-checking = "1.58.0"

[tool.poetry.group.test.dependencies]
behave = "1.2.6"
flake8 = "3.7.9"
nose = "1.3.7"
coverage = "7.3.2"
pytest-cov = "4.1.0"
tox = "4.11.3"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
2 changes: 0 additions & 2 deletions requirements-grpc-runtime.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements-grpc.txt

This file was deleted.

5 changes: 0 additions & 5 deletions requirements-test.txt

This file was deleted.

30 changes: 0 additions & 30 deletions requirements.txt

This file was deleted.

89 changes: 8 additions & 81 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,84 +1,11 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 Spotify AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# setuptools.setup(
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import setuptools

with open("README.md", "r") as fh:
long_description = fh.read()

setuptools.setup(
name='cassandra-medusa',
version='0.17.0-dev',
author='The Last Pickle',
author_email='[email protected]',
url='https://github.com/thelastpickle/cassandra-medusa',
description='Apache Cassandra backup and restore tool',
long_description=long_description,
long_description_content_type="text/markdown",
license='Apache',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.7',
'Topic :: Database',
'Topic :: System :: Archiving :: Backup'
],
python_requires='>=3.7',
packages=setuptools.find_packages(),
install_requires=[
'python-dateutil<2.8.1,>=2.1',
'Click>=8.0.1',
'click-aliases>=1.0.1',
'PyYAML>=5.1',
'cassandra-driver>=3.27.0',
'psutil>=5.4.7',
'ffwd>=0.0.2',
'lockfile>=0.12.2',
'pyOpenSSL==22.0.0',
'cryptography<=35.0,>=2.5',
'pycryptodome>=3.9.9',
'retrying>=1.3.3',
'parallel-ssh==2.2.0',
'ssh2-python==1.0.0',
'ssh-python>=0.8.0',
'requests==2.22.0',
'protobuf==4.24.3',
'grpcio==1.58.0',
'grpcio-health-checking==1.58.0',
'grpcio-tools==1.58.0',
'gevent',
'greenlet',
'fasteners==0.16',
'datadog',
'botocore>=1.13.27',
'dnspython>=2.2.1',
'asyncio==3.4.3',
'aiohttp==3.8.5',
'boto3>=1.28.38',
'gcloud-aio-storage==8.3.0',
'azure-core==1.29.4',
'azure-identity==1.14.0',
'azure-storage-blob==12.17.0'
],
entry_points={
'console_scripts': [
'medusa=medusa.medusacli:cli',
]},
scripts=['bin/medusa-wrapper'],
data_files=[('/etc/medusa', ['medusa-example.ini'])]
)
# entry_points={
# 'console_scripts': [
# 'medusa=medusa.medusacli:cli',
# ]},
# scripts=['bin/medusa-wrapper'],
# data_files=[('/etc/medusa', ['medusa-example.ini'])]
# )
14 changes: 6 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tox]
envlist = py{36,37,38,39,310,311}
isolated_build = True
envlist = py{38,39,310,311}

[testenv]
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-test.txt

allowlist_externals = poetry
commands =
python setup.py check -m -s
flake8 . --ignore=W503,E402 --exclude=medusa/service/grpc/medusa_pb2.py,medusa/service/grpc/medusa_pb2_grpc.py,.tox,venv,build,dist,debian
pytest --cov=medusa --cov-report=xml -v {posargs:tests/}
poetry install
poetry run flake8 . --ignore=W503,E402 --exclude=medusa/service/grpc/medusa_pb2.py,medusa/service/grpc/medusa_pb2_grpc.py,.tox,venv,build,dist,debian
poetry run pytest --cov=medusa --cov-report=xml -v {posargs:tests/}

[flake8]
exclude = .tox,*.egg,build,data,scripts,env,venv
Expand Down

0 comments on commit 8d6879f

Please sign in to comment.