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

Handle deprecation of pkg_resources and favor importlib #236

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions honcho/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from collections import ChainMap
from collections import OrderedDict
from collections import defaultdict
from pkg_resources import iter_entry_points

from honcho import __version__
from honcho.environ import Env
Expand All @@ -33,9 +32,16 @@
'procfile': 'PROCFILE',
}

export_choices = dict((_export.name, _export)
for _export in iter_entry_points('honcho_exporters'))
try:
from pkg_resources import iter_entry_points # Python 3.7-3.9

export_choices = dict((_export.name, _export)
for _export in iter_entry_points('honcho_exporters'))
except ImportError:
from importlib.metadata import entry_points # Python 3.10+

export_choices = dict((_export.name, _export)
for _export in entry_points(group='honcho_exporters'))
Comment on lines +35 to +44

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should really be flipped -- prefer importlib.metadata and if it's not available then fall back to (deprecated) pkg_resources -- otherwise this will still trigger deprecation warnings even on systems where importlib.metadata would avoid such warnings


class CommandError(Exception):
pass
Expand Down