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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Changelog

# Version 3.21.0 (in progress)
# Version 3.21.0
## Added
* Projects can be created with a `media_type`
* Added `media_type` attribute to `Project`
* New `MediaType` enumeration

## Fix
* Added back the mimetype to datarow bulk uploads for orgs that require delegated access

# Version 3.20.1 (2022-05-02)
## Updated
* Ontology Classification `scope` field is only set for top level classifications
Expand Down
4 changes: 2 additions & 2 deletions labelbox/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name = "labelbox"
__version__ = "3.20.1"
__version__ = "3.21.0"

import sys
import warnings

if sys.version_info < (3, 7):
warnings.warn("""Python 3.6 will no longer be actively supported
warnings.warn("""Python 3.6 will no longer be actively supported
starting 06/01/2022. Please upgrade to Python 3.7 or higher.""")

from labelbox.client import Client
Expand Down
4 changes: 3 additions & 1 deletion labelbox/schema/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ def convert_item(item):
items = [future.result() for future in as_completed(futures)]
# Prepare and upload the desciptor file
data = json.dumps(items)
return self.client.upload_data(data)
return self.client.upload_data(data,
content_type="application/json",
filename="json_import.json")

def data_rows_for_external_id(self,
external_id,
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,19 @@ def test_data_row_export(dataset, image_url):
result = list(dataset.export_data_rows())
assert len(result) == n_data_rows
assert set(result) == ids


def test_create_descriptor_file(dataset):
import unittest.mock as mock
with mock.patch.object(dataset.client,
'upload_data',
wraps=dataset.client.upload_data) as upload_data_spy:
dataset._create_descriptor_file(items=[{'row_data': 'some text...'}])
upload_data_spy.assert_called()
call_args, call_kwargs = upload_data_spy.call_args_list[0][
0], upload_data_spy.call_args_list[0][1]
assert call_args == ('[{"data": "some text..."}]',)
assert call_kwargs == {
'content_type': 'application/json',
'filename': 'json_import.json'
}