The repository is laid out as a monorepo where each moudle in the monorepo lives as a folder in libs/
. Each module should have a README.md
describing the specific purpose of the module and its development requirements.
This is a general guide applicable to all modules in the repository.
- General Guidelines
- Branches
- Release Steps
- Jupyter Notebooks
- General Prerequisites
- Setup and Building
- Testing
Thank you for expressing your interest in contributing! To ensure that your contribution aligns with our guidelines, please carefully review the following before proceeding:
- For feature requests, we recommend consulting with Labelbox Support support or creating a Github Issue.
- We can only accept general solutions that address common issues rather than solutions designed for specific use cases. Example contributions encompass a wide range of activities, such as bug fixes and updates to dependencies.
- Ensure that any new libraries added are compliant with the Apache license that governs the repository.
- Ensure that you update any relevant docstrings and comments within the code you may add or change.
- Ensure that any new Python components, such as classes, packages, or methods, that need to feature in the Labelbox documentation have entries in the file index.rst.
- All development happens in per-feature branches prefixed by contributor's initials. For example
fs/feature_name
. - Approved PRs are merged to the
develop
branch.
Your contributions will be released as soon as it is approved and merged into the develop
branch. Please consult the Labelbox team for if you need a more specific timeframe of when your contributions may be released.
Rye must be installed before contributing to the repository as it is the tool used to managed the repository.
To understand why Rye was chosen, see here. TLDR: Environment, Package, Python, management along with Package publishing and Package building is unified under a single tool for consistency of development.
If you want to not deal with setting up Rye
, feel free to use one of Docker containers Labelbox has built which contains the entire with Rye
setup.
You can use Poetry to manage the virtual environment. There's nothing blocking you from using Poetry to manage the virtual environment as the standard pyproject.toml
format is used, but you'll have to deal with managing Python yourself + be asked not to check in any poetry.lock
files. Also, you'll have to run equivalent poetry commands that may not be listed in the documentation to perform the same general operations (testing, building, etc.).
These are general steps that all modules in libs/
adhere to given the prerequisite of the installation of Rye
that are needed to setup a module for development and build it.
rye sync
in the module folder you want to work on (EGrye sync --all-features
to work onlabelbox
).rye build
to create a distribution indist/
which you can install into a Python environment (EGpip install dist/labelbox-build.tar.gz
).
It is generally not recommended to do pip install -e .
with any Labelbox module to avoid virtual environment pollution. If you want to modify any module while making it compatible with your existing pip
based projects, build a distribution and install it in your pip
environment.
Each module within the repository will generally expected to implement three commands for testing: unit testing, integration testing, and linting/formatting. See the details in each module's README.md
for more information.
rye run unit
rye run integration
rye run lint
To generate documentation for all modules (ReadTheDocs
), run the following command.
rye run docs
We have samples in the examples
directory and using them for testing can help increase your productivity.
Make sure your notebook will use your source code:
ipython profile create
ipython 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 notebook
to start the server