Skip to content

Commit 685b23e

Browse files
authored
Merge pull request #257 from Labelbox/develop
3.1.0
2 parents 6f1f0c2 + ebc9bf5 commit 685b23e

File tree

16 files changed

+431
-903
lines changed

16 files changed

+431
-903
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
# Version 3.1.0 (2021-08-18)
4+
## Added
5+
* Support for new HTML attachment type
6+
* Delete Bulk Import Requests with `BulkImportRequest.delete()`
7+
8+
## Misc
9+
* Updated MEAPredictionImport class to use latest grapqhql endpoints
10+
11+
312
# Version 3.0.1 (2021-08-12)
413
## Fix
514
* Issue with inferring text type from export

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
build:
33
docker build -t local/labelbox-python:test .
44

5+
6+
test-local: build
7+
docker run -it -v ${PWD}:/usr/src -w /usr/src \
8+
-e LABELBOX_TEST_ENVIRON="local" \
9+
-e LABELBOX_TEST_API_KEY_LOCAL=${LABELBOX_TEST_API_KEY_LOCAL} \
10+
local/labelbox-python:test pytest $(PATH_TO_TEST) -svvx
11+
512
test-staging: build
613
docker run -it -v ${PWD}:/usr/src -w /usr/src \
714
-e LABELBOX_TEST_ENVIRON="staging" \

README.md

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ If the installation completes with a warning re: pip not being in your path, you
3535
export PATH=/Users/<your-macOS-username>/Library/Python/3.8/bin:$PATH
3636
```
3737

38-
Install using Python's Pip manager.
38+
Install SDK locally, using Python's Pip manager
3939
```
40-
pip install labelbox
40+
pip3 install -e .
41+
```
42+
43+
Install dependencies
44+
```
45+
pip3 install -r requirements.txt
4146
```
4247
To install dependencies required for data processing modules use:
4348
```
@@ -55,29 +60,48 @@ pip install labelbox[data]
5560
Labelbox uses API keys to validate requests. You can create and manage API keys on [Labelbox](https://app.labelbox.com/account/api-keys). Pass your API key as an environment variable. Then, import and initialize the API Client.
5661

5762
```
58-
user@machine:~$ export LABELBOX_API_KEY="<your api key here>"
63+
user@machine:~$ export LABELBOX_API_KEY="<your local api key here>"
5964
user@machine:~$ python3
6065
6166
from labelbox import Client
6267
client = Client()
6368
```
69+
* Update api_key and endpoint if not using the production cloud deployment
70+
```
71+
# On prem
72+
client = Client( endpoint = "<local deployment>")
73+
74+
# Local
75+
client = Client(api_key=os.environ['LABELBOX_TEST_API_KEY_LOCAL'], endpoint="http://localhost:8080/graphql")
76+
77+
# Staging
78+
client = Client(api_key=os.environ['LABELBOX_TEST_API_KEY_LOCAL'], endpoint="https://staging-api.labelbox.com/graphql")
79+
```
6480

6581
## Contribution
6682
Please consult `CONTRIB.md`
6783

6884
## Testing
69-
1. Update the `Makefile` with your `staging` or `prod` API key. Ensure that docker has been installed on your system. Make sure the key is not from a free tier account.
70-
2. To test on `staging`:
85+
1. Update the `Makefile` with your `local`, `staging`, `prod` API key. Ensure that docker has been installed on your system. Make sure the key is not from a free tier account.
86+
2. To test on `local`:
87+
```
88+
user@machine:~$ export LABELBOX_TEST_API_KEY_LOCAL="<your local api key here>"
89+
make test-local # with an optional flag: PATH_TO_TEST=tests/integration/...etc LABELBOX_TEST_API_KEY_LOCAL=specify_here_or_export_me
90+
```
91+
92+
3. To test on `staging`:
7193
```
72-
make test-staging
94+
user@machine:~$ export LABELBOX_TEST_API_KEY_STAGING="<your staging api key here>"
95+
make test-staging # with an optional flag: PATH_TO_TEST=tests/integration/...etc LABELBOX_TEST_API_KEY_STAGING=specify_here_or_export_me
7396
```
7497

75-
3. To test on `prod`:
98+
4. To test on `prod`:
7699
```
77-
make test-prod
100+
user@machine:~$ export LABELBOX_TEST_API_KEY_PROD="<your prod api key here>"
101+
make test-prod # with an optional flag: PATH_TO_TEST=tests/integration/...etc LABELBOX_TEST_API_KEY_PROD=specify_here_or_export_me
78102
```
79103

80-
4. If you make any changes and need to rebuild the image used for testing, force a rebuild with the `-B` flag
104+
5. If you make any changes and need to rebuild the image used for testing, force a rebuild with the `-B` flag
81105
```
82-
make -B {build|test-staging|test_prod}
106+
make -B {build|test-staging|test-prod}
83107
```

examples/model_assisted_labeling/ner_mal.ipynb

Lines changed: 13 additions & 5 deletions
Large diffs are not rendered by default.

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.0.1"
2+
__version__ = "3.1.0"
33

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

labelbox/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ def check_errors(keywords, *path):
195195
return error
196196
return None
197197

198+
def get_error_status_code(error):
199+
return error["extensions"]["exception"]["status"]
200+
198201
if check_errors(["AUTHENTICATION_ERROR"], "extensions",
199202
"code") is not None:
200203
raise labelbox.exceptions.AuthenticationError("Invalid API key")
@@ -242,7 +245,7 @@ def check_errors(keywords, *path):
242245
if internal_server_error is not None:
243246
message = internal_server_error.get("message")
244247

245-
if message.startswith(("Syntax Error", "Invite(s) cannot be sent")):
248+
if get_error_status_code(internal_server_error) == 400:
246249
raise labelbox.exceptions.InvalidQueryError(message)
247250
else:
248251
raise labelbox.exceptions.InternalServerError(message)

0 commit comments

Comments
 (0)