Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ Changelog
==========



13.3.2 (2025-01-15)
---------------------

* Initial release for DSS 13.3.2

13.3.1 (2024-12-20)
---------------------

Expand Down
10 changes: 8 additions & 2 deletions dataikuapi/apinode_admin_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import warnings

from .apinode_admin.service import APINodeService
from .apinode_admin.auth import APINodeAuth
Expand All @@ -8,11 +9,16 @@
class APINodeAdminClient(DSSBaseClient):
"""Entry point for the DSS APINode admin client"""

def __init__(self, uri, api_key, insecure_tls=False):
def __init__(self, uri, api_key, no_check_certificate=False, **kwargs):
"""
Instantiate a new DSS API client on the given base uri with the given API key.
"""
DSSBaseClient.__init__(self, "%s/%s" % (uri, "admin/api"), api_key, insecure_tls=insecure_tls)
if "insecure_tls" in kwargs:
# Backward compatibility before removing insecure_tls option
warnings.warn("insecure_tls field is now deprecated. It has been replaced by no_check_certificate.", DeprecationWarning)
no_check_certificate = kwargs.get("insecure_tls") or no_check_certificate

DSSBaseClient.__init__(self, "%s/%s" % (uri, "admin/api"), api_key, no_check_certificate=no_check_certificate)

########################################################
# Services generations
Expand Down
11 changes: 9 additions & 2 deletions dataikuapi/apinode_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

from .utils import DataikuException
from .base_client import DSSBaseClient

Expand All @@ -7,7 +9,7 @@ class APINodeClient(DSSBaseClient):
This is an API client for the user-facing API of DSS API Node server (user facing API)
"""

def __init__(self, uri, service_id, api_key=None, bearer_token=None, insecure_tls=False):
def __init__(self, uri, service_id, api_key=None, bearer_token=None, no_check_certificate=False, **kwargs):
"""
Instantiate a new DSS API client on the given base URI with the given API key.

