Skip to content

Commit

Permalink
chore(build): switch to Poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
stegayet committed May 11, 2023
1 parent 8cb29af commit f306275
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 38 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install dependencies
run: poetry install --with test,test-ci
- name: Run unittest
run: tox -v -e ${{ matrix.python-version }}-linux-unit -- -v
run: poetry run tox -v -e ${{ matrix.python-version }}-linux-unit -- -v
#################### Integration tests ####################
integration:
needs: [unittest]
Expand All @@ -48,20 +48,21 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.2
- name: Install dependencies
run: pip install --upgrade pip setuptools wheel tox tox-docker
# Tox fails if a Python versions contains a hyphen, this changes "pypy-3.9" to "pypy3.9".
- name: Determine Python version
run: echo PYTHON_VERSION=$(echo ${{ matrix.python-version }} | sed s/-//) >> $GITHUB_ENV
run: poetry install --with test,test-ci
- name: Run AMQP integration tests
run: tox -v -e ${{ env.PYTHON_VERSION }}-linux-integration-py-amqp -- -v
run: poetry run tox -v -e ${{ matrix.python-version }}-linux-integration-py-amqp -- -v
- name: Run redis integration tests
run: tox -v -e ${{ env.PYTHON_VERSION }}-linux-integration-py-redis -- -v
run: poetry run tox -v -e ${{ matrix.python-version }}-linux-integration-py-redis -- -v
- name: Run MongoDB integration tests
run: tox -v -e ${{ env.PYTHON_VERSION }}-linux-integration-py-mongodb -- -v
run: poetry run tox -v -e ${{ matrix.python-version }}-linux-integration-py-mongodb -- -v
- name: Run kafka integration tests
if: ${{ env.PYTHON_VERSION != 'pypy3.9'}}
run: tox -v -e ${{ env.PYTHON_VERSION }}-linux-integration-py-kafka -- -v
if: ${{ matrix.python-version != 'pypy3.9'}}
run: poetry run tox -v -e ${{ matrix.python-version }}-linux-integration-py-kafka -- -v

#################### Linters and checkers ####################
lint:
Expand All @@ -80,13 +81,17 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Setup Poetry
uses: snok/install-poetry@v1
with:
version: 1.4.2
- name: Install dependencies
run: pip install --upgrade pip setuptools wheel tox tox-docker
run: poetry install --with test,test-ci
- name: Run flake8
run: tox -v -e flake8 -- -v
run: poetry run tox -v -e flake8 -- -v
- name: Run pydocstyle
run: tox -v -e pydocstyle -- -v
run: poetry run tox -v -e pydocstyle -- -v
- name: Run apicheck
run: tox -v -e apicheck -- -v
run: poetry run tox -v -e apicheck -- -v
- name: Run mypy
run: tox -v -e mypy -- -v
run: poetry run tox -v -e mypy -- -v
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ venv/
env
.eggs
.python-version
poetry.lock
105 changes: 105 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[tool.poetry]
name = "kombu"
version = "5.3.0b3"
description = "Messaging library for Python."
authors = ["Ask Solem <[email protected]>"]
license = "BSD-3-Clause"
readme = "README.rst"
homepage = "https://kombu.readthedocs.io"
repository = "https://github.com/celery/kombu"
documentation = "https://kombu.readthedocs.io"
keywords = ['messaging', 'message', 'amqp', 'rabbitmq', 'redis', 'actor', 'producer', 'consumer']
classifiers = [
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Intended Audience :: Developers',
'Topic :: Communications',
'Topic :: System :: Distributed Computing',
'Topic :: System :: Networking',
'Topic :: Software Development :: Libraries :: Python Modules',
]


[tool.poetry.dependencies]
python = "^3.8.1"
importlib-metadata = {version = ">=3.6", markers = "python_version < \"3.8\""}
cached-property = {markers = "python_version < \"3.8\"", version = "^1.5.2"}
typing-extensions = {markers = "python_version < \"3.10\"", version = "^4.5.0"}
amqp = ">=5.1.1,<6.0.0"
vine = "*"


[tool.poetry.group.test.dependencies]
pytest = "7.3.1"
pytest-sugar = "*"
pyro4 = "*"
hypothesis = "*"
pytest-freezer = "*"
backports-zoneinfo = {version = ">=0.2.1", markers = "python_version < \"3.9\""}


[tool.poetry.group.docs.dependencies]
boto3 = ">=1.4.4"
sphinx-celery = {git = "https://github.com/celery/sphinx_celery.git"}
redis = ">=4.3.6,<4.4.0"
pymongo = ">=4.1.1"
sqlalchemy = ">=1.4.47,<2.1"
azure-servicebus = {version = ">=7.9.0", markers = "platform_python_implementation == \"CPython\""}


[tool.poetry.group.dev.dependencies]
amqp = {git = "https://github.com/celery/py-amqp.git"}
vine = {git = "https://github.com/celery/vine.git"}


[tool.poetry.group.test-ci.dependencies]
pytest-cov = "*"
redis = ">=4.3.6,<4.4.0"
pymongo = ">=4.1.1"
pyyaml = ">=3.10"
msgpack = "*"
azure-storage-queue = ">=12.6.0"
azure-identity = ">=1.12.0"
azure-servicebus = {version = ">=7.9.0", markers = "platform_python_implementation == \"CPython\""}
boto3 = "1.26.104"
pycurl = "7.43.0.5"
urllib3 = "1.26.15"
python-consul2 = "*"
kazoo = ">=2.8.0"
brotlipy = {version = ">=0.7.0", markers = "platform_python_implementation == \"PyPy\""}
brotli = {version = ">=1.0.9", markers = "platform_python_implementation == \"CPython\""}
zstandard = "*"
sqlalchemy = ">=1.4.47,<2.1"
codecov = {version = "^2.1.13", markers = "sys_platform == 'win32'"}


[tool.poetry.group.pkgutils.dependencies]
setuptools = ">=47.0.0"
wheel = ">=0.29.0"
flake8 = "^6.0.0"
tox = ">=4.4.8"
sphinx2rst = ">=1.0"
bumpversion = "*"
pydocstyle = "1.1.1"
mypy = "1.2.0"


[tool.poetry.group.funtest.dependencies]
pymongo = "*"
kazoo = "*"
boto3 = "1.26.104"
redis = ">=4.3.6,<4.4.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
40 changes: 17 additions & 23 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ envlist =
pydocstyle

requires = tox-docker>=3.0
isolated-build = true

[gh-actions]
python =
Expand All @@ -20,26 +21,20 @@ python =
3.11: py311

[testenv]
skip_install = true
allowlist_externals = poetry
commands_pre = poetry install --with test-ci
sitepackages = False
setenv = C_DEBUG_TEST = 1
passenv =
DISTUTILS_USE_SDK
deps=
-r{toxinidir}/requirements/dev.txt
apicheck,pypy3.9,3.7,3.8,3.9,3.10,3.11: -r{toxinidir}/requirements/default.txt
apicheck,pypy3.9,3.7,3.8,3.9,3.10,3.11: -r{toxinidir}/requirements/test.txt
apicheck,pypy3.9,3.7-linux,3.8-linux,3.9-linux,3.10-linux,3.11-linux: -r{toxinidir}/requirements/test-ci.txt
apicheck,3.7-linux,3.8-linux,3.9-linux,3.10-linux,3.11-linux: -r{toxinidir}/requirements/extras/confluentkafka.txt
3.8-windows,3.9-windows,3.10-windows,3.11-windows: -r{toxinidir}/requirements/test-ci-windows.txt
apicheck,linkcheck: -r{toxinidir}/requirements/docs.txt
flake8,pydocstyle,mypy: -r{toxinidir}/requirements/pkgutils.txt

commands =
unit: python -bb -m pytest -rxs -xv --cov=kombu --cov-report=xml --no-cov-on-fail {posargs}
integration-py-amqp: pytest -xv -E py-amqp t/integration {posargs:-n2}
integration-redis: pytest -xv -E redis t/integration {posargs:-n2}
integration-mongodb: pytest -xv -E mongodb t/integration {posargs:-n2}
integration-kafka: pytest -xv -E kafka t/integration {posargs:-n2}
unit: poetry run python -bb -m pytest -rxs -xv --cov=kombu --cov-report=xml --no-cov-on-fail {posargs} --import-mode importlib
integration-py-amqp: poetry run pytest -xv -E py-amqp t/integration {posargs:-n2} --import-mode importlib
integration-redis: poetry run pytest -xv -E redis t/integration {posargs:-n2} --import-mode importlib
integration-mongodb: poetry run pytest -xv -E mongodb t/integration {posargs:-n2} --import-mode importlib
integration-kafka: poetry run pytest -xv -E kafka t/integration {posargs:-n2} --import-mode importlib

basepython =
pypy3.9: pypy3.9
Expand All @@ -50,8 +45,6 @@ basepython =
3.10: python3.10
3.11: python3.11

install_command = python -m pip --disable-pip-version-check install {opts} {packages}

docker =
integration-py-amqp: rabbitmq
integration-redis: redis
Expand Down Expand Up @@ -118,20 +111,21 @@ environment =
ALLOW_PLAINTEXT_LISTENER=yes

[testenv:apicheck]
commands = pip install -U -r{toxinidir}/requirements/dev.txt
commands = poetry install --with dev
sphinx-build -j2 -b apicheck -d {envtmpdir}/doctrees docs docs/_build/apicheck

[testenv:linkcheck]
commands = pip install -U -r{toxinidir}/requirements/dev.txt
commands = poetry install --with dev
sphinx-build -j2 -W -b linkcheck -d {envtmpdir}/doctrees docs docs/_build/linkcheck

[testenv:flake8]
commands =
flake8 -j2 {toxinidir}/kombu {toxinidir}/t
commands = poetry install --with dev
poetry run flake8 -j2 {toxinidir}/kombu {toxinidir}/t

[testenv:pydocstyle]
commands =
pydocstyle {toxinidir}/kombu
commands = poetry install --with dev
poetry run pydocstyle {toxinidir}/kombu

[testenv:mypy]
commands = python -m mypy --config-file setup.cfg
commands = poetry install --with dev
poetry run mypy --config-file setup.cfg

0 comments on commit f306275

Please sign in to comment.