Skip to content

Commit e35ab64

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
fix: remove usage of distutils
Partially fixes #2931 distutils is deprecated in Python 3.12 (https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated) PiperOrigin-RevId: 606697684
1 parent d727189 commit e35ab64

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

google/cloud/aiplatform/utils/prediction_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
import distutils.dir_util
18+
import shutil
1919
import inspect
2020
import logging
2121
import os
@@ -150,4 +150,4 @@ def download_model_artifacts(artifact_uri: str) -> None:
150150
blob.download_to_filename(name_without_prefix)
151151
else:
152152
# Copy files to the current working directory.
153-
distutils.dir_util.copy_tree(artifact_uri, ".")
153+
shutil.copytree(artifact_uri, ".")

tests/unit/aiplatform/test_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_invalid_region_does_not_raise_with_valid_region():
139139

140140
@pytest.fixture
141141
def copy_tree_mock():
142-
with mock.patch("distutils.dir_util.copy_tree") as copy_tree_mock:
142+
with mock.patch("shutil.copytree") as copy_tree_mock:
143143
yield copy_tree_mock
144144

145145

0 commit comments

Comments
 (0)