Skip to content

Commit

Permalink
More importlib compat fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcharnock committed Aug 17, 2023
1 parent 9c9ada2 commit 531b556
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lightbus/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import sys
from pathlib import Path

from importlib.metadata import version as importlib_version

if sys.version_info < (3, 10):
from importlib.metadata import entry_points as _entry_points

Expand Down
5 changes: 4 additions & 1 deletion lightbus/utilities/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@ def load_entrypoint_classes(entrypoint_name) -> Sequence[Tuple[str, str, Callabl
found_classes = []
for entrypoint in entry_points(group=entrypoint_name):
class_ = entrypoint.load()
found_classes.append((entrypoint.module, entrypoint.name, class_))
if sys.version_info < (3, 9):
found_classes.append((entrypoint.module_name, entrypoint.name, class_))
else:
found_classes.append((entrypoint.module, entrypoint.name, class_))
return found_classes

0 comments on commit 531b556

Please sign in to comment.