Skip to content

Commit

Permalink
Merge pull request #1298 from alephdata/pudo/importlib-ep
Browse files Browse the repository at this point in the history
Disuse pkg_resources, which is deprecated
  • Loading branch information
pudo authored Nov 2, 2023
2 parents 6f011a0 + 27554a7 commit e5fd5c1
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions followthemoney/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
from pkg_resources import iter_entry_points
import sys


for ep in iter_entry_points("followthemoney.cli"):
ep.load()
def load_entry_points() -> None:
if sys.version_info[0] >= 3 and sys.version_info[1] >= 10:
from importlib.metadata import entry_points

for ep in entry_points().select(group="followthemoney.cli"):
ep.load()
else:
from pkg_resources import iter_entry_points

for ep_ in iter_entry_points("followthemoney.cli"):
ep_.load()


load_entry_points()

0 comments on commit e5fd5c1

Please sign in to comment.