Skip to content

Commit

Permalink
Merge pull request #259 from zooniverse/remove-pkgresources
Browse files Browse the repository at this point in the history
Remove pkg_resources dependency
  • Loading branch information
lcjohnso authored Aug 9, 2024
2 parents dc10c26 + e4f8242 commit aab42a0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions panoptes_cli/commands/info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import platform

import click
import pkg_resources
import importlib.metadata

from panoptes_cli.scripts.panoptes import cli

Expand All @@ -13,24 +13,26 @@ def info(ctx):

info = {
'Panoptes CLI version': (
pkg_resources.require("panoptescli")[0].version
importlib.metadata.version("panoptescli")
),
'Panoptes client version': (
pkg_resources.require("panoptes_client")[0].version
importlib.metadata.version("panoptes_client")
),
'Operating system': '{} {}'.format(
platform.system(),
platform.release(),
),
'API endpoint': ctx.parent.config['endpoint'],
'Click': pkg_resources.require("click")[0].version,
'PyYAML': pkg_resources.require("PyYAML")[0].version,
'Python version': platform.python_version(),
'API endpoint': ctx.parent.config['endpoint'],
'Click': importlib.metadata.version("click"),
'PyYAML': importlib.metadata.version("pyyaml"),
'requests': importlib.metadata.version("requests"),
'urllib3': importlib.metadata.version("urllib3")
}

try:
info['libmagic'] = pkg_resources.require("python-magic")[0].version
except pkg_resources.DistributionNotFound:
info['libmagic'] = importlib.metadata.version("python-magic")
except importlib.metadata.PackageNotFoundError:
info['libmagic'] = False

for k, v in info.items():
Expand Down

0 comments on commit aab42a0

Please sign in to comment.