|
| 1 | +# Labelbox Python SDK Contribution Guide |
| 2 | + |
| 3 | +## Repository Organization |
| 4 | + |
| 5 | +The SDK source (excluding tests and support tools) is organized into the |
| 6 | +following packages/modules: |
| 7 | +* `orm/` package contains code that supports the general mapping of Labelbox |
| 8 | + data to Python objects. This includes base classes, attribute (field and |
| 9 | + relationship) classes, generic GraphQL queries etc. |
| 10 | +* `schema/` package contains definitions of classes which represent data type |
| 11 | + (e.g. Project, Label etc.). It relies on `orm/` classes for easy and succinct |
| 12 | + object definitions. It also contains custom functionalities and custom GraphQL |
| 13 | + templates where necessary. |
| 14 | +* `client.py` contains the `Client` class that's the client-side stub for |
| 15 | + communicating with Labelbox servers. |
| 16 | +* `exceptions.py` contains declarations for all Labelbox errors. |
| 17 | +* `pagination.py` contains support for paginated relationship and collection |
| 18 | + fetching. |
| 19 | +* `utils.py` contains utility functions. |
| 20 | + |
| 21 | +## Branches |
| 22 | + |
| 23 | +* All development happens in per-feature branches prefixed by contributor's |
| 24 | + initials. For example `fs/feature_name`. |
| 25 | +* Approved PRs are merged to the `develop` branch. |
| 26 | +* The `develop` branch is merged to `master` on each release. |
| 27 | + |
| 28 | +## Testing |
| 29 | + |
| 30 | +Currently the SDK functionality is tested using integration tests. These tests |
| 31 | +communicate with a Labelbox server (by default the staging server) and are in |
| 32 | +that sense not self-contained. Besides that they are organized like unit test |
| 33 | +and are based on the `pytest` library. |
| 34 | + |
| 35 | +To execute tests you will need to provide an API key for the server you're using |
| 36 | +for testing (staging by default) in the `LABELBOX_TEST_API_KEY` environment |
| 37 | +variable. For more info see [Labelbox API key |
| 38 | +docs](https://labelbox.helpdocs.io/docs/api/getting-started). |
| 39 | + |
| 40 | +## Release Steps |
| 41 | + |
| 42 | +Each release should follow the following steps: |
| 43 | + |
| 44 | +1. Update the Python SDK package version in `REPO_ROOT/setup.py` |
| 45 | +2. Make sure the `CHANGELOG.md` contains appropriate info |
| 46 | +3. Commit these changes and tag the commit in Git as `vX.Y` |
| 47 | +4. Merge `develop` to `master` (fast-forward only). |
| 48 | +5. Generate a GitHub release. |
| 49 | +6. Build the library in the [standard |
| 50 | + way](https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives) |
| 51 | +7. Upload the distribution archives in the [standard |
| 52 | + way](https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives). |
| 53 | +You will need credentials for the `labelbox` PyPI user. |
| 54 | +8. Run the `REPO_ROOT/tools/api_reference_generator.py` script to update |
| 55 | + [HelpDocs documentation](https://labelbox.helpdocs.io/docs/). You will need |
| 56 | + to provide a HelpDocs API key for. |
0 commit comments