Project Standards#

class dataikuapi.dss.project_standards.DSSProjectStandards(client)#

Handle to interact with Project Standards

Warning

Do not create this class directly, use dataikuapi.dssclient.DSSClient.get_project_standards()

list_bundle_check_specs(as_type='object')#

Get the list of the bundle check specs available in the DSS instance.

Parameters:

as_type (str, optional) – How to return the check specs. Supported values are “dict” and “object” (defaults to object)

Returns:

A list of bundle check specs. If as_type=dict, each check spec is returned as a dict. If as_type=object, each check spec is returned as a DSSProjectStandardsCheckSpecInfo.

Return type:

List[DSSProjectStandardsCheckSpecInfo | dict]

import_bundle_checks(check_specs_element_types, as_type='object')#

Create new checks by importing check specs.

Parameters:
  • check_specs_element_types (List[str]) – list of check spec element types to import

  • as_type (str, optional) – How to return the checks. Supported values are “dict” and “object” (defaults to object)

Returns:

A list of bundle checks. If as_type=dict, each check is returned as a dict. If as_type=object, each check is returned as a DSSProjectStandardsCheck.

Return type:

List[DSSProjectStandardsCheck | dict]

get_bundle_check(check_id, as_type='object')#

Get the check details

Parameters:
  • check_id (str) – id of the check

  • as_type (str, optional) – How to return the check. Supported values are “dict” and “object” (defaults to object)

Returns:

The check. If as_type=dict, check is returned as a dict. If as_type=object, check is returned as a DSSProjectStandardsCheck.

Return type:

(DSSProjectStandardsCheck | dict)

update_bundle_check(updated_check)#

Update an existing bundle check

Parameters:

updated_check (DSSProjectStandardsCheck) – the check to update

Returns:

The updated check returned by the backend

Return type:

DSSProjectStandardsCheck

delete_bundle_check(check_id)#

Delete a bundle check

Parameters:

check_id (str) – id of the check

list_bundle_checks(as_type='object')#

Get the list of the bundle checks configured in the DSS instance.

Parameters:

as_type (str, optional) – How to return the checks. Supported values are “dict” and “object” (defaults to object)

Returns:

A list of bundle checks. If as_type=dict, each check is returned as a dict. If as_type=object, each check is returned as a DSSProjectStandardsCheck.

Return type:

List[DSSProjectStandardsCheck | dict]

get_bundle_scope(scope_name, as_type='object')#

Get the scope details

Parameters:
  • scope_name (str) – name of the scope

  • as_type (str, optional) – How to return the scope. Supported values are “dict” and “object” (defaults to object)

Returns:

The scope. If as_type=dict, scope is returned as a dict. If as_type=object, scope is returned as a DSSProjectStandardsScope.

Return type:

(DSSProjectStandardsScope | dict)

create_bundle_scope(new_scope)#

Create a new bundle scope

Parameters:

new_scope (DSSProjectStandardsScope) – the scope to create

Returns:

The new scope returned by the backend

Return type:

DSSProjectStandardsScope

update_bundle_scope(updated_scope)#

Update an existing bundle scope

Parameters:

updated_scope (DSSProjectStandardsScope) – the scope to update

Returns:

The updated scope returned by the backend

Return type:

DSSProjectStandardsScope

delete_bundle_scope(scope_name)#

Delete a bundle scope

Parameters:

scope_name (str) – name of the scope

reorder_bundle_scope(scope_name, index)#

Move an existing scope to a new index. The index should be specified on a list that does not include the scope.

Ex: you want to move the scope ‘foo’ at the end of the list of scopes [‘foo’, ‘bar’]. The list without ‘foo’ is [‘bar’] so the new index should be 1 (and not 2)

Parameters:
  • scope_name (str) – name of the scope

  • index (int) – the new index of the scope.

list_bundle_scopes(as_type='object')#

Get the list of the bundle scopes configured in the DSS instance.

Parameters:

as_type (str, optional) – How to return the scopes. Supported values are “dict” and “object” (defaults to object)

Returns:

A list of bundle scopes. If as_type=dict, each check is returned as a dict. If as_type=object, each check is returned as a DSSProjectStandardsScope.

Return type:

List[DSSProjectStandardsScope | dict]

get_default_bundle_scope(as_type='object')#

Get the default bundle scope. If no existing scope is associated with one project, the default scope will be used.

Parameters:

