Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to poetry #288

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 29 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,53 +96,62 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Show system
run: |
python --version
uname -a
lsb_release -a
- name: Install Poetry
uses: snok/install-poetry@v1
with:
# Use 1.5.1 for Python 3.7, otherwise use latest.
version: ${{ matrix.python-version == '3.7' && '1.5.1' || 'latest' }}
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.celery }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_test.txt
pip install "celery${{ matrix.celery }}"
pip install pytest-github-actions-annotate-failures
poetry add "celery${{ matrix.celery }}"
poetry install --no-interaction --no-root --with=ci --with=dev

- name: Install project
run: poetry install --no-interaction

- name: Check with black
run: black --check .
run: poetry run black --check .

- name: Check with mypy
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: mypy
run: poetry run mypy

- 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 --exclude .github
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .github --exclude .venv
# 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 --exclude .github
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude .github --exclude .venv

- name: Test with pytest
run: |
coverage run -m pytest -v -s tests
coverage report
poetry run coverage run -m pytest -v -s tests
poetry run coverage report

- name: Code Climate Coverage Action
uses: paambaati/codeclimate-action@v3.2.0
uses: paambaati/codeclimate-action@v5.0.0
env:
# According to CodeClimate documentation, this is not considered a sensitive value.
# https://docs.codeclimate.com/docs/finding-your-test-coverage-token#regenerating-a-repos-test-reporter-id
CC_TEST_REPORTER_ID: 4967416d540739937e0eebfb13a3cf2f8dfbddd762f2b1ec800e83d18fb5efbb
with:
coverageCommand: coverage xml
coverageCommand: poetry run coverage xml
debug: true

- name: Prepare badges
Expand Down
65 changes: 65 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[tool.poetry]
name = "celery-pubsub"
version = "2.0.0-beta4"
description = "A Publish and Subscribe library for Celery"
authors = ["Samuel Giffard <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/Mulugruntz/celery-pubsub"
repository = "https://github.com/Mulugruntz/celery-pubsub"
keywords = ["celery", "publish", "subscribe", "pubsub"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Distributed Computing",
"Topic :: Utilities",
]
packages = [
{include = "celery_pubsub"},
]
include = [
{ path = "LICENSE", format = "sdist" },
]

[tool.poetry.urls]
"Download" = "https://github.com/Mulugruntz/celery-pubsub/tarball/2.0.0-beta4"

[tool.poetry.dependencies]
python = ">=3.7,<3.13"
celery = {version = ">=4.0,<6.0"}
# In python 3.12, we have to use kombu 5.3.5 or higher.
# This is not ideal, as it's celery's own dependency.
# https://github.com/celery/kombu/pull/1509
kombu = [
{version = ">=4.0,<6.0", python = ">=3.7,<3.12"},
{version = "^5.3.0", python = ">=3.12"}
]

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.3"
coverage = "5.5"
black = "23.3.0"
flake8 = ">=5.0.0"
typing-extensions = "4.7.1"
# Only for CPython (exclude pypy).
celery-types = {version = "0.14.0", markers = "implementation_name != 'pypy'"}
mypy = {version = "1.0.0", markers = "implementation_name != 'pypy'"}
types-setuptools = {version = "67.6.0.6", markers = "implementation_name != 'pypy'"}


[tool.poetry.group.ci.dependencies]
pytest-github-actions-annotate-failures = "^0.2.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
6 changes: 0 additions & 6 deletions setup.cfg

This file was deleted.

65 changes: 0 additions & 65 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import pytest

import celery
from celery import Task
from celery.app.task import Task

from celery_pubsub import subscribe, subscribe_to
from packaging.version import parse, Version
Expand Down
Loading