The SDK source (excluding tests and support tools) is organized into the following packages/modules:
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 onorm/classes for easy and succinct object definitions. It also contains custom functionalities and custom GraphQL templates where necessary.client.pycontains theClientclass that's the client-side stub for communicating with Labelbox servers.exceptions.pycontains declarations for all Labelbox errors.pagination.pycontains support for paginated relationship and collection fetching.utils.pycontains utility functions.
- All development happens in per-feature branches prefixed by contributor's
initials. For example
fs/feature_name. - Approved PRs are merged to the
developbranch. - The
developbranch is merged tomasteron each release.
Before making a commit, to automatically adhere to our formatting standards, install and activate pre-commit
After the above, running git commit ... will attempt to fix formatting. If
there was formatted needed, you will need to re-add and re-commit before pushing.
Currently, the SDK functionality is tested using integration tests. These tests
communicate with a Labelbox server (by default the staging server) and are in
that sense not self-contained. Besides, that they are organized like unit test
and are based on the pytest library.
To execute tests you will need to provide an API key for the server you're using
for testing (staging by default) in the LABELBOX_TEST_API_KEY environment
variable. For more info see Labelbox API key docs.
To pass tests, code must be formatted. If pre-commit was not installed, you will need to use the following command:
yapf tests labelbox -i --verbose --recursive --parallel --style "google"Each release should follow the following steps:
- Update the Python SDK package version in
REPO_ROOT/setup.py - Make sure the
CHANGELOG.mdcontains appropriate info - Commit these changes and tag the commit in Git as
vX.Y - Merge
developtomaster(fast-forward only). - Create a GitHub release.
- This will kick off a Github Actions workflow that will:
- Build the library in the standard way
- Upload the distribution archives in the standard way
with credentials for the
labelboxPyPI user.