diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce9e18e..a3cab57 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,10 +2,11 @@ name: Build and Test on: push: + branches: + - master pull_request: branches: - master - types: [closed] jobs: matrix-builder: @@ -24,7 +25,7 @@ jobs: env: PY_VERSIONS: "[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"pypy-3.8-v7.3.11\", \"pypy-3.9-v7.3.11\"]" OS_NAMES: "[\"ubuntu-20.04\"]" #, windows-latest, macOS-latest] - CELERY_VERSIONS: "[\">=3.1.0,<4.0.0\", \">=4.0.0,<5.0.0\", \">=5.0.0,<6.0.0\"]" + CELERY_VERSIONS: "[\">=4.0.0,<5.0.0\", \">=5.0.0,<6.0.0\"]" run: | python -m pip install --upgrade pip MATRIX=$(python .github/workflows/resolve_versions.py matrix -c "$PY_VERSIONS" -o "$OS_NAMES" -n "celery" -s "$CELERY_VERSIONS") @@ -109,6 +110,9 @@ jobs: pip install "celery${{ matrix.celery }}" pip install pytest-github-actions-annotate-failures + - name: Check with black + run: black --check . + - name: Check with mypy if: ${{ !startsWith(matrix.python-version, 'pypy') && matrix.python-version >= '3.7' }} run: mypy diff --git a/.github/workflows/resolve_versions.py b/.github/workflows/resolve_versions.py index 932df8f..c8e787a 100644 --- a/.github/workflows/resolve_versions.py +++ b/.github/workflows/resolve_versions.py @@ -127,19 +127,7 @@ def process_matrix(args: Namespace) -> None: for c, o, n, s in matrix: compatible_versions = get_compatible_versions(c, o, n, s) if compatible_versions: - # This is because celery 3 depends on use_2to3, - # which is no longer supported by 3.9, 3.10 and 3.11 - # and by newer pypy versions. if ( - n == "celery" - and ( - c.replace(".", "").startswith("39") - or c.replace(".", "").startswith("310") - or c.replace(".", "").startswith("311") - or c.startswith("pypy-3") - ) - and all(cv.startswith("3") for cv in compatible_versions) - ) or ( # This is because inspect.getfullargspec has been removed in Python 3.11 # and `vine.five` 4.x was depending on it. This is fixed in 5.x. n == "celery" diff --git a/README.md b/README.md index 303a1c1..2579cac 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ celery_pubsub.publish('some.very.good.test', 42) # task 3 only * 2.0.0 * Drop support for CPython 2.7, 3.4, 3.5, 3.6 * Drop support for Pypy 2.7 and 3.6. + * Drop support for Celery 3. * Add support for Pypy 3.8 and 3.9. * Add support for CPython 3.11. * Type hints are now directly in the code. No more stubs files. diff --git a/requirements.txt b/requirements.txt index 0c3a687..6c9d576 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -celery>=3.1.0 +celery>=4.0.0 diff --git a/tests/conftest.py b/tests/conftest.py index 519483f..0801200 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,9 +20,9 @@ import celery from celery import Task -from celery.worker import WorkController from celery_pubsub import subscribe, subscribe_to +from celery_pubsub import subscribe from pkg_resources import get_distribution, parse_version P = ParamSpec("P") @@ -30,29 +30,18 @@ task: Callable[..., Callable[[Callable[P, R]], Task[P, R]]] if not typing.TYPE_CHECKING: - if get_distribution("celery").parsed_version < parse_version("4.0.0"): - celery.current_app.conf.update( - CELERY_ALWAYS_EAGER=True, - ) - task = celery.task + task = celery.shared_task - @pytest.fixture - def celery_worker() -> WorkController: - pass + @pytest.fixture(scope="session") + def celery_config(): + return { + "broker_url": "memory://", + "result_backend": "rpc://", + "broker_transport_options": {"polling_interval": 0.05}, + } - else: # pragma: no cover - task = celery.shared_task - - @pytest.fixture(scope="session") - def celery_config(): - return { - "broker_url": "memory://", - "result_backend": "rpc://", - "broker_transport_options": {"polling_interval": 0.05}, - } - - if get_distribution("celery").parsed_version >= parse_version("5.0.0"): - pytest_plugins = ["celery.contrib.pytest"] + if get_distribution("celery").parsed_version >= parse_version("5.0.0"): + pytest_plugins = ["celery.contrib.pytest"] @pytest.fixture(scope="session") @@ -176,10 +165,10 @@ def subscriber( job_e: Task[P, str], job_f: Task[P, str], job_g: Task[P, str], - job_h: Task[P, str], - job_i: Task[P, str], - job_l: Task[P, str], - job_m: Task[P, str], + job_h: Task[P, str], + job_i: Task[P, str], + job_l: Task[P, str], + job_m: Task[P, str], ) -> None: subscribe("index.high", job_a) subscribe("index.low", job_b)