Skip to main content

Labelbox Python API

Project description

Labelbox

Core mono-module for Labelbox's Python SDK.

Table of Contents

Setup

rye sync --all-features # to install labelbox[data] dependencies

Repository Organization

The SDK source (excluding tests and support tools) is organized into the following packages/modules:

  • data/ package contains code that maps annotations (labels or pre-labels) to Python objects, as well as serialization and deserialization tools for converting between NDJson and Annotation Types.
  • orm/ package contains code that supports the general mapping of Labelbox data to Python objects. This includes base classes, attribute (field and relationship) classes, generic GraphQL queries etc.
  • schema/ package contains definitions of classes which represent data type (e.g. Project, Label etc.). It relies on orm/ classes for easy and succinct object definitions. It also contains custom functionalities and custom GraphQL templates where necessary.
  • client.py contains the Client class that's the client-side stub for communicating with Labelbox servers.
  • exceptions.py contains declarations for all Labelbox errors.
  • pagination.py contains support for paginated relationship and collection fetching.
  • utils.py contains utility functions.

Testing

Unit Testing

rye run unit

Integration Testing

LABELBOX_TEST_API_KEY="YOUR_API_TEST_KEY" LABELBOX_TEST_ENVIRON="prod" rye run integration

For more info on how to get a LABELBOX_TEST_API_KEY Labelbox API key docs.

Integration tests by default will run against your account that you provide an API Key from and modify its data. If you want to run integration tests, without it impacting your existing account, create an additional account using a secondary e-mail on Labelbox. Free accounts are sufficent for integration testing purposes.

You can also use a .env file if you prefer instead of needing to type out the environmental overrides every single time you want to run commands. Please add a --env-file parameter to the test command (EG rye --env-file=.env run integration).

(Optional) Data Testing

For testing the impact of the extra installs included with labelbox[data], run the following:

LABELBOX_TEST_API_KEY="YOUR_API_TEST_KEY" LABELBOX_TEST_ENVIRON="prod" rye run data

By default rye sync does not install the extra packages needed in labelbox[data]. You'll need to run rye sync --all-features. Do not checkin requirements.lock or requirements-dev.lock after doing this.

Linting / Formatting

Before making a commit, to automatically adhere to our formatting standards, it is recommended to install and activate pre-commit

pip install pre-commit
pre-commit install

After the above, running git commit ... will attempt to fix formatting, and make necessary changes to files. You will then need to stage those files again.

You may also manually format your code by running the following:

rye run lint

Documentation

To generate documentation for all modules (ReadTheDocs), run the following command.

rye run docs

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

labelbox-6.0.1.tar.gz (5.0 MB view details)

Uploaded Source

Built Distribution

labelbox-6.0.1-py3-none-any.whl (220.3 kB view details)

Uploaded Python 3

File details

Details for the file labelbox-6.0.1.tar.gz.

File metadata

  • Download URL: labelbox-6.0.1.tar.gz
  • Upload date:
  • Size: 5.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for labelbox-6.0.1.tar.gz
Algorithm Hash digest
SHA256 8063fa1db5612a24e48da374b80d8daf7b261e3457687240aad0869f298e349a
MD5 4ad6daac0a074bb869f06accfef21dd8
BLAKE2b-256 b98ae54c6eee93ea8e5289214c683aa17e4c24206ee2a552decef8361711566f

See more details on using hashes here.

Provenance

The following attestation bundles were made for labelbox-6.0.1.tar.gz:

Publisher: publish.yml on Labelbox/labelbox-python

Attestations:

File details

Details for the file labelbox-6.0.1-py3-none-any.whl.

File metadata

  • Download URL: labelbox-6.0.1-py3-none-any.whl
  • Upload date:
  • Size: 220.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for labelbox-6.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2cad917d59fd0c9e4634af9c15988bd0951fa0c2c984ea1c934fd0611aabddce
MD5 2f81bf8017bef0a8ff374657c8ca7209
BLAKE2b-256 518a5eb19d3f4813ee19421713bc250042b0d6c88d7128b59acf51c13c468ef6

See more details on using hashes here.

Provenance

The following attestation bundles were made for labelbox-6.0.1-py3-none-any.whl:

Publisher: publish.yml on Labelbox/labelbox-python

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page