Skip to content

Commit 38c8e5c

Browse files
authored
Python Validation error and doc fix (#762)
1 parent ca69485 commit 38c8e5c

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

ads/model/model_artifact_boilerplate/artifact_introspection_test/model_artifact_validate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
TESTS_PATH = os.path.join(_cwd, "resources", "tests.yaml")
3030
HTML_PATH = os.path.join(_cwd, "resources", "template.html")
3131
CONFIG_PATH = os.path.join(_cwd, "resources", "config.yaml")
32-
PYTHON_VER_PATTERN = "^([3])(\.[6-9])(\.\d+)?$"
32+
PYTHON_VER_PATTERN = "^([3])(\.([6-9]|1[0-2]))(\.\d+)?$"
3333
PAR_URL = "https://objectstorage.us-ashburn-1.oraclecloud.com/p/WyjtfVIG0uda-P3-2FmAfwaLlXYQZbvPZmfX1qg0-sbkwEQO6jpwabGr2hMDBmBp/n/ociodscdev/b/service-conda-packs/o/service_pack/index.json"
3434

3535
TESTS = {

docs/source/user_guide/model_serialization/automlmodel.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Example
2323
from sklearn.model_selection import train_test_split
2424
2525
import ads
26-
import automl
27-
from automl import init
26+
import automlx as automl
27+
from automlx import init
2828
from ads.model import GenericModel
2929
from ads.common.model_metadata import UseCaseType
3030
@@ -48,8 +48,8 @@ Example
4848
4949
ads.set_auth("resource_principal")
5050
automl_model = GenericModel(estimator=est, artifact_dir="automl_model_artifact")
51-
automl_model.prepare(inference_conda_env="automlx_p38_cpu_v1",
52-
training_conda_env="automlx_p38_cpu_v1",
51+
automl_model.prepare(inference_conda_env="automlx234_p38_cpu_x86_64_v1",
52+
training_conda_env="automlx234_p38_cpu_x86_64_v1",
5353
use_case_type=UseCaseType.BINARY_CLASSIFICATION,
5454
X_sample=X_test,
5555
force_overwrite=True)
@@ -70,7 +70,7 @@ Open ``automl_model_artifact/score.py`` and edit the code to instantiate the mod
7070
from io import StringIO
7171
import logging
7272
import sys
73-
import automl
73+
import automlx as automl
7474
import pandas as pd
7575
import numpy as np
7676

tests/unitary/default_setup/model/test_model_introspect.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22

3-
# Copyright (c) 2021, 2023 Oracle and/or its affiliates.
3+
# Copyright (c) 2021, 2024 Oracle and/or its affiliates.
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
55

66
"""Unit Tests for model introspection module."""
@@ -249,3 +249,21 @@ def test_to_list(self):
249249
"""Tests converting instance to a list representation."""
250250
expected_result = ["test_key", "test_case", "test_result", "test_message"]
251251
assert self.mock_print_item.to_list() == expected_result
252+
253+
254+
class TestPythonVersionCheck(TestCase):
255+
def test_python_version_check(self):
256+
from ads.model.model_artifact_boilerplate.artifact_introspection_test import (
257+
model_artifact_validate as at,
258+
)
259+
import re
260+
261+
supported_python_version = [f"3.{minor}" for minor in range(6, 12)]
262+
for version in supported_python_version:
263+
m = re.match(at.PYTHON_VER_PATTERN, str(version))
264+
assert m and m.group(), "Python version check failed."
265+
266+
unsupported_python_version = ["3.5", "3.13"]
267+
for version in unsupported_python_version:
268+
m = re.match(at.PYTHON_VER_PATTERN, str(version))
269+
assert not m, "Python version check failed."

0 commit comments

Comments
 (0)