as_type (str, optional) – How to return the default scope. Supported values are “dict” and “object” (defaults to object)

Returns:

The default bundle scope. If as_type=dict,it is returned as a dict. If as_type=object, it is returned as a DSSProjectStandardsScope.

Return type:

(DSSProjectStandardsScope | dict)

set_default_bundle_scope(scope)#

Set the default bundle scope. Name and description of the default bundle scope cannot be changed.

Parameters:

scope (DSSProjectStandardsScope) – The new value of default scope

Returns:

The updated default scope returned by the backend

Return type:

DSSProjectStandardsScope

run_bundle_checks(project, check_ids=None, bundle_id=None)#

Run the Project Standards checks on this project.

Parameters:
  • project ((dataikuapi.dss.project.DSSProject | str)) – The project or the project key

  • check_ids ((List[str] | None)) – List of explicit checks to run. If None, the scope associated to the project will be used to fetch the check ids.

  • bundle_id ((str | None)) – The id of the bundle to run the checks on. If None, a temporary bundle will be created with minimal content.

Returns:

a dataikuapi.dss.future.DSSFuture tracking the progress of the checks. Call wait_for_result() on the returned object to wait for completion (or failure). The completed object will be an instance of DSSProjectStandardsRunReport

Return type:

dataikuapi.dss.future.DSSFuture

get_scope_for_project(project, as_type='object')#

Get the scope details

Parameters:
  • project ((dataikuapi.dss.project.DSSProject | str)) – The project or the project key

  • as_type (str, optional) – How to return the scope. Supported values are “dict” and “object” (defaults to object)

Returns:

The scope. If as_type=dict, scope is returned as a dict. If as_type=object, scope is returned as a DSSProjectStandardsScope.

Return type:

(DSSProjectStandardsScope | dict)

class dataikuapi.dss.project_standards.DSSProjectStandardsCheckSpecInfo(data=None)#

Info about a Project Standards check spec. Project Standards check specs can be created or imported using DSS plugin components.

property element_type#

Element type can be considered as a unique identifier for a check spec. It’s a concatenation of the plugin id and the plugin component id.

Returns:

The element type of the check spec

Return type:

str

property label#
property description#
property owner_plugin_id#
class dataikuapi.dss.project_standards.DSSProjectStandardsCheck(data=None)#

A check for Project Standards

property id#
property name#
property description#
property check_element_type#
property check_params#
property tags#
get_raw()#

Get the raw check

Return type:

dict

class dataikuapi.dss.project_standards.DSSProjectStandardsScope(data=None)#

A scope for Project Standards. Use scopes to select which checks a project should run.

classmethod by_project(name, description='', projects=[], checks=[])#
classmethod by_folder(name, description='', folders=[], checks=[])#
classmethod by_tag(name, description='', tags=[], checks=[])#
property name#
property description#
property selection_method#
Returns:

The selection method. Returns an empty string if this is the default scope.

Return type:

str

property selected_projects#
property selected_folders#
property selected_tags#
property checks#
get_raw()#

Get the raw scope

Return type:

dict

class dataikuapi.dss.project_standards.DSSProjectStandardsRunReport(data=None)#

Report containing the result of all the checks run in the project

property bundle_checks_run_info#
Returns:

A dict with the info of each run. The key is the check id.

Return type:

Dict[str, DSSProjectStandardsCheckRunInfo]

class dataikuapi.dss.project_standards.DSSProjectStandardsCheckRunInfo(data)#

Contains info about the run of one check

property check#
Returns:

the original check configuration

Return type:

DSSProjectStandardsCheck | None

property result#
Returns:

the result of the run

Return type:

DSSProjectStandardsCheckRunResult | None

property duration_ms#
Returns:

the duration of the check run

Return type:

int

property expanded_check_params#
Returns:

the parameters that have been used when running the check

Return type:

dict

class dataikuapi.dss.project_standards.DSSProjectStandardsCheckRunResult(data)#

The result of the check run

property status#

The status of the run

Returns:

Possible values: RUN_SUCCESS, RUN_ERROR or NOT_APPLICABLE

Return type:

str

property severity#

Severity of a potential issue.

Returns:

the severity, between 0 and 5. 0 means no issue, 5 means critical issue. None if the run is not a success.

Return type:

int | None

property message#
Returns:

A message related to the run result.

Return type:

str

property details#
Returns:

Additional metadata about the run

Return type:

dict