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

importlib_metadata remove deprecated entry point interfaces #7785

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion celery/bin/celery.py
@@ -1,6 +1,7 @@
"""Celery Command Line Interface."""
import os
import pathlib
import sys
import traceback

try:
Expand Down Expand Up @@ -75,7 +76,16 @@ def convert(self, value, param, ctx):
APP = App()


@with_plugins(entry_points().get('celery.commands', []))
if sys.version_info >= (3, 10):
_PLUGINS = entry_points(group='celery.commands')
else:
try:
_PLUGINS = entry_points().get('celery.commands', [])
except AttributeError:
_PLUGINS = entry_points().select(group='celery.commands')
woutdenolf marked this conversation as resolved.
Show resolved Hide resolved


@with_plugins(_PLUGINS)
@click.group(cls=DYMGroup, invoke_without_command=True)
@click.option('-A',
'--app',
Expand Down
9 changes: 8 additions & 1 deletion celery/utils/imports.py
Expand Up @@ -141,7 +141,14 @@ def gen_task_name(app, name, module_name):


def load_extension_class_names(namespace):
for ep in entry_points().get(namespace, []):
if sys.version_info >= (3, 10):
_entry_points = entry_points(group=namespace)
else:
try:
_entry_points = entry_points().get(namespace, [])
except AttributeError:
_entry_points = entry_points().select(group=namespace)
for ep in _entry_points:
yield ep.name, ep.value


Expand Down
2 changes: 1 addition & 1 deletion requirements/default.txt
Expand Up @@ -6,4 +6,4 @@ click>=8.1.2,<9.0
click-didyoumean>=0.3.0
click-repl>=0.2.0
click-plugins>=1.1.1
importlib-metadata>=1.4.0; python_version < '3.8'
importlib-metadata>=3.6; python_version < '3.8'