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

Remove deprecated usage of pkg_resources in favor of importlib.metadata. #286

Merged
merged 1 commit into from
Apr 16, 2024
Merged
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
8 changes: 5 additions & 3 deletions broker/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ def provider_cmd(ctx, *args, **kwargs): # the actual subcommand
def cli(version):
"""Command-line interface for interacting with providers."""
if version:
from importlib.metadata import version

from packaging.version import Version
import pkg_resources
import requests

broker_version = pkg_resources.get_distribution("broker").version
# check the latest version publish to PyPi
broker_version = version("broker")

# Check against the latest version published to PyPi
try:
latest_version = Version(
requests.get("https://pypi.org/pypi/broker/json", timeout=60).json()["info"][
Expand Down