Skip to content

Commit 2f6aab9

Browse files
authored
Merge pull request #363 from Labelbox/ms/3.11.0-dev
3.11.0-dev
2 parents c6b9b32 + 58753c5 commit 2f6aab9

File tree

8 files changed

+21
-49
lines changed

8 files changed

+21
-49
lines changed

CHANGELOG.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# Changelog
22

3-
## Deprecation Notice
4-
| Name | Replacement | Removed After |
5-
| ------------------------------------- | ------------------------------------- | ------------- |
6-
| `ModelRun.delete_annotation_groups()` | `ModelRun.delete_model_run_data_rows()`| 2021-12-06 |
7-
| `ModelRun.annotation_groups()` | `ModelRun.model_run_data_rows()` | 2021-12-06 |
8-
| `DataRowMetadataSchema.id` | `DataRowMetadataSchema.uid` | 2021-12-06 |
9-
-----
3+
# Version 3.11.0 (2021-12-15)
4+
5+
## Fix
6+
* `Dataset.create_data_rows()` now accepts an iterable of data row information instead of a list
7+
* `project.upsert_instructions()`
8+
* now only supports pdfs since that is what the editor requires
9+
* There was a bug that could cause this to modify the project ontology
10+
11+
## Removed
12+
* `DataRowMetadataSchema.id` use `DataRowMetadataSchema.uid` instead
13+
* `ModelRun.delete_annotation_groups()` use `ModelRun.delete_model_run_data_rows()` instead
14+
* `ModelRun.annotation_groups()` use `ModelRun.model_run_data_rows()` instead
1015

1116
# Version 3.10.0 (2021-11-18)
1217
## Added

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
copyright = '2021, Labelbox'
2222
author = 'Labelbox'
2323

24-
release = '3.10.0'
24+
release = '3.11.0'
2525

2626
# -- General configuration ---------------------------------------------------
2727

labelbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "labelbox"
2-
__version__ = "3.10.0"
2+
__version__ = "3.11.0"
33

44
from labelbox.schema.project import Project
55
from labelbox.client import Client

labelbox/schema/data_row_metadata.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ class DataRowMetadataSchema(BaseModel):
3030
options: Optional[List["DataRowMetadataSchema"]]
3131
parent: Optional[SchemaId]
3232

33-
@property
34-
def id(self):
35-
""" DataRowMetadataSchema.id will be removed after 2021-12-06
36-
use DataRowMetadataSchema.uid instead
37-
"""
38-
warnings.warn(
39-
"DataRowMetadataSchema.id will be removed after 2021-12-06 "
40-
"use DataRowMetadataSchema.uid instead")
41-
return self.uid
42-
4333

4434
DataRowMetadataSchema.update_forward_refs()
4535

labelbox/schema/model_run.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from pathlib import Path
33
import os
44
import time
5-
import warnings
65

76
from labelbox.pagination import PaginatedCollection
87
from labelbox.schema.annotation_import import MEAPredictionImport
@@ -144,15 +143,6 @@ def model_run_data_rows(self):
144143
lambda client, res: ModelRunDataRow(client, self.model_id, res),
145144
['annotationGroups', 'pageInfo', 'endCursor'])
146145

147-
def annotation_groups(self):
148-
""" `ModelRun.annotation_groups will be removed after 2021-12-06
149-
use ModelRun.model_run_data_rows instead`
150-
"""
151-
warnings.warn(
152-
"`ModelRun.annotation_groups` will be removed after 2021-12-06 use "
153-
"`ModelRun.model_run_data_rows` instead")
154-
return self.model_run_data_rows()
155-
156146
def delete(self):
157147
""" Deletes specified model run.
158148
@@ -183,15 +173,6 @@ def delete_model_run_data_rows(self, data_row_ids):
183173
data_row_ids_param: data_row_ids
184174
})
185175

186-
def delete_annotation_groups(self, data_row_ids):
187-
""" `ModelRun.delete_annotation_groups will be removed after 2021-12-06
188-
use ModelRun.delete_model_run_data_rows instead`
189-
"""
190-
warnings.warn(
191-
"`ModelRun.delete_annotation_groups` will be removed after 2021-12-06 use "
192-
"`ModelRun.delete_model_run_data_rows` instead")
193-
return self.delete_model_run_data_rows(data_row_ids)
194-
195176

196177
class ModelRunDataRow(DbObject):
197178
label_id = Field.String("label_id")

labelbox/schema/project.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,12 @@ def upsert_instructions(self, instructions_file: str):
317317
318318
Args:
319319
instructions_file (str): Path to a local file.
320-
* Must be either a pdf, text, or html file.
320+
* Must be a pdf file
321321
322322
Raises:
323323
ValueError:
324324
* project must be setup
325-
* instructions file must end with one of ".text", ".txt", ".pdf", ".html"
325+
* instructions file must have a ".pdf" extension
326326
"""
327327

328328
if self.setup_complete is None:
@@ -338,11 +338,10 @@ def upsert_instructions(self, instructions_file: str):
338338
f"This function has only been tested to work with the Editor front end. Found %s",
339339
frontend.name)
340340

341-
supported_instruction_formats = (".text", ".txt", ".pdf", ".html")
341+
supported_instruction_formats = (".pdf")
342342
if not instructions_file.endswith(supported_instruction_formats):
343343
raise ValueError(
344-
f"instructions_file must end with one of {supported_instruction_formats}. Found {instructions_file}"
345-
)
344+
f"instructions_file must be a pdf. Found {instructions_file}")
346345

347346
lfo = list(self.labeling_frontend_options())[-1]
348347
instructions_url = self.client.upload_file(instructions_file)
14.5 KB
Binary file not shown.

tests/integration/test_project.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_extend_reservations(project):
7979

8080
def test_attach_instructions(client, project):
8181
with pytest.raises(ValueError) as execinfo:
82-
project.upsert_instructions('/tmp/instructions.txt')
82+
project.upsert_instructions('tests/integration/media/sample_pdf.pdf')
8383
assert str(
8484
execinfo.value
8585
) == "Cannot attach instructions to a project that has not been set up."
@@ -90,17 +90,14 @@ def test_attach_instructions(client, project):
9090
empty_ontology = {"tools": [], "classifications": []}
9191
project.setup(editor, empty_ontology)
9292

93-
with open('/tmp/instructions.txt', 'w') as file:
94-
file.write("some instructions...")
95-
96-
project.upsert_instructions('/tmp/instructions.txt')
93+
project.upsert_instructions('tests/integration/media/sample_pdf.pdf')
9794
assert json.loads(
9895
list(project.labeling_frontend_options())
9996
[-1].customization_options).get('projectInstructions') is not None
10097

10198
with pytest.raises(ValueError) as exc_info:
10299
project.upsert_instructions('/tmp/file.invalid_file_extension')
103-
assert "instructions_file must end with one of" in str(exc_info.value)
100+
assert "instructions_file must be a pdf. Found" in str(exc_info.value)
104101

105102

106103
def test_same_ontology_after_instructions(

0 commit comments

Comments
 (0)