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

Switch to importlib-metadata to drop deprecated pkg_resources #621

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions internetarchive/cli/ia.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,18 @@

See 'ia help <command>' for help on a specific command.
"""
from __future__ import annotations

import difflib
import errno
import os
import sys

from docopt import docopt, printable_usage
from pkg_resources import DistributionNotFound, iter_entry_points
if sys.version_info < (3, 10):

Check failure on line 67 in internetarchive/cli/ia.py

View workflow job for this annotation

GitHub Actions / lint_python

Ruff (I001)

internetarchive/cli/ia.py:59:1: I001 Import block is un-sorted or un-formatted
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points
from schema import Or, Schema, SchemaError # type: ignore[import]

from internetarchive import __version__
Expand Down Expand Up @@ -97,11 +100,11 @@
return __import__(_module, fromlist=['internetarchive.cli'])
else:
_module = f'ia_{cmd}'
for ep in iter_entry_points('internetarchive.cli.plugins'):
for ep in entry_points(group='internetarchive.cli.plugins'):
if ep.name == _module:
return ep.load()
raise ImportError
except (ImportError, DistributionNotFound):
except (ImportError):
print(f"error: '{cmd}' is not an ia command! See 'ia help'",
file=sys.stderr)
matches = '\t'.join(difflib.get_close_matches(cmd, cmd_aliases.values()))
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ packages =
internetarchive.cli
install_requires =
docopt>=0.6.0,<0.7.0
importlib-metadata >= 3.6.0 ; python_version <= "3.10"
jsonpatch>=0.4
requests>=2.25.0,<3.0.0
schema>=0.4.0
Expand Down
Loading