IssuesApi

class IssuesApi(api)[source]

Bases: ModuleApiBase

API for working with annotation issues and comments.

Parameters:
api

Api object to use for API connection.

Usage Example:
import supervisely as sly
api = sly.Api.from_env()
issues = api.issues.get_list(team_id=1)

Methods

add

Add a new issue and return information about it.

add_comment

Add a comment to the issue with the specified ID.

add_subissue

Add a subissue to the specified issue.

convert_info_to_json

Convert information about an entity to a dictionary.

get_info_by_id

Get information about the issue by its ID.

get_list

Get list of issues in the specified team.

get_list_all_pages

Get list of all or limited quantity entities from the Supervisely server.

get_list_all_pages_generator

This generator function retrieves a list of all or a limited quantity of entities from the Supervisely server, yielding batches of entities as they are retrieved

get_list_idx_page_async

Get the list of items for a given page number.

get_list_page_generator_async

Yields list of images in dataset asynchronously page by page.

info_sequence

Sequence of fields that are returned by the API to represent IssueInfo.

info_tuple_name

Name of the tuple that represents IssueInfo.

remove

Remove the issue by its ID.

update

Update information about the issue.

update_comment

Update the comment with the specified ID.

Attributes

MAX_WAIT_ATTEMPTS

Maximum number of attempts that will be made to wait for a certain condition to be met.

WAIT_ATTEMPT_TIMEOUT_SEC

Number of seconds for intervals between attempts.

InfoType

alias of IssueInfo

classmethod convert_info_to_json(info)

Convert information about an entity to a dictionary.

Parameters:
info : NamedTuple

Information about the entity.

Returns:

Dictionary with information about the entity.

Return type:

dict

static info_sequence()[source]

Sequence of fields that are returned by the API to represent IssueInfo.

static info_tuple_name()[source]

Name of the tuple that represents IssueInfo.

add(team_id, issue_name, comment=None, assignees=None, is_local=False)[source]

Add a new issue and return information about it.

Parameters:
team_id : int

Team ID.

issue_name : str

Name of the issue.

comment : str, optional

Comment for the issue.

assignees : List[int], optional

List of user IDs to assign the issue.

is_local : bool

The local issue will be available only for the members of the team, where it was created. If set to False, the issue will be available for all users from all teams.

Returns:

Information about the added issue.

Return type:

IssueInfo

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

# Add new issue.
new_issue = api.issues.add(team_id=1, issue_name="New issue", comment="Some comment")
add_comment(issue_id, comment)[source]

Add a comment to the issue with the specified ID.

Parameters:
issue_id : int

Issue ID.

comment : str

Comment text.

Returns:

Information about the added comment.

Return type:

CommentInfo

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

# Add a comment to the issue with the specified ID.
comment_info = api.issues.add_comment(issue_id=1, comment="Some comment")
add_subissue(issue_id, image_ids, label_ids, top, left, annotation_info, project_meta)[source]

Add a subissue to the specified issue. Image and label IDs should be the same type, e.g. both int or list of ints. If they are lists, they should have the same length. Annotation info should be an instance of AnnotationInfo, not Annotation, since the second one does not contain required information.

Parameters:
issue_id : int

Issue ID.

image_ids : Union[int, List[int]]

Image ID or list of image IDs to be binded with the issue.

label_ids : Union[int, List[int]]

Label ID or list of label IDs to be binded with the issue.

top : Union[int, float]

Top position of the marker of subissue in the Labeling interface.

left : Union[int, float]

Left position of the marker of subissue in the Labeling interface.

annotation_info

Information about the annotation.

project_meta

Project meta information.

Returns:

None

Return type:

None

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

project_id = 123
image_id = 456
label_id = 789

# Get project meta and annotation info.
project_meta = sly.ProjectMeta.from_json(api.project.get_meta(project_id))
annotation_info = api.annotation.download(image_id)

