Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Changelog
# Version 3.61.0 (2024-01-22)
# Added
* `ModelSlice.get_data_row_identifiers`
* Fetches all data row ids and global keys for the model slice
* NOTE Foundry model slices are note supported yet
## Updated
* Updated exports v1 deprecation date to April 30th, 2024
* Remove `streamable` param from export_v2 methods

# Version 3.60.0 (2024-01-17)
## Added
* Get resource tags from a project
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
copyright = '2021, Labelbox'
author = 'Labelbox'

release = '3.60.0'
release = '3.61.0'

# -- General configuration ---------------------------------------------------

Expand Down
16 changes: 4 additions & 12 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,19 +203,11 @@ ResourceTag
:members:
:show-inheritance:

Slice
-----------------------------------------

.. automodule:: labelbox.schema.slice
:members: Slice
:exclude-members: CatalogSlice
:show-inheritance:

CatalogSlice
-----------------------------------------
.. automodule:: labelbox.schema.slice
:members: CatalogSlice
:exclude-members: Slice
Slice
---------------------------
.. automodule:: labelbox.schema.slices
:members:
:show-inheritance:

QualityMode
Expand Down
8 changes: 4 additions & 4 deletions examples/basics/Export_V1_to_V2_migration_support.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{
"metadata": {},
"source": [
"**Export V1 will no longer be available in any version of the SDK starting on April 20, 2024**. We recommend users to plan accordingly. \n",
"**Export V1 will no longer be available in any version of the SDK starting on April 2024**. We recommend users to plan accordingly. \n",
"\n",
"This notebook is designed to help users identify alternative V2 export methods that can serve as replacements for V1 methods."
],
Expand All @@ -51,9 +51,9 @@
"source": [
"### Key changes included in export V2 methods (``export_v2()`` and ``export()``):\n",
"1. Added flexibility to only export the data that is needed. The new methods include parameters and filters to give you more granular control over your exports.\n",
"2. Added functionality to stream your data export. \n",
"2. Added functionality to stream your data export using ``export()`` (available on SDK >=3.56)\n",
"\n",
"For complete details on how to use exports V2 please see the [Export overview](https://docs.labelbox.com/reference/label-export#optional-parameters-and-filters) documentation."
"For complete details on how to use export V2 methods please see the [Export V2 methods](https://docs.labelbox.com/reference/label-export#export-v2-methods) documentation."
],
"cell_type": "markdown"
},
Expand Down Expand Up @@ -198,7 +198,7 @@
" name='bounding_box',\n",
" feature_schema_id='clrf5ck4a0b9b071paa9ncu15',\n",
" extra={\n",
" 'instanceURI': 'https://api.labelbox.com/masks/feature/clrf5csvi6ofm07lsf9pygwvi?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbGh0OHNocXUweW53MDc0aWRuZDUyemd1Iiwib3JnYW5pemF0aW9uSWQiOiJjbDVibjhxdnExYXY5MDd4dGIzYnA4cTYwIiwiaWF0IjoxNzA1NDMxOTE3LCJleHAiOjE3MDgwMjM5MTd9.BSKLVSbKTNmp9tcYt-PncIBeZ2Hrw4kCOz3qyxvAoOY',\n",
" 'instanceURI': 'https://api.labelbox.com/masks/feature/clrf5csvi6ofm07lsf9pygwvi?token=<token>'\n",
" 'color': '#ff0000',\n",
" 'feature_id': 'clrf5csvi6ofm07lsf9pygwvi',\n",
" 'value': 'bounding_box',\n",
Expand Down
2 changes: 1 addition & 1 deletion labelbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "labelbox"

__version__ = "3.60.0"
__version__ = "3.61.0"

from labelbox.client import Client
from labelbox.schema.project import Project
Expand Down
4 changes: 4 additions & 0 deletions labelbox/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,10 @@ def get_model_slice(self, slice_id) -> ModelSlice:
}
"""
res = self.execute(query_str, {"id": slice_id})
if res is None or res["getSavedQuery"] is None:
raise labelbox.exceptions.ResourceNotFoundError(
ModelSlice, slice_id)

return Entity.ModelSlice(self, res["getSavedQuery"])

def delete_feature_schema_from_ontology(
Expand Down
2 changes: 1 addition & 1 deletion labelbox/schema/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def export_data_rows(self,
LabelboxError: if the export fails or is unable to download within the specified time.
"""
warnings.warn(
"You are currently utilizing exports v1 for this action, which will be deprecated after December 31st, 2023. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
"You are currently utilizing exports v1 for this action, which will be deprecated after April 30th, 2024. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
DeprecationWarning)

