Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
16 changes: 12 additions & 4 deletions kfp/v2/google/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

import datetime
import json
import pkg_resources
try:
import pkg_resources
except:
print("pkg_resources not found; upgrade to importlib.resources instead")
import re
import subprocess
import warnings
Expand Down Expand Up @@ -187,9 +190,14 @@ def __init__(
self._region = region
self._parent = _PARENT_PATTERN.format(project_id, region)

discovery_doc_path = pkg_resources.resource_filename(
'kfp.v2.google.client',
'discovery/aiplatform_public_google_rest_v1beta1.json')

try:
discovery_doc_path = pkg_resources.resource_filename(
'kfp.v2.google.client',
'discovery/aiplatform_public_google_rest_v1beta1.json')
except:
print("pkg_resources not found; upgrade to importlib.resources instead.")
raise

with open(discovery_doc_path) as f:
discovery_doc = f.read()
Expand Down
4 changes: 2 additions & 2 deletions metaflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ class and related decorators.
pass
del globals()["_n"]

import pkg_resources
from importlib.metadata import version

try:
__version__ = pkg_resources.get_distribution("metaflow").version
__version__ = version("metaflow")
except:
# this happens on remote environments since the job package
# does not have a version
Expand Down
2 changes: 1 addition & 1 deletion metaflow/_vendor/click/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def callback(ctx, param, value):
ver = dist.version
break
if ver is None:
raise RuntimeError("Could not determine version")
raise RuntimeError("Could not determine version; pkg_resources not found; upgrade to importlib.resources instead")
echo(message % {"prog": prog, "version": ver}, color=ctx.color)
ctx.exit()

Expand Down
4 changes: 2 additions & 2 deletions metaflow/metaflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import types

import pkg_resources
from importlib.metadata import version

from metaflow.exception import MetaflowException

Expand Down Expand Up @@ -306,7 +306,7 @@ def filter(self, record):


def get_version(pkg):
return pkg_resources.get_distribution(pkg).version
return version(pkg)


# PINNED_CONDA_LIBS are the libraries that metaflow depends on for execution
Expand Down
Loading