Skip to content

Commit a4545db

Browse files
authored
importlib_metadata remove deprecated entry point interfaces (#7785)
* importlib_metadata removed deprecated entry point interfaces * importlib-metadata usage requires 3.6
1 parent b012757 commit a4545db

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

celery/bin/celery.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Celery Command Line Interface."""
22
import os
33
import pathlib
4+
import sys
45
import traceback
56

67
try:
@@ -75,7 +76,16 @@ def convert(self, value, param, ctx):
7576
APP = App()
7677

7778

78-
@with_plugins(entry_points().get('celery.commands', []))
79+
if sys.version_info >= (3, 10):
80+
_PLUGINS = entry_points(group='celery.commands')
81+
else:
82+
try:
83+
_PLUGINS = entry_points().get('celery.commands', [])
84+
except AttributeError:
85+
_PLUGINS = entry_points().select(group='celery.commands')
86+
87+
88+
@with_plugins(_PLUGINS)
7989
@click.group(cls=DYMGroup, invoke_without_command=True)
8090
@click.option('-A',
8191
'--app',

celery/utils/imports.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,14 @@ def gen_task_name(app, name, module_name):
141141

142142

143143
def load_extension_class_names(namespace):
144-
for ep in entry_points().get(namespace, []):
144+
if sys.version_info >= (3, 10):
145+
_entry_points = entry_points(group=namespace)
146+
else:
147+
try:
148+
_entry_points = entry_points().get(namespace, [])
149+
except AttributeError:
150+
_entry_points = entry_points().select(group=namespace)
151+
for ep in _entry_points:
145152
yield ep.name, ep.value
146153

147154

requirements/default.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ click>=8.1.2,<9.0
66
click-didyoumean>=0.3.0
77
click-repl>=0.2.0
88
click-plugins>=1.1.1
9-
importlib-metadata>=1.4.0; python_version < '3.8'
9+
importlib-metadata>=3.6; python_version < '3.8'

0 commit comments

Comments
 (0)