Entities

Organization

class MemberOrgRole(value)[source]

Bases: str, enum.Enum

An enumeration.

class Organization(members: list, groups: list, accounts: list, created_at, updated_at, id, name, logo_url, plan, owner, created_by, client_api: dtlpy.services.api_client.ApiClient, repositories=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Organization entity

add_member(email, role: dtlpy.entities.organization.MemberOrgRole = <enum 'MemberOrgRole'>)[source]

Add members to your organization. Read about members and groups [here](https://dataloop.ai/docs/org-members-groups).

Prerequisities: To add members to an organization, you must be in the role of an “owner” in that organization.

Parameters
  • email (str) – the member’s email

  • role (str) – MemberOrgRole.ADMIN, MemberOrgRole.OWNER, MemberOrgRole.MEMBER

Returns

True if successful or error if unsuccessful

Return type

bool

delete_member(user_id: str, sure: bool = False, really: bool = False)[source]

Delete member from the Organization.

Prerequisites: Must be an organization “owner” to delete members.

Parameters
  • user_id (str) – user id

  • sure (bool) – Are you sure you want to delete?

  • really (bool) – Really really sure?

Returns

True if success and error if not

Return type

bool

classmethod from_json(_json, client_api, is_fetched=True)[source]

Build a Project entity object from a json

Parameters
  • is_fetched – is Entity fetched from Platform

  • _json – _json response from host

  • client_api – ApiClient entity

Returns

Project object

list_groups()[source]

List all organization groups (groups that were created within the organization).

Prerequisites: You must be an organization “owner” to use this method.

Returns

groups list

Return type

list

list_members(role: Optional[dtlpy.entities.organization.MemberOrgRole] = None)[source]

List all organization members.

Prerequisites: You must be an organization “owner” to use this method.

Parameters

role (str) – MemberOrgRole.ADMIN, MemberOrgRole.OWNER, MemberOrgRole.MEMBER

Returns

projects list

Return type

list

open_in_web()[source]

Open the organizations in web platform

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(plan: str)[source]

Update Organization.

Prerequisities: You must be an Organization superuser to update an organization.

Parameters

plan (str) – OrganizationsPlans.FREEMIUM, OrganizationsPlans.PREMIUM

Returns

organization object

update_member(email: str, role: dtlpy.entities.organization.MemberOrgRole = MemberOrgRole.MEMBER)[source]

Update member role.

Prerequisities: You must be an organization “owner” to update a member’s role.

Parameters
  • email (str) – the member’s email

  • role (str) – MemberOrgRole.ADMIN, MemberOrgRole.OWNER, MemberOrgRole.MEMBER

Returns

json of the member fields

Return type

dict

class OrganizationsPlans(value)[source]

Bases: str, enum.Enum

An enumeration.

Integration

class Integration(id, name, type, org, created_at, created_by, update_at, client_api: dtlpy.services.api_client.ApiClient, project=None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Integration object

delete(sure: bool = False, really: bool = False) bool[source]

Delete integrations from the Organization

Parameters
  • sure (bool) – are you sure you want to delete?

  • really (bool) – really really?

Returns

True

Return type

bool

classmethod from_json(_json: dict, client_api: dtlpy.services.api_client.ApiClient, is_fetched=True)[source]

Build a Integration entity object from a json

Parameters
  • _json – _json response from host

  • client_api – ApiClient entity

  • is_fetched – is Entity fetched from Platform

Returns

Integration object

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(new_name: str)[source]

Update the integrations name

Parameters

new_name (str) – new name

Project

class MemberRole(value)[source]

Bases: str, enum.Enum

An enumeration.

class Project(contributors, created_at, creator, id, name, org, updated_at, role, account, is_blocked, feature_constraints, client_api: dtlpy.services.api_client.ApiClient, repositories=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Project entity

add_member(email, role: dtlpy.entities.project.MemberRole = MemberRole.DEVELOPER)[source]

Add a member to the project.

Parameters
  • email (str) – member email

  • role – “owner” ,”engineer” ,”annotator” ,”annotationManager”

Returns

dict that represent the user

Return type

dict

checkout()[source]

Checkout the project

delete(sure=False, really=False)[source]

Delete the project forever!

Parameters
  • sure (bool) – are you sure you want to delete?

  • really (bool) – really really?

Returns

True

Return type

bool

classmethod from_json(_json, client_api, is_fetched=True)[source]

Build a Project entity object from a json

Parameters
  • is_fetched – is Entity fetched from Platform

  • _json – _json response from host

  • client_api – ApiClient entity

Returns

Project object

list_members(role: Optional[dtlpy.entities.project.MemberRole] = None)[source]

List the project members.

Parameters

role – “owner” ,”engineer” ,”annotator” ,”annotationManager”

Returns

list of the project members

Return type

list

open_in_web()[source]

Open the project in web platform

remove_member(email)[source]

Remove a member from the project.

Parameters

email (str) – member email

Returns

dict that represent the user

Return type

dict

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(system_metadata=False)[source]

Update the project

Parameters

system_metadata (bool) – to update system metadata

Returns

Project object

Return type

dtlpy.entities.project.Project

update_member(email, role: dtlpy.entities.project.MemberRole = MemberRole.DEVELOPER)[source]

Update member’s information/details from the project.

Parameters
  • email (str) – member email

  • role – “owner” ,”engineer” ,”annotator” ,”annotationManager”

Returns

dict that represent the user

Return type

dict

User

class User(created_at, updated_at, name, last_name, username, avatar, email, role, type, org, id, project, client_api=None, users=None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

User entity

classmethod from_json(_json, project, client_api, users=None)[source]

Build a User entity object from a json

Parameters
Returns

User object

Return type

dtlpy.entities.user.User

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

Dataset

class Dataset(id, url, name, annotated, creator, projects, items_count, metadata, directoryTree, export, expiration_options, created_at, items_url, readable_type, access_level, driver, readonly, client_api: dtlpy.services.api_client.ApiClient, instance_map=None, project=None, datasets=None, repositories=NOTHING, ontology_ids=None, labels=None, directory_tree=None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Dataset object

add_label(label_name, color=None, children=None, attributes=None, display_label=None, label=None, recipe_id=None, ontology_id=None, icon_path=None)[source]

Add single label to dataset

Parameters
  • label_name – str - label name

  • color – color

  • children – children (sub labels)

  • attributes – attributes

  • display_label – display_label

  • label – label

  • recipe_id – optional recipe id

  • ontology_id – optional ontology id

  • icon_path – path to image to be display on label

Returns

label entity

add_labels(label_list, ontology_id=None, recipe_id=None)[source]

Add labels to dataset

Parameters
  • label_list – label list

  • ontology_id – optional ontology id

  • recipe_id – optional recipe id

Returns

label entities

checkout()[source]

Checkout the dataset

clone(clone_name, filters=None, with_items_annotations=True, with_metadata=True, with_task_annotations_status=True)[source]

Clone dataset

Parameters
  • clone_name – new dataset name

  • filters (dtlpy.entities.filters.Filters) – Filters entity or a query dict

  • with_items_annotations – clone all item’s annotations

  • with_metadata – clone metadata

  • with_task_annotations_status – clone task annotations status

Returns

dataset object

Return type

dtlpy.entities.dataset.Dataset

delete(sure=False, really=False)[source]

Delete a dataset forever!

Parameters
  • sure (bool) – are you sure you want to delete?

  • really (bool) – really really?

Returns

True is success

Return type

bool

delete_labels(label_names)[source]

Delete labels from dataset’s ontologies

Parameters

label_names – label object/ label name / list of label objects / list of label names

Returns

download(filters=None, local_path=None, file_types=None, annotation_options: Optional[dtlpy.entities.annotation.ViewAnnotationOptions] = None, annotation_filters=None, overwrite=False, to_items_folder=True, thickness=1, with_text=False, without_relative_path=None, alpha=None)[source]

Download dataset by filters. Filtering the dataset for items and save them local Optional - also download annotation, mask, instance and image mask of the item

Parameters
  • filters (dtlpy.entities.filters.Filters) – Filters entity or a dictionary containing filters parameters

  • local_path – local folder or filename to save to.

  • file_types – a list of file type to download. e.g [‘video/webm’, ‘video/mp4’, ‘image/jpeg’, ‘image/png’]

  • annotation_options – download annotations options: list(dl.ViewAnnotationOptions) not relevant for JSON option

  • annotation_filters – Filters entity to filter annotations for download not relevant for JSON option

  • overwrite – optional - default = False

  • to_items_folder – Create ‘items’ folder and download items to it

  • thickness – optional - line thickness, if -1 annotation will be filled, default =1

  • with_text – optional - add text to annotations, default = False

  • without_relative_path – string - remote path - download items without the relative path from platform

  • alpha – opacity value [0 1], default 1

Returns

List of local_path per each downloaded item

download_annotations(local_path=None, filters=None, annotation_options: Optional[dtlpy.entities.annotation.ViewAnnotationOptions] = None, annotation_filters=None, overwrite=False, thickness=1, with_text=False, remote_path=None, include_annotations_in_output=True, export_png_files=False, filter_output_annotations=False, alpha=None)[source]

Download dataset by filters. Filtering the dataset for items and save them local Optional - also download annotation, mask, instance and image mask of the item

Parameters
  • local_path – local folder or filename to save to.

  • filters (dtlpy.entities.filters.Filters) – Filters entity or a dictionary containing filters parameters

  • annotation_options – download annotations options: list(dl.ViewAnnotationOptions)

  • annotation_filters – Filters entity to filter annotations for download

  • overwrite – optional - default = False

  • thickness – optional - line thickness, if -1 annotation will be filled, default =1

  • with_text – optional - add text to annotations, default = False

  • remote_path – DEPRECATED and ignored. use filters

  • include_annotations_in_output – default - False , if export should contain annotations

  • export_png_files – default - if True, semantic annotations should be exported as png files

  • filter_output_annotations – default - False, given an export by filter - determine if to filter out annotations

  • alpha – opacity value [0 1], default 1

Returns

List of local_path per each downloaded item

download_partition(partition, local_path=None, filters=None, annotation_options=None)[source]

Download a specific partition of the dataset to local_path This function is commonly used with dl.ModelAdapter which implements thc convert to specific model structure

Parameters
  • partitiondl.SnapshotPartitionType name of the partition

  • local_path – local path directory to download the data

  • filters (dtlpy.entities.filters.Filters) – dl.entities.Filters to add the specific partitions constraint to

:return List str of the new downloaded path of each item

classmethod from_json(project: dtlpy.entities.project.Project, _json: dict, client_api: dtlpy.services.api_client.ApiClient, datasets=None, is_fetched=True)[source]

Build a Dataset entity object from a json

Parameters
  • project – dataset’s project

  • _json (dict) – _json response from host

  • client_api – ApiClient entity

  • datasets – Datasets repository

  • is_fetched (bool) – is Entity fetched from Platform

Returns

Dataset object

Return type

dtlpy.entities.dataset.Dataset

get_partitions(partitions, filters=None, batch_size: Optional[int] = None)[source]

Returns PagedEntity of items from one or more partitions

Parameters
  • partitionsdl.entities.SnapshotPartitionType or a list. Name of the partitions

  • filters (dtlpy.entities.filters.Filters) – dl.Filters to add the specific partitions constraint to

  • batch_sizeint how many items per page

Returns

dl.PagedEntities of dl.Item preforms items.list()

get_recipe_ids()[source]

Get dataset recipe Ids

Returns

list of recipe ids

open_in_web()[source]

Open the dataset in web platform

static serialize_labels(labels_dict)[source]

Convert hex color format to rgb

Parameters

labels_dict – dict of labels

Returns

dict of converted labels

set_partition(partition, filters=None)[source]

Updates all items returned by filters in the dataset to specific partition

Parameters
  • partitiondl.entities.SnapshotPartitionType to set to

  • filters (dtlpy.entities.filters.Filters) – dl.entities.Filters to add the specific partitions constraint to

Returns

dl.PagedEntities

set_readonly(state: bool)[source]

Set dataset readonly mode

Parameters

state (bool) – state

switch_recipe(recipe_id=None, recipe=None)[source]

Switch the recipe that linked to the dataset with the given one

Parameters
  • recipe_id – recipe id

  • recipe – recipe entity

Returns

sync(wait=True)[source]

Sync dataset with external storage

Parameters

wait – wait the command to finish

Returns

True if success

Return type

bool

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(system_metadata=False)[source]

Update dataset field

Parameters

system_metadata (bool) – bool - True, if you want to change metadata system

Returns

Dataset object

Return type

dtlpy.entities.dataset.Dataset

update_label(label_name, color=None, children=None, attributes=None, display_label=None, label=None, recipe_id=None, ontology_id=None, upsert=False, icon_path=None)[source]

Add single label to dataset

Parameters
  • label_name – label name

  • color – color

  • children – children (sub labels)

  • attributes – attributes

  • display_label – display label

  • label – label

  • recipe_id – optional recipe id

  • ontology_id – optional ontology id

  • upsert – if True will add in case it does not existing

  • icon_path – path to image to be display on label

Returns

label entity

update_labels(label_list, ontology_id=None, recipe_id=None, upsert=False)[source]

Add labels to dataset

Parameters
  • label_list – label list

  • ontology_id – optional ontology id

  • recipe_id – optional recipe id

  • upsert – if True will add in case it does not existing

Returns

label entities

upload_annotations(local_path, filters=None, clean=False, remote_root_path='/')[source]

Upload annotations to dataset.

Parameters
  • local_path – str - local folder where the annotations files is.

  • filters (dtlpy.entities.filters.Filters) – Filters entity or a dictionary containing filters parameters

  • clean – bool - if True it remove the old annotations

  • remote_root_path – str - the remote root path to match remote and local items

For example, if the item filepath is a/b/item and remote_root_path is /a the start folder will be b instead of a

class ExpirationOptions(item_max_days: Optional[int] = None)[source]

Bases: object

ExpirationOptions object

Driver

class Driver(bucket_name, creator, allow_external_delete, allow_external_modification, created_at, region, path, type, integration_id, metadata, name, id, client_api: dtlpy.services.api_client.ApiClient)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Driver entity

classmethod from_json(_json, client_api, is_fetched=True)[source]

Build a Driver entity object from a json

Parameters
  • _json – _json response from host

  • client_api – ApiClient entity

  • is_fetched – is Entity fetched from Platform

Returns

Driver object

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

class ExternalStorage(value)[source]

Bases: str, enum.Enum

An enumeration.

Item

class Item(annotations_link, dataset_url, thumbnail, created_at, dataset_id, annotated, metadata, filename, stream, name, type, url, id, hidden, dir, spec, creator, annotations_count, client_api: dtlpy.services.api_client.ApiClient, platform_dict, dataset, project, repositories=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Item object

clone(dst_dataset_id=None, remote_filepath=None, metadata=None, with_annotations=True, with_metadata=True, with_task_annotations_status=False, allow_many=False, wait=True)[source]

Clone item

Parameters
  • dst_dataset_id – destination dataset id

  • remote_filepath – complete filepath

  • metadata – new metadata to add

  • with_annotations – clone annotations

  • with_metadata – clone metadata

  • with_task_annotations_status – clone task annotations status

  • allow_manybool if True use multiple clones in single dataset is allowed, (default=False)

  • wait – wait the command to finish

Returns

Item

delete()[source]

Delete item from platform

Returns

True

download(local_path=None, file_types=None, save_locally=True, to_array=False, annotation_options: Optional[dtlpy.entities.annotation.ViewAnnotationOptions] = None, overwrite=False, to_items_folder=True, thickness=1, with_text=False, annotation_filters=None, alpha=None)[source]

Download dataset by filters. Filtering the dataset for items and save them local Optional - also download annotation, mask, instance and image mask of the item

Parameters
  • local_path – local folder or filename to save to disk or returns BytelsIO

  • file_types – a list of file type to download. e.g [‘video/webm’, ‘video/mp4’, ‘image/jpeg’, ‘image/png’]

  • save_locally – bool. save to disk or return a buffer

  • to_array – returns Ndarray when True and local_path = False

  • annotation_options – download annotations options: list(dl.ViewAnnotationOptions)

  • overwrite – optional - default = False

  • to_items_folder – Create ‘items’ folder and download items to it

  • thickness – optional - line thickness, if -1 annotation will be filled, default =1

  • with_text – optional - add text to annotations, default = False

  • annotation_filters – Filters entity to filter annotations for download

  • alpha – opacity value [0 1], default 1

Returns

Output (list)

classmethod from_json(_json, client_api, dataset=None, project=None, is_fetched=True)[source]

Build an item entity object from a json

Parameters
  • project – project entity

  • _json – _json response from host

  • dataset – dataset in which the annotation’s item is located

  • client_api – ApiClient entity

  • is_fetched – is Entity fetched from Platform

Returns

Item object

move(new_path)[source]

Move item from one folder to another in Platform If the directory doesn’t exist it will be created

Parameters

new_path – new full path to move item to.

Returns

True if update successfully

open_in_web()[source]

Open the items in web platform

Returns

set_description(text: str)[source]

Update Item description

Parameters

text – if None or “” description will be deleted

:return

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(system_metadata=False)[source]

Update items metadata

Parameters

system_metadata – bool - True, if you want to change metadata system

Returns

Item object

update_status(status: str, clear: bool = False, assignment_id: Optional[str] = None, task_id: Optional[str] = None)[source]

update item status

Parameters
  • status (str) – “completed” ,”approved” ,”discard”

  • clear (bool) – if true delete status

  • assignment_id (str) – assignment id

  • task_id (str) – task id

:return :True/False

class ItemStatus(value)[source]

Bases: str, enum.Enum

An enumeration.

class ModalityRefTypeEnum(value)[source]

Bases: str, enum.Enum

State enum

class ModalityTypeEnum(value)[source]

Bases: str, enum.Enum

State enum

Annotation

class Annotation(annotation_definition: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition, id, url, item_url, item, item_id, creator, created_at, updated_by, updated_at, type, source, dataset_url, platform_dict, metadata, fps, hash=None, dataset_id=None, status=None, object_id=None, automated=None, item_height=None, item_width=None, label_suggestions=None, frames=None, current_frame=0, end_frame=0, end_time=0, start_frame=0, start_time=0, dataset=None, datasets=None, annotations=None, Annotation__client_api=None, items=None, recipe_2_attributes=None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Annotations object

add_frame(annotation_definition, frame_num=None, fixed=True, object_visible=True)[source]

Add a frame state to annotation

Parameters
  • annotation_definition – annotation type object - must be same type as annotation

  • frame_num (int) – frame number

  • fixed (bool) – is fixed

  • object_visible (bool) – does the annotated object is visible

Returns

True if success

Return type

bool

add_frames(annotation_definition, frame_num=None, end_frame_num=None, start_time=None, end_time=None, fixed=True, object_visible=True)[source]

Add a frames state to annotation

Parameters
  • annotation_definition – annotation type object - must be same type as annotation

  • frame_num (int) – first frame number

  • end_frame_num (int) – last frame number

  • start_time – starting time for video

  • end_time – ending time for video

  • fixed (bool) – is fixed

  • object_visible (bool) – does the annotated object is visible

Returns

delete()[source]

Remove an annotation from item

Returns

True if success

Return type

bool

download(filepath: str, annotation_format: dtlpy.entities.annotation.ViewAnnotationOptions = ViewAnnotationOptions.MASK, height: Optional[float] = None, width: Optional[float] = None, thickness: int = 1, with_text: bool = False, alpha: Optional[float] = None)[source]

Save annotation to file

Parameters
  • filepath (str) – local path to where annotation will be downloaded to

  • annotation_format (list) – options: list(dl.ViewAnnotationOptions)

  • height (float) – image height

  • width (float) – image width

  • thickness (int) – thickness

  • with_text (bool) – get mask with text

  • alpha (float) – opacity value [0 1], default 1

Returns

filepath

Return type

str

classmethod from_json(_json, item=None, client_api=None, annotations=None, is_video=None, fps=None, item_metadata=None, dataset=None, is_audio=None)[source]

Create an annotation object from platform json

Parameters
  • _json (dict) – platform json

  • item (dtlpy.entities.item.Item) – item

  • client_api – ApiClient entity

  • annotations

  • is_video (bool) – is video

  • fps – video fps

  • item_metadata – item metadata

  • dataset – dataset entity

  • is_audio (bool) – is audio

Returns

annotation object

Return type

dtlpy.entities.annotation.Annotation

classmethod new(item=None, annotation_definition=None, object_id=None, automated=True, metadata=None, frame_num=None, parent_id=None, start_time=None, item_height=None, item_width=None)[source]

Create a new annotation object annotations

Parameters
  • item (dtlpy.entities.item.Items) – item to annotate

  • annotation_definition – annotation type object

  • object_id (str) – object_id

  • automated (bool) – is automated

  • metadata (dict) – metadata

  • frame_num (int) – optional - first frame number if video annotation

  • parent_id (str) – add parent annotation ID

  • start_time – optional - start time if video annotation

  • item_height (float) – annotation item’s height

  • item_width (float) – annotation item’s width

Returns

annotation object

Return type

dtlpy.entities.annotation.Annotation

set_frame(frame)[source]

Set annotation to frame state

Parameters

frame (int) – frame number

Returns

True if success

Return type

bool

show(image=None, thickness=None, with_text=False, height=None, width=None, annotation_format: dtlpy.entities.annotation.ViewAnnotationOptions = ViewAnnotationOptions.MASK, color=None, label_instance_dict=None, alpha=None)[source]

Show annotations mark the annotation of the image array and return it

Parameters
  • image – empty or image to draw on

  • thickness (int) – line thickness

  • with_text (bool) – add label to annotation

  • height (float) – height

  • width (float) – width

  • annotation_format – list(dl.ViewAnnotationOptions)

  • color (tuple) – optional - color tuple

  • label_instance_dict – the instance labels

  • alpha (float) – opacity value [0 1], default 1

Returns

list or single ndarray of the annotations

to_json()[source]

Convert annotation object to a platform json representation

Returns

platform json

Return type

dict

update(system_metadata=False)[source]

Update an existing annotation in host.

Parameters

system_metadata – True, if you want to change metadata system

Returns

Annotation object

Return type

dtlpy.entities.annotation.Annotation

update_status(status: dtlpy.entities.annotation.AnnotationStatus = AnnotationStatus.ISSUE)[source]

Set status on annotation

Parameters

status (str) – can be AnnotationStatus.ISSUE, AnnotationStatus.APPROVED, AnnotationStatus.REVIEW, AnnotationStatus.CLEAR

Returns

Annotation object

Return type

dtlpy.entities.annotation.Annotation

upload()[source]

Create a new annotation in host

Returns

Annotation entity

Return type

dtlpy.entities.annotation.Annotation

class AnnotationStatus(value)[source]

Bases: str, enum.Enum

An enumeration.

class AnnotationType(value)[source]

Bases: str, enum.Enum

An enumeration.

class FrameAnnotation(annotation, annotation_definition, frame_num, fixed, object_visible, recipe_2_attributes=None, interpolation=False)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

FrameAnnotation object

classmethod from_snapshot(annotation, _json, fps)[source]

new frame state to annotation

Parameters
  • annotation – annotation

  • _json – annotation type object - must be same type as annotation

  • fps – frame number

Returns

FrameAnnotation object

classmethod new(annotation, annotation_definition, frame_num, fixed, object_visible=True)[source]

new frame state to annotation

Parameters
  • annotation – annotation

  • annotation_definition – annotation type object - must be same type as annotation

  • frame_num – frame number

  • fixed – is fixed

  • object_visible – does the annotated object is visible

Returns

FrameAnnotation object

show(**kwargs)[source]

Show annotation as ndarray :param kwargs: see annotation definition :return: ndarray of the annotation

class ViewAnnotationOptions(value)[source]

Bases: str, enum.Enum

An enumeration.

Collection of Annotation entities

class AnnotationCollection(item=None, annotations=NOTHING, dataset=None, colors=None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Collection of Annotation entity

add(annotation_definition, object_id=None, frame_num=None, end_frame_num=None, start_time=None, end_time=None, automated=True, fixed=True, object_visible=True, metadata=None, parent_id=None, model_info=None)[source]

Add annotations to collection

Parameters
  • annotation_definition – dl.Polygon, dl.Segmentation, dl.Point, dl.Box etc

  • object_id – Object id (any id given by user). If video - must input to match annotations between frames

  • frame_num – video only, number of frame

  • end_frame_num – video only, the end frame of the annotation

  • start_time – video only, start time of the annotation

  • end_time – video only, end time of the annotation

  • automated

  • fixed – video only, mark frame as fixed

  • object_visible – video only, does the annotated object is visible

  • metadata – optional- metadata dictionary for annotation

  • parent_id – set a parent for this annotation (parent annotation ID)

  • model_info – optional - set model on annotation {‘name’,:’’, ‘confidence’:0}

Returns

download(filepath, img_filepath=None, annotation_format: dtlpy.entities.annotation.ViewAnnotationOptions = ViewAnnotationOptions.MASK, height=None, width=None, thickness=1, with_text=False, orientation=0, alpha=None)[source]

Save annotations to file

Parameters
  • filepath – path to save annotation

  • img_filepath – img file path - needed for img_mask

  • annotation_format – how to show thw annotations. options: list(dl.ViewAnnotationOptions)

  • height – height

  • width – width

  • thickness – thickness

  • with_text – add a text to the image

  • orientation – the image orientation

  • alpha – opacity value [0 1], default 1

Returns

from_instance_mask(mask, instance_map=None)[source]

convert annotation from instance mask format :param mask: the mask annotation :param instance_map: labels

from_vtt_file(filepath)[source]

convert annotation from vtt format :param filepath: path to the file

get_frame(frame_num)[source]

Get frame

Parameters

frame_num – frame num

Returns

AnnotationCollection

print(to_return=False, columns=None)[source]
Parameters
  • to_return

  • columns

show(image=None, thickness=None, with_text=False, height=None, width=None, annotation_format: dtlpy.entities.annotation.ViewAnnotationOptions = ViewAnnotationOptions.MASK, label_instance_dict=None, color=None, alpha=None)[source]

Show annotations according to annotation_format

Parameters
  • image – empty or image to draw on

  • height – height

  • width – width

  • thickness – line thickness

  • with_text – add label to annotation

  • annotation_format – how to show thw annotations. options: list(dl.ViewAnnotationOptions)

  • label_instance_dict – instance label map {‘Label’: 1, ‘More’: 2}

  • color – optional - color tuple

  • alpha – opacity value [0 1], default 1

Returns

ndarray of the annotations

to_json()[source]

Convert annotation object to a platform json representation

Returns

platform json

Return type

dict

Annotation Definition

Box Annotation Definition

class Box(left=None, top=None, right=None, bottom=None, label=None, attributes=None, description=None, angle=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Box annotation object Can create a box using 2 point using: “top”, “left”, “bottom”, “right” (to form a box [(left, top), (right, bottom)]) For rotated box add the “angel”

classmethod from_segmentation(mask, label, attributes=None)[source]

Convert binary mask to Polygon

Parameters
  • mask – binary mask (0,1)

  • label – annotation label

  • attributes – annotations list of attributes

Returns

Box annotations list to each separated segmentation

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

Classification Annotation Definition

class Classification(label, attributes=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Classification annotation object

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

Cuboid Annotation Definition

class Cube(label, front_tl, front_tr, front_br, front_bl, back_tl, back_tr, back_br, back_bl, angle=None, attributes=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Cube annotation object

classmethod from_boxes_and_angle(front_left, front_top, front_right, front_bottom, back_left, back_top, back_right, back_bottom, label, angle=0, attributes=None)[source]

Create cuboid by given front and back boxes with angle the angle calculate fom the center of each box

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

Item Description Definition

class Description(text, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Subtitle annotation object

Ellipse Annotation Definition

class Ellipse(x, y, rx, ry, angle, label, attributes=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Ellipse annotation object

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

Note Annotation Definition

class Message(msg_id: Optional[str] = None, creator: Optional[str] = None, msg_time=None, body: Optional[str] = None)[source]

Bases: object

Note message object

class Note(left, top, right, bottom, label, attributes=None, messages=None, status='issue', assignee=None, create_time=None, creator=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.box.Box

Note annotation object

Point Annotation Definition

class Point(x, y, label, attributes=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Point annotation object

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

Polygon Annotation Definition

class Polygon(geo, label, attributes=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Polygon annotation object

classmethod from_segmentation(mask, label, attributes=None, epsilon=None, max_instances=1, min_area=0)[source]

Convert binary mask to Polygon

Parameters
  • mask – binary mask (0,1)

  • label – annotation label

  • attributes – annotations list of attributes

  • epsilon – from opencv: specifying the approximation accuracy. This is the maximum distance between the original curve and its approximation. if 0 all points are returns

  • max_instances – number of max instances to return. if None all wil be returned

  • min_area – remove polygons with area lower thn this threshold (pixels)

Returns

Polygon annotation

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

Polyline Annotation Definition

class Polyline(geo, label, attributes=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Polyline annotation object

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

Pose Annotation Definition

class Pose(label, template_id, instance_id=None, attributes=None, points=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Classification annotation object

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

Segmentation Annotation Definition

class Segmentation(geo, label, attributes=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Segmentation annotation object

classmethod from_polygon(geo, label, shape, attributes=None)[source]
Parameters
  • geo – list of x,y coordinates of the polygon ([[x,y],[x,y]…]

  • label – annotation’s label

  • shape – image shape (h,w)

  • attributes

Returns

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

to_box()[source]
Returns

Box annotations list to each separated segmentation

Audio Annotation Definition

class Subtitle(text, label, attributes=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

Subtitle annotation object

Undefined Annotation Definition

class UndefinedAnnotationType(type, label, coordinates, attributes=None, description=None)[source]

Bases: dtlpy.entities.annotation_definitions.base_annotation_definition.BaseAnnotationDefinition

UndefinedAnnotationType annotation object

show(image, thickness, with_text, height, width, annotation_format, color, alpha=1)[source]

Show annotation as ndarray :param image: empty or image to draw on :param thickness: :param with_text: not required :param height: item height :param width: item width :param annotation_format: options: list(dl.ViewAnnotationOptions) :param color: color :param alpha: opacity value [0 1], default 1 :return: ndarray

Similarity

class Collection(type: dtlpy.entities.similarity.CollectionTypes, name, items=None)[source]

Bases: object

Base Collection Entity

add(ref, type: dtlpy.entities.similarity.SimilarityTypeEnum = SimilarityTypeEnum.ID)[source]

Add item to collection :param ref: :param type: url, id

pop(ref)[source]
Parameters

ref

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

class CollectionItem(type: dtlpy.entities.similarity.SimilarityTypeEnum, ref)[source]

Bases: object

Base CollectionItem

class CollectionTypes(value)[source]

Bases: str, enum.Enum

An enumeration.

class MultiView(name, items=None)[source]

Bases: dtlpy.entities.similarity.Collection

Multi Entity

property items

list of the collection items

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

class MultiViewItem(type, ref)[source]

Bases: dtlpy.entities.similarity.CollectionItem

Single multi view item

class Similarity(ref, name=None, items=None)[source]

Bases: dtlpy.entities.similarity.Collection

Similarity Entity

property items

list of the collection items

property target

Target item for similarity

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

class SimilarityItem(type, ref, target=False)[source]

Bases: dtlpy.entities.similarity.CollectionItem

Single similarity item

class SimilarityTypeEnum(value)[source]

Bases: str, enum.Enum

State enum

Filter

class Filters(field=None, values=None, operator: Optional[dtlpy.entities.filters.FiltersOperations] = None, method: Optional[dtlpy.entities.filters.FiltersMethod] = None, custom_filter=None, resource: dtlpy.entities.filters.FiltersResource = FiltersResource.ITEM, use_defaults=True, context=None)[source]

Bases: object

Filters entity to filter items from pages in platform

add(field, values, operator: Optional[dtlpy.entities.filters.FiltersOperations] = None, method: Optional[dtlpy.entities.filters.FiltersMethod] = None)[source]

Add filter

Parameters
  • field – Metadata field / attribute

  • values – field values

  • operator – optional - in, gt, lt, eq, ne

  • method – Optional - or/and

Returns

add_join(field, values, operator: Optional[dtlpy.entities.filters.FiltersOperations] = None, method: dtlpy.entities.filters.FiltersMethod = FiltersMethod.AND)[source]

join a query to the filter

Parameters
  • field – field to add

  • values – values

  • operator – optional - in, gt, lt, eq, ne

  • method – optional - str - FiltersMethod.AND, FiltersMethod.OR

generate_url_query_params(url)[source]

generate url query params

Parameters

url

has_field(field)[source]

is filter has field

Parameters

field – field to check

Returns

Ture is have it

Return type

bool

pop(field)[source]

Pop filed

Parameters

field – field to pop

pop_join(field)[source]

Pop join

Parameters

field – field to pop

prepare(operation=None, update=None, query_only=False, system_update=None, system_metadata=False)[source]

To dictionary for platform call

Parameters
  • operation – operation

  • update – update

  • query_only – query only

  • system_update – system update

  • system_metadata – True, if you want to change metadata system

Returns

dict of the filter

Return type

dict

sort_by(field, value: dtlpy.entities.filters.FiltersOrderByDirection = FiltersOrderByDirection.ASCENDING)[source]

sort the filter

Parameters
  • field – field to sort by it

  • value – FiltersOrderByDirection.ASCENDING, FiltersOrderByDirection.DESCENDING

class FiltersKnownFields(value)[source]

Bases: str, enum.Enum

An enumeration.

class FiltersMethod(value)[source]

Bases: str, enum.Enum

An enumeration.

class FiltersOperations(value)[source]

Bases: str, enum.Enum

An enumeration.

class FiltersOrderByDirection(value)[source]

Bases: str, enum.Enum

An enumeration.

class FiltersResource(value)[source]

Bases: str, enum.Enum

An enumeration.

Recipe

class Recipe(id, creator, url, title, project_ids, description, ontology_ids, instructions, examples, custom_actions, metadata, ui_settings, client_api: dtlpy.services.api_client.ApiClient, dataset=None, project=None, repositories=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Recipe object

clone(shallow=False)[source]

Clone Recipe

Parameters

shallow – If True, link ot existing ontology, clones all ontology that are link to the recipe as well

Returns

Cloned ontology object

delete(force: bool = False)[source]

Delete recipe from platform

Parameters

force (bool) – force delete recipe

Returns

True

classmethod from_json(_json, client_api, dataset=None, project=None, is_fetched=True)[source]

Build a Recipe entity object from a json

Parameters
  • _json – _json response from host

  • dataset – recipe’s dataset

  • project – recipe’s project

  • client_api – ApiClient entity

  • is_fetched – is Entity fetched from Platform

Returns

Recipe object

get_annotation_template_id(template_name)[source]

Get annotation template id by template name

Parameters

template_name

Returns

template id or None if does not exist

open_in_web()[source]

Open the recipes in web platform

Returns

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(system_metadata=False)[source]

Update Recipe

Parameters

system_metadata – bool - True, if you want to change metadata system

Returns

Recipe object

Ontology

class Ontology(client_api: dtlpy.services.api_client.ApiClient, id, creator, url, title, labels, metadata, attributes, recipe=None, dataset=None, project=None, repositories=NOTHING, instance_map=None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Ontology object

add_label(label_name, color=None, children=None, attributes=None, display_label=None, label=None, add=True, icon_path=None, update_ontology=False)[source]

Add a single label to ontology

Parameters
  • label_name – label name

  • color – optional - if not given a random color will be selected

  • children – optional - children

  • attributes – optional - attributes

  • display_label – optional - display_label

  • label – label

  • add – to add or not

  • icon_path – path to image to be display on label

  • update_ontology – update the ontology, default = False for backward compatible

Returns

Label entity

add_labels(label_list, update_ontology=False)[source]

Adds a list of labels to ontology

Parameters
  • label_list – list of labels [{“value”: {“tag”: “tag”, “displayLabel”: “displayLabel”, “color”: “#color”, “attributes”: [attributes]}, “children”: [children]}]

  • update_ontology – update the ontology, default = False for backward compatible

Returns

List of label entities added

delete()[source]

Delete recipe from platform

Returns

True

delete_labels(label_names)[source]

Delete labels from ontology

Parameters

label_names – label object/ label name / list of label objects / list of label names

Returns

classmethod from_json(_json, client_api, recipe, dataset=None, project=None, is_fetched=True)[source]

Build an Ontology entity object from a json

Parameters
  • is_fetched – is Entity fetched from Platform

  • project – project entity

  • dataset – dataset entity

  • _json – _json response from host

  • recipe – ontology’s recipe

  • client_api – ApiClient entity

Returns

Ontology object

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(system_metadata=False)[source]

Update items metadata

Parameters

system_metadata – bool - True, if you want to change metadata system

Returns

Ontology object

update_label(label_name, color=None, children=None, attributes=None, display_label=None, label=None, add=True, icon_path=None, upsert=False, update_ontology=False)[source]

Update a single label to ontology

Parameters
  • label_name – label name

  • color – optional - if not given a random color will be selected

  • children – optional - children

  • attributes – optional - attributes

  • display_label – optional - display_label

  • label – label

  • add – to add or not

  • icon_path – path to image to be display on label

  • upsert – if True will add in case it does not existing

  • update_ontology – update the ontology, default = False for backward compatible

Returns

Label entity

update_labels(label_list, upsert=False, update_ontology=False)[source]

Update a list of labels to ontology

Parameters
  • label_list – list of labels [{“value”: {“tag”: “tag”, “displayLabel”: “displayLabel”, “color”: “#color”, “attributes”: [attributes]}, “children”: [children]}]

  • upsert – if True will add in case it does not existing

  • update_ontology – update the ontology, default = False for backward compatible

Returns

List of label entities added

Label

Task

class Task(name, status, project_id, metadata, id, url, task_owner, item_status, creator, due_date, dataset_id, spec, recipe_id, query, assignmentIds, annotation_status, progress, for_review, issues, updated_at, created_at, available_actions, total_items, client_api, current_assignments=None, assignments=None, project=None, dataset=None, tasks=None, settings=None)[source]

Bases: object

Task object

add_items(filters=None, items=None, assignee_ids=None, workload=None, limit=0, wait=True)[source]

Add items to Task

Parameters
  • filters (dtlpy.entities.filters.Filters) – Filters entity or a dictionary containing filters parameters

  • items – items list for the assignment

  • assignee_ids – list of assignee for the assignment

  • workload – the load of work

  • limit – limit

  • wait – wait the command to finish

Returns

create_assignment(assignment_name, assignee_id, items=None, filters=None)[source]

Create a new assignment

Parameters
  • assignment_name – assignment name

  • assignee_id – list of assignee for the assignment

  • items – items list for the assignment

  • filters (dtlpy.entities.filters.Filters) – Filters entity or a dictionary containing filters parameters

Returns

create_qa_task(due_date, assignee_ids)[source]

Create a new QA Task

Parameters
  • due_date (float) – date to when finish the task

  • assignee_ids (list) – list of assignee

delete(wait=True)[source]

Delete task from platform

Parameters

wait – wait the command to finish

Returns

True

get_items(filters=None)[source]

Get the task items

Parameters

filters (dtlpy.entities.filters.Filters) – Filters entity or a dictionary containing filters parameters

Returns

open_in_web()[source]

Open the task in web platform

Returns

set_status(status: str, operation: str, item_ids: List[str])[source]

Update item status within task

Parameters
  • status – str - string the describes the status

  • operation – str - ‘create’ or ‘delete’

  • item_ids – List[str]

:return : Boolean

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(system_metadata=False)[source]

Update an Annotation Task

Parameters

system_metadata – True, if you want to change metadata system

Assignment

class Assignment(name, annotator, status, project_id, metadata, id, url, task_id, dataset_id, annotation_status, item_status, total_items, for_review, issues, client_api, task=None, assignments=None, project=None, dataset=None, datasets=None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Assignment object

get_items(dataset=None, filters=None)[source]

Get all the items in the assignment

Parameters
Returns

pages of the items

Return type

dtlpy.entities.paged_entities.PagedEntities

open_in_web()[source]

Open the assignment in web platform

Returns

reassign(assignee_id, wait=True)[source]

Reassign an assignment

Parameters
  • assignee_id (str) – the user that assignee the assignment to it

  • wait (bool) – wait the command to finish

Returns

Assignment object

Return type

dtlpy.entities.assignment.Assignment

redistribute(workload, wait=True)[source]

Redistribute an assignment

Parameters
Returns

Assignment object

Return type

dtlpy.entities.assignment.Assignment assignment

set_status(status: str, operation: str, item_id: str)[source]

Set item status within assignment

Parameters
  • status (str) – status

  • operation (str) – created/deleted

  • item_id (str) – item id

Returns

True id success

Return type

bool

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(system_metadata=False)[source]

Update an assignment

Parameters

system_metadata (bool) – True, if you want to change metadata system

Returns

Assignment object

Return type

dtlpy.entities.assignment.Assignment assignment

class Workload(workload: list = NOTHING)[source]

Bases: object

Workload object

add(assignee_id)[source]

add a assignee

Parameters

assignee_id

classmethod generate(assignee_ids, loads=None)[source]

generate the loads for the given assignee :param assignee_ids: :param loads:

class WorkloadUnit(assignee_id: str, load: float = 0)[source]

Bases: object

WorkloadUnit object

Package

class Package(id, url, version, created_at, updated_at, name, codebase, modules, slots: list, ui_hooks, creator, is_global, type, service_config, project_id, project, client_api: dtlpy.services.api_client.ApiClient, revisions=None, repositories=NOTHING, artifacts=None, codebases=None, requirements=None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Package object

checkout()[source]

Checkout as package

Returns

delete()[source]

Delete Package object

Returns

True

deploy(service_name=None, revision=None, init_input=None, runtime=None, sdk_version=None, agent_versions=None, verify=True, bot=None, pod_type=None, module_name=None, run_execution_as_process=None, execution_timeout=None, drain_time=None, on_reset=None, max_attempts=None, force=False, **kwargs)[source]

Deploy package

Parameters
  • service_name (str) – service name

  • revision (str) – package revision - default=latest

  • init_input – config to run at startup

  • runtime (dict) – runtime resources

  • sdk_version (str) –

    • optional - string - sdk version

  • agent_versions (dict) –

    • dictionary - - optional -versions of sdk, agent runner and agent proxy

  • bot (str) – bot email

  • pod_type (str) – pod type dl.InstanceCatalog

  • verify (bool) – verify the inputs

  • module_name (str) – module name

  • run_execution_as_process (bool) – run execution as process

  • execution_timeout (int) – execution timeout

  • drain_time (int) – drain time

  • on_reset (str) – on reset

  • max_attempts (int) – Maximum execution retries in-case of a service reset

  • force (bool) – optional - terminate old replicas immediately

Returns

Service object

classmethod from_json(_json, client_api, project, is_fetched=True)[source]

Turn platform representation of package into a package entity

Parameters
  • _json – platform representation of package

  • client_api – ApiClient entity

  • project – project entity

  • is_fetched – is Entity fetched from Platform

Returns

Package entity

open_in_web()[source]

Open the package in web platform

Returns

pull(version=None, local_path=None)[source]

Push local package

Parameters
  • version – version

  • local_path – local path

Returns

push(codebase: Optional[Union[dtlpy.entities.codebase.GitCodebase, dtlpy.entities.codebase.ItemCodebase]] = None, src_path: Optional[str] = None, package_name: Optional[str] = None, modules: Optional[list] = None, checkout: bool = False, revision_increment: Optional[str] = None, service_update: bool = False, service_config: Optional[dict] = None)[source]

Push local package

Parameters
  • codebase (dtlpy.entities.codebase.Codebase) – PackageCode object - defines how to store the package code

  • checkout – save package to local checkout

  • src_path – location of pacjage codebase folder to zip

  • package_name – name of package

  • modules – list of PackageModule

  • revision_increment – optional - str - version bumping method - major/minor/patch - default = None

  • service_update – optional - bool - update the service

  • service_config – optional - json of service - a service that have config from the main service if wanted

Returns

to_json()[source]

Turn Package entity into a platform representation of Package

Returns

platform json of package

Return type

dict

update()[source]

Update Package changes to platform

Returns

Package entity

class RequirementOperator(value)[source]

Bases: str, enum.Enum

An enumeration.

Package Function

class PackageFunction(outputs=NOTHING, name=NOTHING, description='', inputs=NOTHING, display_name=None, display_icon=None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Webhook object

class PackageInputType(value)[source]

Bases: str, enum.Enum

An enumeration.

Package Module

class PackageModule(name=NOTHING, init_inputs=NOTHING, entry_point='main.py', class_name='ServiceRunner', functions=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

PackageModule object

add_function(function)[source]
Parameters

function

Slot

class PackageSlot(module_name='default_module', function_name='run', display_name=None, display_scopes: Optional[list] = None, display_icon=None, post_action: dtlpy.entities.package_slot.SlotPostAction = NOTHING, default_inputs: Optional[list] = None, input_options: Optional[list] = None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Webhook object

class SlotDisplayScopeResource(value)[source]

Bases: str, enum.Enum

An enumeration.

class SlotPostActionType(value)[source]

Bases: str, enum.Enum

An enumeration.

class UiBindingPanel(value)[source]

Bases: str, enum.Enum

An enumeration.

Codebase

Service

class InstanceCatalog(value)[source]

Bases: str, enum.Enum

An enumeration.

class KubernetesAutuscalerType(value)[source]

Bases: str, enum.Enum

An enumeration.

class OnResetAction(value)[source]

Bases: str, enum.Enum

An enumeration.

class RuntimeType(value)[source]

Bases: str, enum.Enum

An enumeration.

class Service(created_at, updated_at, creator, version, package_id, package_revision, bot, use_user_jwt, init_input, versions, module_name, name, url, id, active, driver_id, secrets, runtime, queue_length_limit, run_execution_as_process: bool, execution_timeout, drain_time, on_reset: dtlpy.entities.service.OnResetAction, project_id, is_global, max_attempts, package, client_api: dtlpy.services.api_client.ApiClient, revisions=None, project=None, repositories=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Service object

activate_slots(project_id: Optional[str] = None, task_id: Optional[str] = None, dataset_id: Optional[str] = None, org_id: Optional[str] = None, user_email: Optional[str] = None, slots=None, role=None, prevent_override: bool = True, visible: bool = True, icon: str = 'fas fa-magic', **kwargs) object[source]

Activate service slots

Parameters
  • project_id (str) – project id

  • task_id (str) – task id

  • dataset_id (str) – dataset id

  • org_id (str) – org id

  • user_email (str) – user email

  • slots (list) – list of entities.PackageSlot

  • role (str) – user role MemberOrgRole.ADMIN, MemberOrgRole.OWNER, MemberOrgRole.MEMBER

  • prevent_override (bool) – prevent override

  • visible (bool) – visible

  • icon (str) – icon

  • kwargs

Returns

List of user setting for activated slots

checkout()[source]

Checkout

Returns

delete()[source]

Delete Service object

Returns

True

execute(execution_input=None, function_name=None, resource=None, item_id=None, dataset_id=None, annotation_id=None, project_id=None, sync=False, stream_logs=True, return_output=True)[source]

Execute a function on an existing service

Parameters
  • execution_input – input dictionary or list of FunctionIO entities

  • function_name – str - function name to run

:param resource:dl.PackageInputType - input type. :param item_id:str - optional - input to function :param dataset_id:str - optional - input to function :param annotation_id:str - optional - input to function :param project_id:str - resource’s project :param sync: bool - wait for function to end :param stream_logs: bool - prints logs of the new execution. only works with sync=True :param return_output: bool - if True and sync is True - will return the output directly :return:

classmethod from_json(_json: dict, client_api: dtlpy.services.api_client.ApiClient, package=None, project=None, is_fetched=True)[source]

Build a service entity object from a json

Parameters
  • _json – platform json

  • client_api – ApiClient entity

  • package – package entity

  • project – project entity

  • is_fetched – is Entity fetched from Platform

Returns

log(size=None, checkpoint=None, start=None, end=None, follow=False, text=None, execution_id=None, function_name=None, replica_id=None, system=False, view=True, until_completed=True)[source]

Get service logs

Parameters
  • size (int) – size

  • checkpoint

  • start – iso format time

  • end – iso format time

  • follow – keep stream future logs

  • text – text

  • execution_id (str) – execution id

  • function_name (str) – function name

  • replica_id (str) – replica id

  • system – system

  • view – view

  • until_completed (bool) – wait until completed

Returns

ServiceLog entity

open_in_web()[source]

Open the service in web platform

Returns

pause()[source]
Returns

resume()[source]
Returns

status()[source]

Get Service status

Returns

True

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update(force=False)[source]

Update Service changes to platform

Parameters

force – force update

Returns

Service entity

Bot

class Bot(created_at, updated_at, name, last_name, username, avatar, email, role, type, org, id, project, client_api=None, users=None, bots=None, password=None)[source]

Bases: dtlpy.entities.user.User

Bot entity

delete()[source]

Delete the bot

Returns

True

Return type

bool

classmethod from_json(_json, project, client_api, bots=None)[source]

Build a Bot entity object from a json

Parameters
  • _json – _json response from host

  • project – project entity

  • client_api – ApiClient entity

  • bots – Bots repository

Returns

User object

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

Trigger

class BaseTrigger(id, url, created_at, updated_at, creator, name, active, type, scope, is_global, input, function_name, service_id, webhook_id, pipeline_id, special, project_id, spec, service, project, client_api: dtlpy.services.api_client.ApiClient, op_type='service', repositories=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Trigger Entity

delete()[source]

Delete Trigger object

Returns

True

classmethod from_json(_json, client_api, project, service=None)[source]

Build a trigger entity object from a json

Parameters
  • _json – platform json

  • client_api – ApiClient entity

  • project – project entity

  • service – service entity

Returns

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update()[source]

Update Trigger object

Returns

Trigger entity

class CronTrigger(id, url, created_at, updated_at, creator, name, active, type, scope, is_global, input, function_name, service_id, webhook_id, pipeline_id, special, project_id, spec, service, project, client_api: dtlpy.services.api_client.ApiClient, op_type='service', repositories=NOTHING, start_at=None, end_at=None, cron=None)[source]

Bases: dtlpy.entities.trigger.BaseTrigger

classmethod from_json(_json, client_api, project, service=None)[source]

Build a trigger entity object from a json

Parameters
  • _json – platform json

  • client_api – ApiClient entity

  • project – project entity

  • service – service entity

Returns

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

class Trigger(id, url, created_at, updated_at, creator, name, active, type, scope, is_global, input, function_name, service_id, webhook_id, pipeline_id, special, project_id, spec, service, project, client_api: dtlpy.services.api_client.ApiClient, op_type='service', repositories=NOTHING, filters=None, execution_mode=TriggerExecutionMode.ONCE, actions=TriggerAction.CREATED, resource=TriggerResource.ITEM)[source]

Bases: dtlpy.entities.trigger.BaseTrigger

Trigger Entity

classmethod from_json(_json, client_api, project, service=None)[source]

Build a trigger entity object from a json

Parameters
  • _json – platform json

  • client_api – ApiClient entity

  • project – project entity

  • service – service entity

Returns

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

class TriggerAction(value)[source]

Bases: str, enum.Enum

An enumeration.

class TriggerExecutionMode(value)[source]

Bases: str, enum.Enum

An enumeration.

class TriggerResource(value)[source]

Bases: str, enum.Enum

An enumeration.

class TriggerType(value)[source]

Bases: str, enum.Enum

An enumeration.

Execution

class Execution(id, url, creator, created_at, updated_at, input, output, feedback_queue, status, status_log, sync_reply_to, latest_status, function_name, duration, attempts, max_attempts, to_terminate: bool, trigger_id, service_id, project_id, service_version, package_id, package_name, client_api: dtlpy.services.api_client.ApiClient, service, project=None, repositories=NOTHING, pipeline: Optional[dict] = None)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Service execution entity

classmethod from_json(_json, client_api, project=None, service=None, is_fetched=True)[source]
Parameters
  • _json – platform json

  • client_api – ApiClient entity

  • project – project entity

  • service

  • is_fetched – is Entity fetched from Platform

increment()[source]

Increment attempts

Returns

logs(follow=False)[source]

Print logs for execution

Parameters

follow – keep stream future logs

progress_update(status: Optional[dtlpy.entities.execution.ExecutionStatus] = None, percent_complete: Optional[int] = None, message: Optional[str] = None, output: Optional[str] = None, service_version: Optional[str] = None)[source]

Update Execution Progress

Parameters
  • status (str) – ExecutionStatus

  • percent_complete (int) – percent complete

  • message (str) – message to update the progress state

  • output (str) – output

  • service_version (str) – service version

Returns

Service execution object

rerun()[source]

Re-run

Returns

Execution object

terminate()[source]

Terminate execution

Returns

execution object

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

update()[source]

Update execution changes to platform

Returns

execution entity

wait()[source]

Wait for execution

Returns

Service execution object

class ExecutionStatus(value)[source]

Bases: str, enum.Enum

An enumeration.

Pipeline

class Pipeline(id, name, creator, org_id, connections, created_at, updated_at, start_nodes, project_id, composition_id, url, preview, description, revisions, info, project, client_api: dtlpy.services.api_client.ApiClient, repositories=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Package object

delete()[source]

Delete pipeline object

Returns

True

execute(execution_input=None)[source]

execute a pipeline and return the execute

Parameters

execution_input – list of the dl.FunctionIO or dict of pipeline input - example {‘item’: ‘item_id’}

Returns

entities.PipelineExecution object

classmethod from_json(_json, client_api, project, is_fetched=True)[source]

Turn platform representation of pipeline into a pipeline entity

Parameters
  • _json – platform representation of package

  • client_api – ApiClient entity

  • project – project entity

  • is_fetched – is Entity fetched from Platform

Returns

Package entity

install()[source]

install pipeline

Returns

Composition entity

open_in_web()[source]

Open the pipeline in web platform

Returns

pause()[source]

pause pipeline

Returns

Composition entity

set_start_node(node: dtlpy.entities.node.PipelineNode)[source]

Set the start node of the pipeline

Parameters

node (PipelineNode) – node to be the start node

to_json()[source]

Turn Package entity into a platform representation of Package

Returns

platform json of package

Return type

dict

update()[source]

Update pipeline changes to platform

Returns

pipeline entity

Pipeline Execution

class PipelineExecution(id, nodes, executions, created_at, updated_at, pipeline_id, pipeline_execution_id, pipeline, client_api: dtlpy.services.api_client.ApiClient, repositories=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Package object

classmethod from_json(_json, client_api, pipeline, is_fetched=True)[source]

Turn platform representation of pipeline_execution into a pipeline_execution entity

Parameters
  • _json – platform representation of package

  • client_api – ApiClient entity

  • pipeline – Pipeline entity

  • is_fetched – is Entity fetched from Platform

Returns

Package entity

to_json()[source]

Turn Package entity into a platform representation of Package

Returns

platform json of package

Return type

dict

Other

Pages

class PagedEntities(client_api: dtlpy.services.api_client.ApiClient, page_offset, page_size, filters, items_repository, has_next_page=False, total_pages_count=0, items_count=0, service_id=None, project_id=None, order_by_type=None, order_by_direction=None, execution_status=None, execution_resource_type=None, execution_resource_id=None, execution_function_name=None, items=[])[source]

Bases: object

Pages object

get_page(page_offset=None, page_size=None)[source]

Get page

Parameters
  • page_offset – page offset

  • page_size – page size

go_to_page(page=0)[source]

Brings specified page of items from host

Parameters

page – page number

Returns

next_page()[source]

Brings the next page of items from host

Returns

prev_page()[source]

Brings the previous page of items from host

Returns

process_result(result)[source]
Parameters

result – json object

return_page(page_offset=None, page_size=None)[source]

Return page

Parameters
  • page_offset – page offset

  • page_size – page size

Base Entity

Command

class Command(id, url, status, created_at, updated_at, type, progress, spec, error, client_api: dtlpy.services.api_client.ApiClient, repositories=NOTHING)[source]

Bases: dtlpy.entities.base_entity.BaseEntity

Com entity

abort()[source]

abort command

Returns

classmethod from_json(_json, client_api, is_fetched=True)[source]

Build a Command entity object from a json

Parameters
  • _json – _json response from host

  • client_api – ApiClient entity

  • is_fetched – is Entity fetched from Platform

Returns

Command object

in_progress()[source]

Check if command is still in one of the in progress statuses

Returns

True if command still in progress

Return type

bool

to_json()[source]

Returns platform _json format of object

Returns

platform json format of object

Return type

dict

wait(timeout=0, step=5)[source]

Wait for Command to finish

Parameters
  • timeout (int) – int, seconds to wait until TimeoutError is raised. if 0 - wait until done

  • step (int) – int, seconds between polling

Returns

Command object

class CommandsStatus(value)[source]

Bases: str, enum.Enum

An enumeration.

Directory Tree

class DirectoryTree(_json)[source]

Bases: object

Dataset DirectoryTree

class SingleDirectory(value, directory_tree, children=None)[source]

Bases: object

DirectoryTree single directory