IssuesApi

class IssuesApi[source]

Bases: supervisely.api.module_api.ModuleApiBase

Class for working with issues in Supervisely.

Parameters
api : Api

API connection to the server.

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 information about issue by its ID. issue_info = api.issues.get_info_by_id(id=1)

# Add new issue. new_issue = api.issues.add(team_id=1, issue_name=”New issue”, comment=”Some comment”)

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_info_to_json

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

List 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 supervisely.api.module_api.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 sly.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 : AnnotationInfo

Information about the annotation.

project_meta : ProjectMeta

Project meta information.

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
)
Return type

None

classmethod convert_info_to_json(info)

_convert_info_to_json

Return type

Dict

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

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 : asyncio.Semaphore, optional

Semaphore for limiting the number of simultaneous requests.

kwargs

Additional arguments.

Returns

List of images in dataset.

Return type

AsyncGenerator[List[ImageInfo]]

Usage example
import supervisely as sly
import asyncio

os.environ['SERVER_ADDRESS'] = 'https://app.supervisely.com'
os.environ['API_TOKEN'] = 'Your Supervisely API Token'
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))
static info_sequence()[source]

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

static info_tuple_name()[source]

Name of the tuple that represents IssueInfo.

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)
Return type

None

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.

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")