id_param = "batchId"
Expand Down
24 changes: 17 additions & 7 deletions labelbox/schema/data_row.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ def export(
>>> task.wait_till_done()
>>> task.result
"""
task = DataRow.export_v2(client,
data_rows,
global_keys,
task_name,
params,
streamable=True)
task = DataRow._export(client,
data_rows,
global_keys,
task_name,
params,
streamable=True)
return ExportTask(task)

@staticmethod
Expand All @@ -203,7 +203,6 @@ def export_v2(
global_keys: Optional[List[str]] = None,
task_name: Optional[str] = None,
params: Optional[CatalogExportParams] = None,
streamable: bool = False,
) -> Task:
"""
Creates a data rows export task with the given list, params and returns the task.
Expand All @@ -228,7 +227,18 @@ def export_v2(
>>> task.wait_till_done()
>>> task.result
"""
return DataRow._export(client, data_rows, global_keys, task_name,
params)

@staticmethod
def _export(
client: "Client",
data_rows: Optional[List[Union[str, "DataRow"]]] = None,
global_keys: Optional[List[str]] = None,
task_name: Optional[str] = None,
params: Optional[CatalogExportParams] = None,
streamable: bool = False,
) -> Task:
_params = params or CatalogExportParams({
"attachments": False,
"metadata_fields": False,
Expand Down
13 changes: 10 additions & 3 deletions labelbox/schema/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def export_data_rows(self,
LabelboxError: if the export fails or is unable to download within the specified time.
"""
warnings.warn(
"You are currently utilizing exports v1 for this action, which will be deprecated after December 31st, 2023. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
"You are currently utilizing exports v1 for this action, which will be deprecated after April 30th, 2024. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
DeprecationWarning)
id_param = "datasetId"
metadata_param = "includeMetadataInput"
Expand Down Expand Up @@ -619,15 +619,14 @@ def export(
>>> task.wait_till_done()
>>> task.result
"""
task = self.export_v2(task_name, filters, params, streamable=True)
task = self._export(task_name, filters, params, streamable=True)
return ExportTask(task)

def export_v2(
self,
task_name: Optional[str] = None,
filters: Optional[DatasetExportFilters] = None,
params: Optional[CatalogExportParams] = None,
streamable: bool = False,
) -> Task:
"""
Creates a dataset export task with the given params and returns the task.
Expand All @@ -646,7 +645,15 @@ def export_v2(
>>> task.wait_till_done()
>>> task.result
"""
return self._export(task_name, filters, params)

def _export(
self,
task_name: Optional[str] = None,
filters: Optional[DatasetExportFilters] = None,
params: Optional[CatalogExportParams] = None,
streamable: bool = False,
) -> Task:
_params = params or CatalogExportParams({
"attachments": False,
"metadata_fields": False,
Expand Down
17 changes: 12 additions & 5 deletions labelbox/schema/model_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def export_labels(
None is returned.
"""
warnings.warn(
"You are currently utilizing exports v1 for this action, which will be deprecated after December 31st, 2023. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
"You are currently utilizing exports v1 for this action, which will be deprecated after April 30th, 2024. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
DeprecationWarning)
sleep_time = 2
query_str = """mutation exportModelRunAnnotationsPyApi($modelRunId: ID!) {
Expand Down Expand Up @@ -518,21 +518,28 @@ def export(self,
>>> export_task = export("my_export_task", params={"media_attributes": True})

"""
task = self.export_v2(task_name, params, streamable=True)
task = self._export(task_name, params, streamable=True)
return ExportTask(task)

def export_v2(
self,
task_name: Optional[str] = None,
params: Optional[ModelRunExportParams] = None,
streamable: bool = False,
) -> Task:
"""
Creates a model run export task with the given params and returns the task.

>>> export_task = export_v2("my_export_task", params={"media_attributes": True})

"""
return self._export(task_name, params)

def _export(
self,
task_name: Optional[str] = None,
params: Optional[ModelRunExportParams] = None,
streamable: bool = False,
) -> Task:
mutation_name = "exportDataRowsInModelRun"
create_task_query_str = (
f"mutation {mutation_name}PyApi"
Expand All @@ -541,7 +548,7 @@ def export_v2(

_params = params or ModelRunExportParams()

queryParams = {
query_params = {
"input": {
"taskName": task_name,
"filters": {
Expand All @@ -563,7 +570,7 @@ def export_v2(
}
}
res = self.client.execute(create_task_query_str,
queryParams,
query_params,
error_log_key="errors")
res = res[mutation_name]
task_id = res["taskId"]
Expand Down
15 changes: 11 additions & 4 deletions labelbox/schema/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def export_queued_data_rows(
LabelboxError: if the export fails or is unable to download within the specified time.
"""
warnings.warn(
"You are currently utilizing exports v1 for this action, which will be deprecated after December 31st, 2023. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
"You are currently utilizing exports v1 for this action, which will be deprecated after April 30th, 2024. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
DeprecationWarning)
id_param = "projectId"
metadata_param = "includeMetadataInput"
Expand Down Expand Up @@ -377,7 +377,7 @@ def export_labels(self,
generate during the `timeout_seconds` period, None is returned.
"""
warnings.warn(
"You are currently utilizing exports v1 for this action, which will be deprecated after December 31st, 2023. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
"You are currently utilizing exports v1 for this action, which will be deprecated after April 30th, 2024. We recommend transitioning to exports v2. To view export v2 details, visit our docs: https://docs.labelbox.com/reference/label-export",
DeprecationWarning)

def _string_from_dict(dictionary: dict, value_with_quotes=False) -> str:
Expand Down Expand Up @@ -477,15 +477,14 @@ def export(
>>> task.wait_till_done()
>>> task.result
"""
task = self.export_v2(task_name, filters, params, streamable=True)
task = self._export(task_name, filters, params, streamable=True)
return ExportTask(task)

def export_v2(
self,
task_name: Optional[str] = None,
filters: Optional[ProjectExportFilters] = None,
params: Optional[ProjectExportParams] = None,
streamable: bool = False,
) -> Task:
"""
Creates a project export task with the given params and returns the task.
Expand All @@ -506,7 +505,15 @@ def export_v2(
>>> task.wait_till_done()
>>> task.result
"""
return self._export(task_name, filters, params)

def _export(
self,
task_name: Optional[str] = None,
filters: Optional[ProjectExportFilters] = None,
params: Optional[ProjectExportParams] = None,
streamable: bool = False,
) -> Task:
_params = params or ProjectExportParams({
"attachments": False,
"metadata_fields": False,
Expand Down
Loading