Thank you for expressing your interest in contributing to the Labelbox SDK. To ensure that your contribution aligns with our guidelines, please carefully review the following considerations before proceeding:
- For feature requests, we recommend consulting with Labelbox support or creating a Github Issue on our repository.
- We can only accept general solutions that address common issues rather than solutions designed for specific use cases. Acceptable contributions include simple bug fixes and improvements to functions within the schema/ package.
- Please ensure that any new libraries are compliant with the Apache license that governs the Labelbox SDK.
- Ensure that you update any relevant docstrings and comments within your code
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 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
pip install pre-commit
pre-commit installAfter 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:
yapf tests labelbox -i --verbose --recursive --parallel --style "google"Currently, the SDK functionality is tested using unit and integration tests. The integration tests communicate with a Labelbox server (by default the staging server) and are in that sense not self-contained.
Please consult "Testing" section in the README for more details on how to test.
Additionally, 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.
Please consult the Labelbox team for releasing your contributions
We have plenty of good samples in the examples directory and using them for testing can help us increase our productivity. One way to use jupyter notebooks is to run the jupyter server locally (another way is to use a VSC plugin, not documented here). It works really fast.
Make sure your notebook will use your source code:
ipython profile createipython locate- will show where the config file is. This is the config file used by the jupyter server, since it runs via ipython- Open the file (this should be ipython_config.py and it is usually located in ~/.ipython/profile_default) and add the following line of code:
c.InteractiveShellApp.exec_lines = [
'import sys; sys.path.insert(0, "<labelbox-python root folder>")'
]
- Go to the root of your project and run
jupyter notebookto start the server