Skip to content

Commit 94dcd5d

Browse files
committed
Display a user-friendly exception when entry-point is invalid
1 parent a0e8e53 commit 94dcd5d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

setuptools/_entry_points.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import operator
33
import itertools
44

5+
from .errors import OptionError
56
from .extern.jaraco.text import yield_lines
67
from .extern.jaraco.functools import pass_none
78
from ._importlib import metadata
@@ -14,7 +15,14 @@ def ensure_valid(ep):
1415
Exercise one of the dynamic properties to trigger
1516
the pattern match.
1617
"""
17-
ep.extras
18+
try:
19+
ep.extras
20+
except AttributeError as ex:
21+
msg = (
22+
f"Problems to parse {ep}.\nPlease ensure entry-point follows the spec: "
23+
"https://packaging.python.org/en/latest/specifications/entry-points/"
24+
)
25+
raise OptionError(msg) from ex
1826

1927

2028
def load_group(value, group):

0 commit comments

Comments
 (0)