# Add a subissue to the specified issue.
api.issues.add_subissue(
    issue_id=1,
    image_ids=image_id,
    label_ids=label_id,
    top=100,
    left=100,
    annotation_info=annotation_info,
    project_meta=project_meta
)
get_info_by_id(id)[source]

Get information about the issue by its ID.

Parameters:
id : int

Issue ID.

Returns:

Information about the issue.

Return type:

IssueInfo

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

# Get information about the issue by its ID.
issue_info = api.issues.get_info_by_id(1)
get_list(team_id, filters=None)[source]

Get list of issues in the specified team.

Parameters:
team_id : int

Team ID.

filters : List[Dict[str, str]], optional

List of filters to apply to the list of issues.

Returns:

List of issues.

Return type:

List[IssueInfo]

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

# Get list of issues in specified team.
issues = api.issues.get_list(team_id=1)
get_list_all_pages(method, data, progress_cb=None, convert_json_info_cb=None, limit=None, return_first_response=False)

Get list of all or limited quantity entities from the Supervisely server.

Parameters:
method : str

Request method name

data : dict

Dictionary with request body info

progress_cb : Progress, optional

Function for tracking download progress.

convert_json_info_cb : Callable, optional

Function for convert json info

limit : int, optional

Number of entity to retrieve

return_first_response : bool, optional

Specify if return first response

Returns:

List of entities.

Return type:

List[dict]

get_list_all_pages_generator(method, data, progress_cb=None, convert_json_info_cb=None, limit=None, return_first_response=False)

This generator function retrieves a list of all or a limited quantity of entities from the Supervisely server, yielding batches of entities as they are retrieved

Parameters:
method : str

Request method name

data : dict

Dictionary with request body info

progress_cb : Progress, optional

Function for tracking download progress.

convert_json_info_cb : Callable, optional

Function for convert json info

limit : int, optional

Number of entity to retrieve

return_first_response : bool, optional

Specify if return first response

async get_list_idx_page_async(method, data)

Get the list of items for a given page number. Page number is specified in the data dictionary.

Parameters:
method : str

Method to call for listing items.

data : dict

Data to pass to the API method.

Returns:

List of items.

Return type:

Tuple[int, List[NamedTuple]]

async get_list_page_generator_async(method, data, pages_count=None, semaphore=None)

Yields list of images in dataset asynchronously page by page.

Parameters:
method : str

Method to call for listing items.

data : dict

Data to pass to the API method.

pages_count : int, optional

Preferred number of pages to retrieve if used with a per_page limit. Will be automatically adjusted if the pagesCount differs from the requested number.

semaphore=None

Semaphore for limiting the number of simultaneous requests.

Returns:

List of images in dataset.

Return type:

AsyncGenerator[List[ImageInfo]]

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

method = 'images.list'
data = {'datasetId': 123456}

loop = sly.utils.get_or_create_event_loop()
images = loop.run_until_complete(api.image.get_list_generator_async(method, data))
remove(issue_id)[source]

Remove the issue by its ID. NOTE: This operation is irreversible.

Parameters:
issue_id : int

Issue ID.

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

# Remove the issue by its ID.
api.issues.remove(issue_id=1)
update(issue_id, issue_name=None, status=None, is_pinned=None)[source]

Update information about the issue.

Parameters:
issue_id : int

Issue ID.

issue_name : str, optional

New name of the issue.

status : str, optional

New status of the issue.

is_pinned : bool, optional

Whether the issue is pinned.

Raises:

ValueError – if the status is incorrect. Expected one of [“open”, “closed”], got {status}

Returns:

Information about the issue.

Return type:

IssueInfo

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

# Update information about the issue.
updated_issue = api.issues.update(issue_id=1, issue_name="Updated issue name")
update_comment(comment_id, comment)[source]

Update the comment with the specified ID.

Parameters:
comment_id : int

Comment ID.

comment : str

New comment text.

Returns:

Information about the updated comment.

Return type:

CommentInfo

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

# Update the comment with the specified ID.
api.issues.update_comment(comment_id=1, comment="Updated comment")