Work in JupyterLab
After opening a notebook, use the injected environment to talk to your project.
Environment variables
Section titled “Environment variables”On each JupyterLab start, Labelty’s lifecycle script sets:
| Variable | Meaning |
|---|---|
LABELTY_API_URL |
API base including /api/v1 |
LABELTY_API_KEY |
Project-scoped lty_… key for this space |
LABELTY_PROJECT_ID is intentionally not set. Resolve the project from the key:
client.project # or client.projects.current()Values are written into:
~/.bashrc(terminals)- IPython startup script (notebook kernels)
- Conda activate hook when writable
Verify injection
Section titled “Verify injection”Run in a notebook cell:
import os
for k in ("LABELTY_API_URL", "LABELTY_API_KEY"): value = os.environ.get(k) print(f"{k}: {'set' if value else 'MISSING'}")Expected output: both variables report set.
If either is missing, restart the notebook (Stop → Open in Labelty) so lifecycle runs again. Ops can check CloudWatch /aws/sagemaker/studio with filter labelty-lifecycle.
SDK install
Section titled “SDK install”The lifecycle script lazy-installs labelty-sdk if import labelty_sdk fails.
First connected cell
Section titled “First connected cell”import osfrom labelty_sdk import LabeltyClient
with LabeltyClient( api_url=os.environ["LABELTY_API_URL"], api_key=os.environ["LABELTY_API_KEY"],) as client: project = client.project print(project.id, project.name)
schema = project.schema.get() assets = project.assets.list(limit=20, offset=0) print("assets", len(assets))Why pass env vars explicitly: the SDK client does not auto-read LABELTY_*; notebooks (and scripts) must pass them.
Common next tasks
Section titled “Common next tasks”Follow the SDK guides from inside the notebook:
- Schema and assets — download approved images
- Models and predictions — register or score
- Training remains UI/REST oriented: Training overview
Limitations to remember
Section titled “Limitations to remember”- One shared space per project — collaborators share the same files; coordinate edits.
- No direct AWS data APIs from the locked-down notebook role — use the Labelty SDK/API.
- Tags for URL/key are set at first space creation; rotating keys in the UI may not refresh the space until ops/product support exists.
- Lifecycle script updates need infra apply + Stop → Open to take effect.
- EBS persists after stop; compute billing stops, but storage may still incur cost (confirm with your cloud bill / ops).
Stop when finished
Section titled “Stop when finished”In the Labelty notebook modal, click Stop. This deletes the JupyterLab app (compute) while keeping the space volume.