Skip to content

Commit bc71036

Browse files
authored
Merge pull request #25 from oracle/2.6.x
Release version 2.6.9
2 parents 4a3f5d7 + dfb30df commit bc71036

File tree

116 files changed

+8707
-2699
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+8707
-2699
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ __pycache__/
1010
.Python
1111
env/
1212
build/
13-
docs/build/
14-
docs/docs_html/
1513
develop-eggs/
1614
dist/
1715
downloads/
@@ -26,7 +24,6 @@ wheels/
2624
*.egg-info/
2725
.installed.cfg
2826
*.egg
29-
ads_latest.zip
3027

3128
# PyInstaller
3229
# Usually these files are written by a python script from a template

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Multiple extra dependencies can be installed together. For example:
138138
df = pd.read_csv(f"oci://{bucket_name}@{namespace}/{key}", storage_options=default_signer())
139139
```
140140

141-
### Load data from ADB
141+
### Load data from ADB
142142

143143
This example uses SQL injection safe binding variables.
144144

ads/__init__.py

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from __future__ import print_function, division, absolute_import
88
import os
99
import logging
10-
import sys
1110
import json
11+
from typing import Callable, Dict, Optional, Union
1212

1313
__version__ = ""
1414
with open(
@@ -25,52 +25,20 @@
2525
from ads.feature_engineering.accessor.series_accessor import ADSSeriesAccessor
2626
from ads.feature_engineering.accessor.dataframe_accessor import ADSDataFrameAccessor
2727
from ads.common import auth
28+
from ads.common.auth import set_auth
2829

2930
os.environ["GIT_PYTHON_REFRESH"] = "quiet"
3031

3132

3233
debug_mode = os.environ.get("DEBUG_MODE", False)
3334
documentation_mode = os.environ.get("DOCUMENTATION_MODE", "False") == "True"
34-
oci_config_path = oci.config.DEFAULT_LOCATION # "~/.oci/config"
35-
oci_key_profile = "DEFAULT"
3635
test_mode = os.environ.get("TEST_MODE", False)
37-
resource_principal_mode = bool(os.environ.get("RESOURCE_PRINCIPAL_MODE", False))
36+
resource_principal_mode = bool(
37+
os.environ.get("RESOURCE_PRINCIPAL_MODE", False)
38+
) # deprecated with is_resource_principal_mode() from ads.common.utils
3839
orig_ipython_traceback = None
3940

4041

41-
def set_auth(
42-
auth="api_key", oci_config_location=oci.config.DEFAULT_LOCATION, profile="DEFAULT"
43-
):
44-
"""
45-
Enable/disable resource principal identity or keypair identity in a notebook session.
46-
47-
Parameters
48-
----------
49-
auth: {'api_key', 'resource_principal'}, default 'api_key'
50-
Enable/disable resource principal identity or keypair identity in a notebook session
51-
oci_config_location: str, default oci.config.DEFAULT_LOCATION, which is '~/.oci/config'
52-
config file location
53-
profile: str, default 'DEFAULT'
54-
profile name for api keys config file
55-
"""
56-
global resource_principal_mode
57-
global oci_config_path
58-
global oci_key_profile
59-
oci_key_profile = profile
60-
61-
if auth == "api_key":
62-
resource_principal_mode = False
63-
if os.path.exists(os.path.expanduser(oci_config_location)):
64-
oci_config_path = oci_config_location
65-
else:
66-
logging.warning(
67-
f"{oci_config_location} file does not exist, default value oci.config.DEFAULT_LOCATION used instead"
68-
)
69-
oci_config_path = oci.config.DEFAULT_LOCATION
70-
elif auth == "resource_principal":
71-
resource_principal_mode = True
72-
73-
7442
def getLogger(name="ads"):
7543
logger = logging.getLogger(name)
7644
logger.setLevel(logging.WARNING)

ads/ads_version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "2.6.8"
2+
"version": "2.6.9"
33
}

ads/catalog/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

7+
import warnings
8+
9+
warnings.warn(
10+
(
11+
"The `ads.catalog` is deprecated in `oracle-ads 2.6.9` and will be removed in `oracle-ads 3.0`."
12+
),
13+
DeprecationWarning,
14+
stacklevel=2,
15+
)
16+
717
import logging
818

919
logger = logging.getLogger(__name__)

ads/catalog/model.py

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

7+
import warnings
8+
9+
warnings.warn(
10+
(
11+
"The `ads.catalog.model` is deprecated in `oracle-ads 2.6.9` and will be removed in `oracle-ads 3.0`. "
12+
"Use framework specific Model utility class for saving and deploying model. "
13+
"Check https://accelerated-data-science.readthedocs.io/en/latest/user_guide/model_registration/quick_start.html"
14+
),
15+
DeprecationWarning,
16+
stacklevel=2,
17+
)
18+
719
import json
820
import os
921
import shutil
@@ -23,7 +35,7 @@
2335
OptionalDependency,
2436
)
2537
from ads.common.model_artifact import ConflictStrategy, ModelArtifact
26-
from ads.common.model_metadata import (
38+
from ads.model.model_metadata import (
2739
METADATA_SIZE_LIMIT,
2840
MetadataSizeTooLarge,
2941
ModelCustomMetadata,
@@ -100,6 +112,10 @@ class ModelSummaryList(SummaryList):
100112
Filters the model list according to a lambda filter function, or list comprehension.
101113
"""
102114

115+
@deprecated(
116+
"2.6.6",
117+
details="Use framework specific Model utility class for saving and deploying model. Check https://accelerated-data-science.readthedocs.io/en/latest/user_guide/model_registration/quick_start.html",
118+
)
103119
def __init__(
104120
self,
105121
model_catalog,
@@ -217,6 +233,10 @@ class Model:
217233
"defined_metadata_list",
218234
]
219235

236+
@deprecated(
237+
"2.6.6",
238+
details="Use framework specific Model utility class for saving and deploying model. Check https://accelerated-data-science.readthedocs.io/en/latest/user_guide/model_registration/quick_start.html",
239+
)
220240
def __init__(
221241
self,
222242
model: OCIModel,
@@ -301,7 +321,7 @@ def _extract_metadata_taxonomy(model):
301321
metadata_taxonomy = ModelTaxonomyMetadata()
302322
if hasattr(model, "defined_metadata_list"):
303323
try:
304-
metadata_taxonomy = ModelTaxonomyMetadata._from_oci_metadata_list(
324+
metadata_taxonomy = ModelTaxonomyMetadata._from_oci_metadata(
305325
model.defined_metadata_list
306326
)
307327
except Exception as e:
@@ -314,7 +334,7 @@ def _extract_metadata_custom(model):
314334
metadata_custom = ModelCustomMetadata()
315335
if hasattr(model, "custom_metadata_list"):
316336
try:
317-
metadata_custom = ModelCustomMetadata._from_oci_metadata_list(
337+
metadata_custom = ModelCustomMetadata._from_oci_metadata(
318338
model.custom_metadata_list
319339
)
320340
except Exception as e:
@@ -430,13 +450,11 @@ def commit(self, force: bool = True) -> None:
430450
}
431451

432452
if hasattr(self, "metadata_custom"):
433-
attributes[
434-
"custom_metadata_list"
435-
] = self.metadata_custom._to_oci_metadata_list()
453+
attributes["custom_metadata_list"] = self.metadata_custom._to_oci_metadata()
436454
if hasattr(self, "metadata_taxonomy"):
437455
attributes[
438456
"defined_metadata_list"
439-
] = self.metadata_taxonomy._to_oci_metadata_list()
457+
] = self.metadata_taxonomy._to_oci_metadata()
440458

441459
update_model_details = UpdateModelDetails(**attributes)
442460
# freeform_tags=self._model.freeform_tags, defined_tags=self._model.defined_tags)
@@ -589,6 +607,10 @@ class ModelCatalog:
589607
Uploads the model artifact to cloud storage.
590608
"""
591609

610+
@deprecated(
611+
"2.6.6",
612+
details="Use framework specific Model utility class for saving and deploying model. Check https://accelerated-data-science.readthedocs.io/en/latest/user_guide/model_registration/quick_start.html",
613+
)
592614
def __init__(
593615
self,
594616
compartment_id: Optional[str] = None,
@@ -1208,17 +1230,15 @@ def download_model(
12081230

12091231
if hasattr(model_response.data, "custom_metadata_list"):
12101232
try:
1211-
result.metadata_custom = ModelCustomMetadata._from_oci_metadata_list(
1233+
result.metadata_custom = ModelCustomMetadata._from_oci_metadata(
12121234
model_response.data.custom_metadata_list
12131235
)
12141236
except:
12151237
result.metadata_custom = ModelCustomMetadata()
12161238
if hasattr(model_response.data, "defined_metadata_list"):
12171239
try:
1218-
result.metadata_taxonomy = (
1219-
ModelTaxonomyMetadata._from_oci_metadata_list(
1220-
model_response.data.defined_metadata_list
1221-
)
1240+
result.metadata_taxonomy = ModelTaxonomyMetadata._from_oci_metadata(
1241+
model_response.data.defined_metadata_list
12221242
)
12231243
except:
12241244
result.metadata_taxonomy = ModelTaxonomyMetadata()
@@ -1248,6 +1268,10 @@ def download_model(
12481268
)
12491269
return result
12501270

1271+
@deprecated(
1272+
"2.6.6",
1273+
details="Use framework specific Model utility class for saving and deploying model. Check https://accelerated-data-science.readthedocs.io/en/latest/user_guide/model_registration/quick_start.html",
1274+
)
12511275
def upload_model(
12521276
self,
12531277
model_artifact: ModelArtifact,
@@ -1335,10 +1359,10 @@ def upload_model(
13351359
description=description,
13361360
project_id=project_id,
13371361
compartment_id=self.compartment_id,
1338-
custom_metadata_list=model_artifact.metadata_custom._to_oci_metadata_list()
1362+
custom_metadata_list=model_artifact.metadata_custom._to_oci_metadata()
13391363
if model_artifact.metadata_custom is not None
13401364
else [],
1341-
defined_metadata_list=model_artifact.metadata_taxonomy._to_oci_metadata_list()
1365+
defined_metadata_list=model_artifact.metadata_taxonomy._to_oci_metadata()
13421366
if model_artifact.metadata_taxonomy is not None
13431367
else [],
13441368
input_schema=model_artifact.schema_input.to_json()

ads/catalog/notebook.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

7+
import warnings
8+
9+
warnings.warn(
10+
(
11+
"The `ads.catalog.notebook` is deprecated in `oracle-ads 2.6.9` and will be removed in `oracle-ads 3.0`."
12+
),
13+
DeprecationWarning,
14+
stacklevel=2,
15+
)
16+
717
from pandas import DataFrame
818
import oci
919
from oci.data_science.models import (

ads/catalog/project.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

7+
import warnings
8+
9+
warnings.warn(
10+
(
11+
"The `ads.catalog.project` is deprecated in `oracle-ads 2.6.9` and will be removed in `oracle-ads 3.0`."
12+
),
13+
DeprecationWarning,
14+
stacklevel=2,
15+
)
16+
717
from ads.catalog.summary import SummaryList
818
from ads.common import oci_client, auth
919
from ads.common import utils

ads/catalog/summary.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66

77
from __future__ import print_function, absolute_import
8-
8+
import warnings
9+
10+
warnings.warn(
11+
(
12+
"The `ads.catalog.summary` is deprecated in `oracle-ads 2.6.9` and will be removed in `oracle-ads 3.0`."
13+
),
14+
DeprecationWarning,
15+
stacklevel=2,
16+
)
917
import abc
1018
import ads.common.utils as utils
1119
from oci.util import to_dict

0 commit comments

Comments
 (0)