Skip to content

Commit 32c7197

Browse files
TheKevJamescopybara-github
authored andcommitted
Copybara import of the project:
-- b230f56 by Kevin James <[email protected]>: refactor: migrate off pkg_resources pkg_resources has been deprecated in favour of the builtin `importlib.*` packages. Note that for python3.7 support, we need the `importlib-metadata` backport library; once that version is dropped, the conditional dependency pin and imports can be removed. See the PyPA docs[1] for more info. 1: https://setuptools.pypa.io/en/latest/pkg_resources.html -- b6b6d0b by Kevin James <[email protected]>: chore: respond to pr review COPYBARA_INTEGRATE_REVIEW=#3298 from TheKevJames:kjames/nuke-pkg-resources b6b6d0b PiperOrigin-RevId: 606318888
1 parent 35e57b3 commit 32c7197

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

.coveragerc

-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,3 @@ exclude_lines =
1111
pragma: NO COVER
1212
# Ignore debug-only repr
1313
def __repr__
14-
# Ignore pkg_resources exceptions.
15-
# This is added at the module level as a safeguard for if someone
16-
# generates the code and tries to run it without pip installing. This
17-
# makes it virtually impossible to test properly.
18-
except pkg_resources.DistributionNotFound

google/cloud/aiplatform/initializer.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from concurrent import futures
2020
import inspect
2121
import logging
22-
import pkg_resources # noqa: F401 # Note this is used after copybara replacement
2322
import os
2423
import types
2524
from typing import Iterator, List, Optional, Type, TypeVar, Union
@@ -30,6 +29,7 @@
3029
from google.auth import credentials as auth_credentials
3130
from google.auth.exceptions import GoogleAuthError
3231

32+
from google.cloud.aiplatform import __version__
3333
from google.cloud.aiplatform import compat
3434
from google.cloud.aiplatform.constants import base as constants
3535
from google.cloud.aiplatform import utils
@@ -447,9 +447,7 @@ def create_client(
447447
Returns:
448448
client: Instantiated Vertex AI Service client with optional overrides
449449
"""
450-
gapic_version = pkg_resources.get_distribution(
451-
"google-cloud-aiplatform",
452-
).version
450+
gapic_version = __version__
453451

454452
if appended_gapic_version:
455453
gapic_version = f"{gapic_version}+{appended_gapic_version}"

tests/system/aiplatform/test_dataset.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,15 @@
2121
import importlib
2222

2323
import pandas as pd
24-
import pkg_resources
2524
import re
2625

2726
from datetime import datetime
2827

2928
from google.api_core import exceptions
3029
from google.api_core import client_options
3130

32-
from google.cloud import bigquery
33-
3431
from google.cloud import aiplatform
32+
from google.cloud import bigquery
3533
from google.cloud import storage
3634
from google.cloud.aiplatform import utils
3735
from google.cloud.aiplatform import initializer
@@ -302,7 +300,7 @@ def test_create_tabular_dataset_from_dataframe(self, bigquery_dataset):
302300
== bigquery.SchemaField(name="datetime_col", field_type="DATETIME")
303301
if re.match(
304302
r"3.*",
305-
pkg_resources.get_distribution("google-cloud-bigquery").version,
303+
bigquery.__version__,
306304
)
307305
else bigquery.SchemaField(name="datetime_col", field_type="TIMESTAMP")
308306
)

0 commit comments

Comments
 (0)