diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3cab57..e94ca99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: architecture: x64 - id: set-matrix 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\"]" + PY_VERSIONS: "[\"3.7\", \"3.8\", \"3.9\", \"3.10\", \"3.11\", \"3.12\", \"pypy-3.9\", \"pypy-3.10\"]" OS_NAMES: "[\"ubuntu-20.04\"]" #, windows-latest, macOS-latest] CELERY_VERSIONS: "[\">=4.0.0,<5.0.0\", \">=5.0.0,<6.0.0\"]" run: | diff --git a/.github/workflows/resolve_versions.py b/.github/workflows/resolve_versions.py index c8e787a..e317141 100644 --- a/.github/workflows/resolve_versions.py +++ b/.github/workflows/resolve_versions.py @@ -131,7 +131,10 @@ def process_matrix(args: Namespace) -> None: # 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" - and c.replace(".", "").startswith("311") + and ( + c.replace(".", "").startswith("311") + or c.replace(".", "").startswith("312") + ) and all(cv.startswith("4") for cv in compatible_versions) ): if is_inverted: diff --git a/README.md b/README.md index 2579cac..83feca1 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,16 @@ Publish and Subscribe with Celery ## Supported dependencies -| Python | Celery 3 | Celery 4 | Celery 5 | -|----------|-----------------------------------------------------------------------|-----------------------------------------------------------------------|-----------------------------------------------------------------------| -| 3.7 | ![][badge-m_linux_3.7_celery3] ![][badge-t_linux_3.7_celery3] | ![][badge-m_linux_3.7_celery4] ![][badge-t_linux_3.7_celery4] | ![][badge-m_linux_3.7_celery5] ![][badge-t_linux_3.7_celery5] | -| 3.8 | ![][badge-m_linux_3.8_celery3] ![][badge-t_linux_3.8_celery3] | ![][badge-m_linux_3.8_celery4] ![][badge-t_linux_3.8_celery4] | ![][badge-m_linux_3.8_celery5] ![][badge-t_linux_3.8_celery5] | -| 3.9 | ![][badge-m_linux_3.9_celery3] ![][badge-t_linux_3.9_celery3] | ![][badge-m_linux_3.9_celery4] ![][badge-t_linux_3.9_celery4] | ![][badge-m_linux_3.9_celery5] ![][badge-t_linux_3.9_celery5] | -| 3.10 | ![][badge-m_linux_3.10_celery3] ![][badge-t_linux_3.10_celery3] | ![][badge-m_linux_3.10_celery4] ![][badge-t_linux_3.10_celery4] | ![][badge-m_linux_3.10_celery5] ![][badge-t_linux_3.10_celery5] | -| 3.11 | ![][badge-m_linux_3.11_celery3] ![][badge-t_linux_3.11_celery3] | ![][badge-m_linux_3.11_celery4] ![][badge-t_linux_3.11_celery4] | ![][badge-m_linux_3.11_celery5] ![][badge-t_linux_3.11_celery5] | -| pypy 3.8 | ![][badge-m_linux_pypy3.8_celery3] ![][badge-t_linux_pypy3.8_celery3] | ![][badge-m_linux_pypy3.8_celery4] ![][badge-t_linux_pypy3.8_celery4] | ![][badge-m_linux_pypy3.8_celery5] ![][badge-t_linux_pypy3.8_celery5] | -| pypy 3.9 | ![][badge-m_linux_pypy3.9_celery3] ![][badge-t_linux_pypy3.9_celery3] | ![][badge-m_linux_pypy3.9_celery4] ![][badge-t_linux_pypy3.9_celery4] | ![][badge-m_linux_pypy3.9_celery5] ![][badge-t_linux_pypy3.9_celery5] | +| Python | Celery 3 | Celery 4 | Celery 5 | +|-----------|-------------------------------------------------------------------------|-------------------------------------------------------------------------|-------------------------------------------------------------------------| +| 3.7 | ![][badge-m_linux_3.7_celery3] ![][badge-t_linux_3.7_celery3] | ![][badge-m_linux_3.7_celery4] ![][badge-t_linux_3.7_celery4] | ![][badge-m_linux_3.7_celery5] ![][badge-t_linux_3.7_celery5] | +| 3.8 | ![][badge-m_linux_3.8_celery3] ![][badge-t_linux_3.8_celery3] | ![][badge-m_linux_3.8_celery4] ![][badge-t_linux_3.8_celery4] | ![][badge-m_linux_3.8_celery5] ![][badge-t_linux_3.8_celery5] | +| 3.9 | ![][badge-m_linux_3.9_celery3] ![][badge-t_linux_3.9_celery3] | ![][badge-m_linux_3.9_celery4] ![][badge-t_linux_3.9_celery4] | ![][badge-m_linux_3.9_celery5] ![][badge-t_linux_3.9_celery5] | +| 3.10 | ![][badge-m_linux_3.10_celery3] ![][badge-t_linux_3.10_celery3] | ![][badge-m_linux_3.10_celery4] ![][badge-t_linux_3.10_celery4] | ![][badge-m_linux_3.10_celery5] ![][badge-t_linux_3.10_celery5] | +| 3.11 | ![][badge-m_linux_3.11_celery3] ![][badge-t_linux_3.11_celery3] | ![][badge-m_linux_3.11_celery4] ![][badge-t_linux_3.11_celery4] | ![][badge-m_linux_3.11_celery5] ![][badge-t_linux_3.11_celery5] | +| 3.12 | ![][badge-m_linux_3.12_celery3] ![][badge-t_linux_3.12_celery3] | ![][badge-m_linux_3.12_celery4] ![][badge-t_linux_3.12_celery4] | ![][badge-m_linux_3.12_celery5] ![][badge-t_linux_3.12_celery5] | +| pypy 3.9 | ![][badge-m_linux_pypy3.9_celery3] ![][badge-t_linux_pypy3.9_celery3] | ![][badge-m_linux_pypy3.9_celery4] ![][badge-t_linux_pypy3.9_celery4] | ![][badge-m_linux_pypy3.9_celery5] ![][badge-t_linux_pypy3.9_celery5] | +| pypy 3.10 | ![][badge-m_linux_pypy3.10_celery3] ![][badge-t_linux_pypy3.10_celery3] | ![][badge-m_linux_pypy3.10_celery4] ![][badge-t_linux_pypy3.10_celery4] | ![][badge-m_linux_pypy3.10_celery5] ![][badge-t_linux_pypy3.10_celery5] | ## Basic usage @@ -104,8 +105,8 @@ celery_pubsub.publish('some.very.good.test', 42) # task 3 only * 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. + * Add support for Pypy 3.9 and 3.10. + * Add support for CPython 3.11 and 3.12. * Type hints are now directly in the code. No more stubs files. * 1.0.2 * Add stubs file for type hinting. @@ -183,14 +184,18 @@ celery_pubsub.publish('some.very.good.test', 42) # task 3 only [badge-m_linux_3.11_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_3.11_celery4/shields [badge-m_linux_3.11_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_3.11_celery5/shields -[badge-m_linux_pypy3.8_celery3]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_pypy-3.8_celery3/shields -[badge-m_linux_pypy3.8_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_pypy-3.8_celery4/shields -[badge-m_linux_pypy3.8_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_pypy-3.8_celery5/shields +[badge-m_linux_3.12_celery3]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_3.12_celery3/shields +[badge-m_linux_3.12_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_3.12_celery4/shields +[badge-m_linux_3.12_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_3.12_celery5/shields [badge-m_linux_pypy3.9_celery3]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_pypy-3.9_celery3/shields [badge-m_linux_pypy3.9_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_pypy-3.9_celery4/shields [badge-m_linux_pypy3.9_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_pypy-3.9_celery5/shields +[badge-m_linux_pypy3.10_celery3]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_pypy-3.10_celery3/shields +[badge-m_linux_pypy3.10_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_pypy-3.10_celery4/shields +[badge-m_linux_pypy3.10_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/m_linux_pypy-3.10_celery5/shields + [//]: # (Status in tagged version) [badge-t_linux_3.7_celery3]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_3.7_celery3/shields [badge-t_linux_3.7_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_3.7_celery4/shields @@ -212,10 +217,14 @@ celery_pubsub.publish('some.very.good.test', 42) # task 3 only [badge-t_linux_3.11_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_3.11_celery4/shields [badge-t_linux_3.11_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_3.11_celery5/shields -[badge-t_linux_pypy3.8_celery3]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_pypy-3.8_celery3/shields -[badge-t_linux_pypy3.8_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_pypy-3.8_celery4/shields -[badge-t_linux_pypy3.8_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_pypy-3.8_celery5/shields +[badge-t_linux_3.12_celery3]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_3.12_celery3/shields +[badge-t_linux_3.12_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_3.12_celery4/shields +[badge-t_linux_3.12_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_3.12_celery5/shields [badge-t_linux_pypy3.9_celery3]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_pypy-3.9_celery3/shields [badge-t_linux_pypy3.9_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_pypy-3.9_celery4/shields [badge-t_linux_pypy3.9_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_pypy-3.9_celery5/shields + +[badge-t_linux_pypy3.10_celery3]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_pypy-3.10_celery3/shields +[badge-t_linux_pypy3.10_celery4]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_pypy-3.10_celery4/shields +[badge-t_linux_pypy3.10_celery5]: https://byob.yarr.is/Mulugruntz/celery-pubsub/2.0.0-beta3_linux_pypy-3.10_celery5/shields diff --git a/tests/conftest.py b/tests/conftest.py index 3d3cd29..b69ae0f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,7 +22,28 @@ from celery import Task from celery_pubsub import subscribe -from pkg_resources import get_distribution, parse_version +from packaging.version import parse, Version + + +# TODO: Simplify this when we drop support for Python 3.7. +if typing.TYPE_CHECKING: + + def get_distribution_version(distribution_name: str) -> Version: + ... + +else: + + def get_distribution_version(distribution_name: str) -> Version: + try: + from importlib.metadata import distribution + + return parse(distribution(distribution_name).version) + except ImportError: + # Fallback for Python < 3.8. Remove when we drop support for Python 3.7. + from pkg_resources import get_distribution + + return parse(get_distribution(distribution_name).version) + P = ParamSpec("P") R = TypeVar("R") @@ -39,7 +60,7 @@ def celery_config(): "broker_transport_options": {"polling_interval": 0.05}, } - if get_distribution("celery").parsed_version >= parse_version("5.0.0"): + if get_distribution_version("celery") >= parse("5.0.0"): pytest_plugins = ["celery.contrib.pytest"]