Skip to content

Commit 6ca7fe9

Browse files
Added notebook workflow to remove metadata through ci (#1612)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent b7aa2f6 commit 6ca7fe9

File tree

12 files changed

+67
-415
lines changed

12 files changed

+67
-415
lines changed

.github/workflows/notebooks.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Labelbox Python SDK Notebooks (Develop)
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
paths:
7+
- examples/**
8+
pull_request:
9+
branches: [develop]
10+
paths:
11+
- examples/**
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
jobs:
18+
update:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
ref: ${{ github.head_ref }}
24+
fetch-depth: 0
25+
- name: Install databooks
26+
run: pip install databooks
27+
- name: Remove notebook metadata
28+
run: echo "y" | databooks meta examples/. --rm-outs
29+
- name: Commit changes
30+
run: |
31+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
32+
git config --local user.name "github-actions[bot]"
33+
git add examples/.
34+
git commit -m "Removed metadata" || exit 0
35+
- name: Push changes
36+
uses: ad-m/github-push-action@master
37+
with:
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
branch: ${{ github.head_ref }}

examples/annotation_import/audio.ipynb

Lines changed: 6 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,7 @@
7878
"!pip install -q 'labelbox[data]'"
7979
],
8080
"cell_type": "code",
81-
"outputs": [
82-
{
83-
"output_type": "stream",
84-
"name": "stdout",
85-
"text": [
86-
"\n",
87-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.0.1\u001b[0m\n",
88-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
89-
]
90-
}
91-
],
81+
"outputs": [],
9282
"execution_count": null
9383
},
9484
{
@@ -240,16 +230,7 @@
240230
"print(\"Failed data rows: \", task.failed_data_rows)"
241231
],
242232
"cell_type": "code",
243-
"outputs": [
244-
{
245-
"output_type": "stream",
246-
"name": "stdout",
247-
"text": [
248-
"Errors: None\n",
249-
"Failed data rows: None\n"
250-
]
251-
}
252-
],
233+
"outputs": [],
253234
"execution_count": null
254235
},
255236
{
@@ -316,15 +297,7 @@
316297
"project.setup_editor(ontology) # Connect your ontology and editor to your project"
317298
],
318299
"cell_type": "code",
319-
"outputs": [
320-
{
321-
"output_type": "stream",
322-
"name": "stderr",
323-
"text": [
324-
"Default createProject behavior will soon be adjusted to prefer batch projects. Pass in `queue_mode` parameter explicitly to opt-out for the time being.\n"
325-
]
326-
}
327-
],
300+
"outputs": [],
328301
"execution_count": null
329302
},
330303
{
@@ -349,22 +322,7 @@
349322
"print(\"Batch: \", batch)"
350323
],
351324
"cell_type": "code",
352-
"outputs": [
353-
{
354-
"output_type": "stream",
355-
"name": "stdout",
356-
"text": [
357-
"Batch: <Batch {\n",
358-
" \"consensus_settings_json\": \"{\\\"numberOfLabels\\\":1,\\\"coveragePercentage\\\":0}\",\n",
359-
" \"created_at\": \"2023-03-28 18:22:33+00:00\",\n",
360-
" \"name\": \"first-batch-audio-demo\",\n",
361-
" \"size\": 0,\n",
362-
" \"uid\": \"81f8c9a0-cd95-11ed-872d-bb648b922b15\",\n",
363-
" \"updated_at\": \"2023-03-28 18:22:33+00:00\"\n",
364-
"}>\n"
365-
]
366-
}
367-
],
325+
"outputs": [],
368326
"execution_count": null
369327
},
370328
{
@@ -462,16 +420,7 @@
462420
"print(\"Status of uploads: \", upload_job.statuses)"
463421
],
464422
"cell_type": "code",
465-
"outputs": [
466-
{
467-
"output_type": "stream",
468-
"name": "stdout",
469-
"text": [
470-
"Errors: []\n",
471-
"Status of uploads: [{'uuid': '40aea601-206f-491c-8bcc-675205dbb351', 'dataRow': {'id': 'clfsl56ww5uyi078ldbojeqby', 'globalKey': 'sample-audio-1.mp3'}, 'status': 'SUCCESS'}, {'uuid': '51c43a0e-a54b-4ee3-94c1-7ccdebe81f98', 'dataRow': {'id': 'clfsl56ww5uyi078ldbojeqby', 'globalKey': 'sample-audio-1.mp3'}, 'status': 'SUCCESS'}, {'uuid': '380273f0-4ed4-4d0a-959a-06659f5edf88', 'dataRow': {'id': 'clfsl56ww5uyi078ldbojeqby', 'globalKey': 'sample-audio-1.mp3'}, 'status': 'SUCCESS'}]\n"
472-
]
473-
}
474-
],
423+
"outputs": [],
475424
"execution_count": null
476425
},
477426
{
@@ -496,16 +445,7 @@
496445
"print(\"Status of uploads: \", upload_job.statuses)"
497446
],
498447
"cell_type": "code",
499-
"outputs": [
500-
{
501-
"output_type": "stream",
502-
"name": "stdout",
503-
"text": [
504-
"Errors: []\n",
505-
"Status of uploads: [{'uuid': '1e555dd0-3916-4cfb-97be-79f9607da01a', 'dataRow': {'id': 'clfsl56ww5uyi078ldbojeqby', 'globalKey': 'sample-audio-1.mp3'}, 'status': 'SUCCESS'}, {'uuid': 'fe805388-d313-45ea-b3bc-1a7f5ffa0980', 'dataRow': {'id': 'clfsl56ww5uyi078ldbojeqby', 'globalKey': 'sample-audio-1.mp3'}, 'status': 'SUCCESS'}, {'uuid': '83cea6f0-acdf-4a2c-afff-197bac9bdb01', 'dataRow': {'id': 'clfsl56ww5uyi078ldbojeqby', 'globalKey': 'sample-audio-1.mp3'}, 'status': 'SUCCESS'}]\n"
506-
]
507-
}
508-
],
448+
"outputs": [],
509449
"execution_count": null
510450
},
511451
{

examples/annotation_import/dicom.ipynb

Lines changed: 6 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,7 @@
6060
"!pip install -q 'labelbox[data]'"
6161
],
6262
"cell_type": "code",
63-
"outputs": [
64-
{
65-
"output_type": "stream",
66-
"name": "stdout",
67-
"text": [
68-
"\n",
69-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.0.1\u001b[0m\n",
70-
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
71-
]
72-
}
73-
],
63+
"outputs": [],
7464
"execution_count": null
7565
},
7666
{
@@ -249,16 +239,7 @@
249239
"print(\"Failed data rows:\" ,task.failed_data_rows)"
250240
],
251241
"cell_type": "code",
252-
"outputs": [
253-
{
254-
"output_type": "stream",
255-
"name": "stdout",
256-
"text": [
257-
"Errors : None\n",
258-
"Failed data rows: None\n"
259-
]
260-
}
261-
],
242+
"outputs": [],
262243
"execution_count": null
263244
},
264245
{
@@ -310,15 +291,7 @@
310291
"project.setup_editor(ontology)"
311292
],
312293
"cell_type": "code",
313-
"outputs": [
314-
{
315-
"output_type": "stream",
316-
"name": "stderr",
317-
"text": [
318-
"Default createProject behavior will soon be adjusted to prefer batch projects. Pass in `queue_mode` parameter explicitly to opt-out for the time being.\n"
319-
]
320-
}
321-
],
294+
"outputs": [],
322295
"execution_count": null
323296
},
324297
{
@@ -343,22 +316,7 @@
343316
"print(\"Batch: \", batch)"
344317
],
345318
"cell_type": "code",
346-
"outputs": [
347-
{
348-
"output_type": "stream",
349-
"name": "stdout",
350-
"text": [
351-
"Batch: <Batch {\n",
352-
" \"consensus_settings_json\": \"{\\\"numberOfLabels\\\":1,\\\"coveragePercentage\\\":0}\",\n",
353-
" \"created_at\": \"2023-03-29 15:21:44+00:00\",\n",
354-
" \"name\": \"first-batch-dicom-demo\",\n",
355-
" \"size\": 0,\n",
356-
" \"uid\": \"6a13c820-ce45-11ed-841e-4f0ab6db95bd\",\n",
357-
" \"updated_at\": \"2023-03-29 15:21:44+00:00\"\n",
358-
"}>\n"
359-
]
360-
}
361-
],
319+
"outputs": [],
362320
"execution_count": null
363321
},
364322
{
@@ -453,27 +411,7 @@
453411
"print(\" \")"
454412
],
455413
"cell_type": "code",
456-
"outputs": [
457-
{
458-
"output_type": "stream",
459-
"name": "stderr",
460-
"text": [
461-
"/Users/ibrahim/workspace/labelbox-python/labelbox/data/serialization/ndjson/label.py:177: UserWarning: Nested classifications are not currently supported\n",
462-
" for video object annotations\n",
463-
" and will not import alongside the object annotations.\n",
464-
" warnings.warn(\n"
465-
]
466-
},
467-
{
468-
"output_type": "stream",
469-
"name": "stdout",
470-
"text": [
471-
"Errors: []\n",
472-
"Status of uploads: [{'uuid': 'd193960f-1c7b-4493-87d1-8a55b2405748', 'dataRow': {'id': 'clftu3umv0384075r5poqey9o', 'globalKey': 'sample-dicom-1.dcm'}, 'status': 'SUCCESS'}, {'uuid': '8d0c454e-3385-44fc-97db-0516db3e7dc1', 'dataRow': {'id': 'clftu3umv0384075r5poqey9o', 'globalKey': 'sample-dicom-1.dcm'}, 'status': 'SUCCESS'}]\n",
473-
" \n"
474-
]
475-
}
476-
],
414+
"outputs": [],
477415
"execution_count": null
478416
},
479417
{
@@ -499,17 +437,7 @@
499437
"print(\" \")"
500438
],
501439
"cell_type": "code",
502-
"outputs": [
503-
{
504-
"output_type": "stream",
505-
"name": "stdout",
506-
"text": [
507-
"Errors: []\n",
508-
"Status of uploads: [{'uuid': '1cc42044-4f36-45af-8b05-da6c8dd5bf37', 'dataRow': {'id': 'clftu3umv0384075r5poqey9o', 'globalKey': 'sample-dicom-1.dcm'}, 'status': 'SUCCESS'}, {'uuid': '005e5d45-b3c2-49f5-bf82-aef760de7826', 'dataRow': {'id': 'clftu3umv0384075r5poqey9o', 'globalKey': 'sample-dicom-1.dcm'}, 'status': 'SUCCESS'}]\n",
509-
" \n"
510-
]
511-
}
512-
],
440+
"outputs": [],
513441
"execution_count": null
514442
},
515443
{

examples/basics/basics.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
"metadata": {},
155155
"source": [
156156
"project.update(description=\"new description field\")\n",
157-
"print(project.description)"
157+
"print(project.description)\n"
158158
],
159159
"cell_type": "code",
160160
"outputs": [],

examples/basics/batches.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"source": [
8383
"# Add your API key\n",
8484
"API_KEY = \"\"\n",
85+
"# To get your API key go to: Workspace settings -> API -> Create API Key\n",
8586
"client = lb.Client(api_key=API_KEY)"
8687
],
8788
"cell_type": "code",

examples/basics/data_row_metadata.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@
9494
{
9595
"metadata": {},
9696
"source": [
97-
"# Add your api key\n",
97+
"# Add your API key\n",
9898
"API_KEY = \"\"\n",
99+
"# To get your API key go to: Workspace settings -> API -> Create API Key\n",
99100
"client = lb.Client(api_key=API_KEY)"
100101
],
101102
"cell_type": "code",

examples/basics/data_rows.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,4 +538,4 @@
538538
"execution_count": null
539539
}
540540
]
541-
}
541+
}

0 commit comments

Comments
 (0)