Expand All @@ -16,7 +18,12 @@ def __init__(self, uri, service_id, api_key=None, bearer_token=None, insecure_tl
:param str api_key: Optional, API key for the service. Only required if the service has its authorization setup to API keys
:param str bearer_token: Optional, The bearer token. Only required if the service has its authorization setup to OAuth2/JWT
"""
DSSBaseClient.__init__(self, "%s/%s" % (uri, "public/api/v1/%s" % service_id), api_key=api_key, bearer_token=bearer_token, insecure_tls=insecure_tls)
if "insecure_tls" in kwargs:
# Backward compatibility before removing insecure_tls option
warnings.warn("insecure_tls field is now deprecated. It has been replaced by no_check_certificate.", DeprecationWarning)
no_check_certificate = kwargs.get("insecure_tls") or no_check_certificate

DSSBaseClient.__init__(self, "%s/%s" % (uri, "public/api/v1/%s" % service_id), api_key=api_key, bearer_token=bearer_token, no_check_certificate=no_check_certificate)

@staticmethod
def _set_dispatch(obj, forced_generation, dispatch_key):
Expand Down
10 changes: 8 additions & 2 deletions dataikuapi/base_client.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import json
import warnings
from requests import Session, exceptions
from requests import exceptions
from requests.auth import HTTPBasicAuth
from .auth import HTTPBearerAuth
from .utils import DataikuException

class DSSBaseClient(object):
def __init__(self, base_uri, api_key=None, internal_ticket=None, bearer_token=None, insecure_tls=False):
def __init__(self, base_uri, api_key=None, internal_ticket=None, bearer_token=None, no_check_certificate=False, **kwargs):
if "insecure_tls" in kwargs:
# Backward compatibility before removing insecure_tls option
warnings.warn("insecure_tls field is now deprecated. It has been replaced by no_check_certificate.", DeprecationWarning)
no_check_certificate = kwargs.get("insecure_tls") or no_check_certificate

self.api_key = api_key
self.bearer_token = bearer_token
self.base_uri = base_uri
self._session = Session()
if insecure_tls:
if no_check_certificate:
self._session.verify = False

########################################################
Expand Down
12 changes: 9 additions & 3 deletions dataikuapi/dss/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,10 @@ def get_client_as(self):
from dataikuapi.dssclient import DSSClient

if self.client.api_key is not None:
return DSSClient(self.client.host, self.client.api_key, extra_headers={"X-DKU-ProxyUser": self.login}, insecure_tls=not self.client._session.verify)
return DSSClient(self.client.host, self.client.api_key, extra_headers={"X-DKU-ProxyUser": self.login}, no_check_certificate=not self.client._session.verify)
elif self.client.internal_ticket is not None:
return DSSClient(self.client.host, internal_ticket = self.client.internal_ticket,
extra_headers={"X-DKU-ProxyUser": self.login}, insecure_tls=not self.client._session.verify)
extra_headers={"X-DKU-ProxyUser": self.login}, no_check_certificate=not self.client._session.verify)
else:
raise ValueError("Don't know how to proxy this client")

Expand Down Expand Up @@ -680,7 +680,7 @@ def __init__(self, settings):

def get_raw(self):
"""
Get the the raw settings of the user
Get the raw settings of the user.

Modifications made to the returned object are reflected when saving.

Expand All @@ -689,6 +689,12 @@ def get_raw(self):
* **login** : identifier of the user, can't be modified
* **enabled** : whether the user can log into DSS
* **groups** : list of group names this user belongs to
* **trialStatus**: The trial status of the user, with the following keys:
- exists: True if this user is or was on trial
- expired: True if the trial period has expired
- valid: True if the trial is valid (for ex, has not expired and the license allows it)
- expiresOn: Date (ms since epoch) when the trial will expire
- grantedOn: Date (ms since epoch) when the trial was granted

:rtype: dict
"""
Expand Down
1 change: 1 addition & 0 deletions dataikuapi/dss/langchain/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ def bind_tools(
- a dict of the form: {"type": "tool_name", "name": "<<tool_name>>"},
or {"type": "required"}, or {"type": "any"} or {"type": "none"},
or {"type": "auto"};

strict: If specified, request the model to produce a JSON tool call that adheres to the provided schema. Support varies across models/providers.
compatible: Allow DSS to modify the schema in order to increase compatibility, depending on known limitations of the model/provider. Defaults to automatic.

Expand Down
2 changes: 1 addition & 1 deletion dataikuapi/dss/langchain/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

def must_use_deprecated_pydantic_config():
# Pydantic 2 models are supported starting with Pydantic 2 and Langchain 0.3
return pydantic.__version__[0] < '2' or langchain.__version__[0] == '0' and langchain.__version__[2] < '3'
return str(pydantic.__version__[0]) < '2' or str(langchain.__version__[0]) == '0' and str(langchain.__version__[2]) < '3'
44 changes: 26 additions & 18 deletions dataikuapi/dss/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from .projectlibrary import DSSLibrary
from .recipe import DSSRecipeListItem, DSSRecipe
from .savedmodel import DSSSavedModel
from .scenario import DSSScenario, DSSScenarioListItem
from .scenario import DSSScenario, DSSScenarioListItem, DSSTestingStatus
from .sqlnotebook import DSSSQLNotebook, DSSSQLNotebookListItem
from .streaming_endpoint import DSSStreamingEndpoint, DSSStreamingEndpointListItem, \
DSSManagedStreamingEndpointCreationHelper
Expand Down Expand Up @@ -143,7 +143,7 @@ def get_export_stream(self, options=None):
- **exportAllDatasets** (boolean): Exports the data of all datasets (default to **False**)
- **exportAllInputManagedFolders** (boolean):
Exports the data of all input managed folders (default to **False**)
- **exportGitRepository** (boolean): Exports the Git repository history (default to **False**)
- **exportGitRepository** (boolean): Exports the Git repository history (you must be project admin if a git remote with credentials is configured, defaults to **False**)
- **exportInsightsData** (boolean): Exports the data of static insights (default to **False**)


Expand Down Expand Up @@ -173,7 +173,7 @@ def export_to_file(self, path, options=None):
* **exportAllDatasets** (boolean): Exports the data of all datasets (default to **False**)
* **exportAllInputManagedFolders** (boolean): \
Exports the data of all input managed folders (default to **False**)
* **exportGitRepository** (boolean): Exports the Git repository history (default to **False**)
* **exportGitRepository** (boolean): Exports the Git repository history (you must be project admin if git contains a remote with credentials, defaults to **False**)
* **exportInsightsData** (boolean): Exports the data of static insights (default to **False**)

"""
Expand All @@ -196,7 +196,7 @@ def duplicate(self, target_project_key,
duplication_mode="MINIMAL",
export_analysis_models=True,
export_saved_models=True,
export_git_repository=True,
export_git_repository=None,
export_insights_data=True,
remapping=None,
target_project_folder=None):
Expand All @@ -208,7 +208,7 @@ def duplicate(self, target_project_key,
:param str duplication_mode: can be one of the following values: MINIMAL, SHARING, FULL, NONE (defaults to **MINIMAL**)
:param bool export_analysis_models: (defaults to **True**)
:param bool export_saved_models: (defaults to **True**)
:param bool export_git_repository: (defaults to **True**)
:param bool export_git_repository: (you must be project admin if git contains a remote with credentials, defaults to **True** if authorized)
:param bool export_insights_data: (defaults to **True**)
:param dict remapping: dict of connections to be remapped for the new project (defaults to **{}**)
:param target_project_folder: the project folder where to put the duplicated project (defaults to **None**)
Expand Down Expand Up @@ -1786,12 +1786,12 @@ def preload_bundle(self, bundle_id):
# Testing with DSS test scenarios report
########################################################

def get_last_test_scenario_runs_report(self, bundle_id):
def get_last_test_scenario_runs_report(self, bundle_id=None):
"""
Download a report describing the outcome of the latest test scenario runs performed in this project, on an
Automation node, under a specified active bundle
Download a report describing the outcome of the latest test scenario runs performed in this project.
On an Automation node, you can specify a bundle id, otherwise the report concerns the active bundle.

:param str bundle_id: bundle id tag
:param str (optional) bundle_id: bundle id tag

:return: the test scenarios report, in JUnit XML format
:rtype: file-like
Expand All @@ -1802,12 +1802,12 @@ def get_last_test_scenario_runs_report(self, bundle_id):
params={"bundleId": bundle_id}
)

def get_last_test_scenario_runs_html_report(self, bundle_id):
def get_last_test_scenario_runs_html_report(self, bundle_id=None):
"""
Download a report describing the outcome of the latest test scenario runs performed in this project, on an
Automation node, under a specified active bundle
Download a report describing the outcome of the latest test scenario runs performed in this project.
On an Automation node, you can specify a bundle id, otherwise the report concerns the active bundle.

:param str bundle_id: bundle id tag
:param str (optional) bundle_id: bundle id tag

:return: the test scenarios report, in HTML format
:rtype: file-like
Expand Down Expand Up @@ -2543,10 +2543,10 @@ def get_testing_status(self, bundle_id=None):
Get the testing status of a DSS Project. It combines the last run outcomes of all the test scenarios defined on the project, considering the worst outcome as a final result.
:param (optional) string bundle_id : if the project is on automation node, you can specify a bundle_id to filter only on the last
scenario runs when this bundle was active
:return: returns a dict with the keys 'nbTotalRanScenarios' and 'nbScenariosPerOutcome'
:rtype: dict
:returns: A :class:`dataikuapi.dss.scenario.DSSTestingStatus` object handle
"""
return self.client._perform_json("GET", "/projects/%s/scenarios/testing-status" % self.project_key, params={"bundleId": bundle_id})

return DSSTestingStatus(self.client._perform_json("GET", "/projects/%s/scenarios/testing-status" % self.project_key, params={"bundleId": bundle_id}))


class TablesImportDefinition(object):
Expand Down Expand Up @@ -3003,7 +3003,7 @@ def list_libraries(self):
"""
return self.client._perform_json("GET", "/projects/%s/git/lib-git-refs/" % self.project_key)

def add_library(self, repository, local_target_path, checkout, path_in_git_repository="", add_to_python_path=True):
def add_library(self, repository, local_target_path, checkout, path_in_git_repository="", add_to_python_path=True, login=None, password=None):
"""
Add a new external library to the project and pull it.

Expand All @@ -3012,31 +3012,39 @@ def add_library(self, repository, local_target_path, checkout, path_in_git_repo
:param str checkout: The branch, commit, or tag to check out.
:param str path_in_git_repository: The path in the git repository.
:param bool add_to_python_path: Whether to add the reference to the Python path.
:param str login: The remote repository login, for HTTPS repository (defaults to **None**).
:param str password: The remote repository password, for HTTPS repository (defaults to **None**).
:return: a :class:`dataikuapi.dss.future.DSSFuture` representing the pull process
:rtype: :class:`dataikuapi.dss.future.DSSFuture`
"""
body = {
"repository": repository,
"login": login,
"password": password,
"pathInGitRepository": path_in_git_repository,
"localTargetPath": local_target_path,
"checkout": checkout,
"addToPythonPath": add_to_python_path
}
return self.client._perform_json("POST", "/projects/%s/git/lib-git-refs/" % self.project_key, body=body)

def set_library(self, git_reference_path, remote, remotePath, checkout):
def set_library(self, git_reference_path, remote, remotePath, checkout, login=None, password=None):
"""
Set an existing external library.

:param str git_reference_path: The path of the external library.
:param str remote: The remote repository.
:param str remotePath: The path in the git repository.
:param str checkout: The branch, commit, or tag to check out.
:param str login: The remote repository login, for HTTPS repository (defaults to **None**).
:param str password: The remote repository password, for HTTPS repository (defaults to **None**).
:return: The path of the external library.
:rtype: str
"""
body = {
"repository": remote,
"login": login,
"password": password,
"pathInGitRepository": remotePath,
"checkout": checkout,
}
Expand Down
7 changes: 4 additions & 3 deletions dataikuapi/dss/projectdeployer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .future import DSSFuture

from .scenario import DSSTestingStatus

class DSSProjectDeployer(object):
"""
Expand Down Expand Up @@ -458,12 +458,13 @@ def get_testing_status(self, bundle_id=None, automation_node_id=None):
:param (optional) string bundle_id: filters the scenario runs done on a specific bundle
:param (optional) automation_node_id: for multi-node deployments only, you need to specify the automation node id on which you want to retrieve
the testing status
:returns: A :class:`dataikuapi.dss.scenario.DSSTestingStatus` object handle
"""

return self.client._perform_json("GET", "/project-deployer/deployments/%s/testing-status" % self.deployment_id, params={
return DSSTestingStatus(self.client._perform_json("GET", "/project-deployer/deployments/%s/testing-status" % self.deployment_id, params={
"bundleId": bundle_id,
"automationNodeId": automation_node_id
})
}))


class DSSProjectDeployerDeploymentSettings(object):
Expand Down
4 changes: 0 additions & 4 deletions dataikuapi/dss/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,6 @@ def set_metadata(self, metadata):
"PUT", "/projects/%s/recipes/%s/metadata" % (self.project_key, self.recipe_name),
body=metadata)

def get_input_refs(self):
inputs = self.get_settings().data["recipe"]["inputs"]["main"]["items"]
return [inp["ref"] for inp in inputs]

def get_object_discussions(self):
"""
Get a handle to manage discussions on the recipe.
Expand Down
Loading