Skip to content

Commit 3a9238d

Browse files
sfendell-labelboxpaulnoirelGabefireabacchilbovalle15
authored
Release 3.66.0 (#1497)
Co-authored-by: Paul Noirel <[email protected]> Co-authored-by: Gabe <[email protected]> Co-authored-by: Aaron Bacchi <[email protected]> Co-authored-by: Aaron Bacchi <[email protected]> Co-authored-by: Andrea Ovalle <[email protected]> Co-authored-by: Val Brodsky <[email protected]> Co-authored-by: paulnoirel <[email protected]> Co-authored-by: Manu Sharma <[email protected]> Co-authored-by: casainfinita <[email protected]> Co-authored-by: Attila Papai <[email protected]> Co-authored-by: Adrian Chang <[email protected]> Co-authored-by: Adrian Chang <[email protected]> Co-authored-by: kozikkamil <[email protected]> Co-authored-by: kozikkamil <[email protected]> Co-authored-by: Matthew Roberson <[email protected]> Co-authored-by: Attila Papai <[email protected]>
1 parent e7eea5f commit 3a9238d

File tree

64 files changed

+45152
-7376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+45152
-7376
lines changed

.github/teams.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/python-package.yml

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,11 @@ on:
88

99
jobs:
1010
build:
11-
if: github.event.pull_request.head.repo.full_name == github.repository
12-
1311
runs-on: ubuntu-latest
1412
strategy:
13+
fail-fast: false
1514
matrix:
1615
include:
17-
- python-version: 3.7
18-
prod-key: LABELBOX_API_KEY
19-
staging-key: STAGING_LABELBOX_API_KEY
20-
da-test-key: DA_GCP_LABELBOX_API_KEY
2116
- python-version: 3.8
2217
prod-key: PROD_LABELBOX_API_KEY_2
2318
staging-key: STAGING_LABELBOX_API_KEY_2
@@ -26,11 +21,21 @@ jobs:
2621
prod-key: PROD_LABELBOX_API_KEY_3
2722
staging-key: STAGING_LABELBOX_API_KEY_3
2823
da-test-key: DA_GCP_LABELBOX_API_KEY
29-
- python-version: '3.10'
24+
- python-version: "3.10"
3025
prod-key: PROD_LABELBOX_API_KEY_4
3126
staging-key: STAGING_LABELBOX_API_KEY_4
3227
da-test-key: DA_GCP_LABELBOX_API_KEY
28+
- python-version: 3.11
29+
prod-key: LABELBOX_API_KEY
30+
staging-key: STAGING_LABELBOX_API_KEY
31+
da-test-key: DA_GCP_LABELBOX_API_KEY
32+
- python-version: 3.12
33+
prod-key: PROD_LABELBOX_API_KEY_5
34+
staging-key: STAGING_LABELBOX_API_KEY_5
35+
da-test-key: DA_GCP_LABELBOX_API_KEY
3336

37+
env:
38+
cache-key: testmon=${{ github.ref_name }}-${{ matrix.python-version }}
3439
steps:
3540
- name: Cancel previous workflow
3641
uses: styfle/[email protected]
@@ -55,6 +60,7 @@ jobs:
5560
uses: actions/setup-python@v5
5661
with:
5762
python-version: ${{ matrix.python-version }}
63+
cache: "pip"
5864

5965
- name: yapf
6066
id: yapf
@@ -70,28 +76,31 @@ jobs:
7076
libfontconfig1 \
7177
libxrender1 \
7278
libgl1-mesa-glx
73-
- name: install labelbox package
74-
run: |
75-
python -m pip install --upgrade pip
76-
python -m pip install .
7779
- name: mypy
7880
run: |
79-
pip install mypy==0.782
80-
mypy -p labelbox --pretty --show-error-codes
81-
- name: Install package and test dependencies
81+
pip install strenum
82+
pip install mypy==1.9.0
83+
# TODO: consider installing requests typing
84+
mypy -p labelbox --pretty --show-error-codes --non-interactive --install-types
85+
- name: Install test dependencies
8286
run: |
83-
pip install tox==3.18.1 pytest-snapshot
84-
87+
pip install tox==4.14.1
8588
# TODO: replace tox.ini with what the Makefile does
8689
# to make sure local testing is
8790
# identical to github actions which uses tox.ini
88-
- name: Test with tox
91+
- name: Test with tox (unit)
92+
env:
93+
# make sure to tell tox to use these environs in tox.ini
94+
LABELBOX_TEST_API_KEY_PROD: ${{ secrets[matrix.prod-key] }}
95+
LABELBOX_TEST_API_KEY_STAGING: ${{ secrets[matrix.staging-key] }}
96+
DA_GCP_LABELBOX_API_KEY: ${{ secrets[matrix.da-test-key] }}
97+
run: |
98+
tox -e py -- tests/unit
99+
- name: Test with tox (integration / data)
89100
env:
90101
# make sure to tell tox to use these environs in tox.ini
91102
LABELBOX_TEST_API_KEY_PROD: ${{ secrets[matrix.prod-key] }}
92-
93103
LABELBOX_TEST_API_KEY_STAGING: ${{ secrets[matrix.staging-key] }}
94-
95104
DA_GCP_LABELBOX_API_KEY: ${{ secrets[matrix.da-test-key] }}
96105
run: |
97-
tox -e py -- -n 10 -svv --reruns 5 --reruns-delay 8
106+
tox -e py -- tests/integration tests/data

.github/workflows/secrets_scan.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Secret_Scan
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
TruffleHog:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- name: Secret Scanning
15+
uses: trufflesecurity/trufflehog@main
16+
with:
17+
extra_args: --only-verified

.github/workflows/team-labeler.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ dmypy.json
126126
# Pyre type checker
127127
.pyre/
128128

129+
# IntelliJ
129130
.idea
131+
*.iml
130132

131133
# Vim swap files
132134
*.swp

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
name: "yapf"
77
args: [-i, --style, google]
88
- repo: https://github.com/datarootsio/databooks
9-
rev: 1.0.1
9+
rev: 1.3.10
1010
hooks:
1111
- id: databooks-meta
12-
args: [examples, --overwrite]
12+
args: [examples]

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
# Changelog
2+
# Version 3.66 (2024-03-20)
3+
## Notes
4+
5+
## Added
6+
* Added support for Python 3.11, 3.12
7+
* Added update method to attachments
8+
9+
## Notebooks
10+
* Improved notebooks for integration and model diagnostics
11+
* Removed databricks integrations notebooks
12+
13+
## Updated
14+
* Updated README for clarity and contribution guidelines
15+
16+
## Removed
17+
* Removed support Python 3.7 as it has been end of life since June 2023
18+
219
# Version 3.65.0 (2024-03-05)
320
## Notes
421
* Rerelease of 3.64.0

CONTRIB.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ review the following considerations before proceeding:
1212
improvements to functions within the schema/ package.
1313
* Please ensure that any new libraries are compliant with the Apache license that governs the Labelbox SDK.
1414
* Ensure that you update any relevant docstrings and comments within your code
15-
* Ensure that any new python components like classes, methods etc that need to feature in labelbox documentation have entries in the file [index.rst](https://github.com/Labelbox/labelbox-python/blob/develop/docs/source/index.rst). Also make sure you run `make html` locally in the `docs` folder to check if the documentation correctly updated according to the docstrings in the code added.
15+
* 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](https://github.com/Labelbox/labelbox-python/blob/develop/docs/source/index.rst). Also, make sure you run `make html` locally in the `docs` folder to check if the documentation is correctly updated according to the docstrings in the code added.
1616

1717
## Repository Organization
1818

README.md

Lines changed: 71 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,107 @@
11
# Labelbox Python SDK
2+
[![Release Notes](https://img.shields.io/github/release/labelbox/labelbox-python)](https://github.com/Labelbox/labelbox-python/releases)
3+
[![CI](https://github.com/labelbox/labelbox-python/actions/workflows/python-package.yml/badge.svg)](https://github.com/labelbox/labelbox-python/actions)
4+
[![Downloads](https://pepy.tech/badge/labelbox)](https://pepy.tech/project/labelbox)
5+
[![Dependency Status](https://img.shields.io/librariesio/github/labelbox/labelbox-python)](https://libraries.io/github/labelbox/labelbox-python)
6+
[![Open Issues](https://img.shields.io/github/issues-raw/labelbox/labelbox-python)](https://github.com/labelbox/labelbox-python/issues)
7+
[![Changelog](https://img.shields.io/badge/Changelog-Recent%20Updates-blue.svg)](https://docs.labelbox.com/changelog)
8+
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
9+
[![Twitter Follow](https://img.shields.io/twitter/follow/labelbox.svg?style=social&label=Follow)](https://twitter.com/labelbox)
10+
[![LinkedIn Follow](https://img.shields.io/badge/Follow-LinkedIn-blue.svg?style=flat&logo=linkedin)](https://www.linkedin.com/company/labelbox/)
211

3-
Labelbox is the enterprise-grade training data solution with fast AI enabled labeling tools, labeling automation, human workforce, data management, a powerful API for integration & SDK for extensibility. Visit [Labelbox](http://labelbox.com/) for more information.
412

5-
The Labelbox Python API offers a simple, user-friendly way to interact with the Labelbox back-end.
13+
Labelbox is a cloud-based data-centric AI platform designed to help teams create high-quality training data for their AI models. It provides a suite of tools and features that streamline the process of data curation, labeling, model output evaluation for computer vision and large language models. Visit [Labelbox](http://labelbox.com/) for more information.
614

7-
## Table of Contents
815

9-
- [Labelbox Python SDK](#labelbox-python-sdk)
10-
- [Table of Contents](#table-of-contents)
11-
- [Requirements](#requirements)
12-
- [Installation](#installation)
13-
- [Note for Windows users](#note-for-windows-users)
14-
- [Documentation](#documentation)
15-
- [Authentication](#authentication)
16-
- [Contribution](#contribution)
17-
- [Testing](#testing)
16+
The Python SDK provides a convenient way to interact with Labelbox programmatically, offering advantages over REST or GraphQL APIs:
1817

19-
## Requirements
18+
* **Simplified interactions:** The SDK abstracts away the complexities of API calls, making it easier to work with Labelbox.
19+
* **Object-oriented approach:** The SDK provides an object-oriented interface, allowing you to interact with Labelbox entities (projects, datasets, labels, etc.) as Python objects.
20+
* **Extensibility:** The SDK can be extended to support custom data formats and operations.
2021

21-
- Use Python 3.7, 3.8, 3.9 and 3.10
22-
- [Create an account](http://app.labelbox.com/)
23-
- [Generate an API key](https://docs.labelbox.com/docs/create-an-api-key)
22+
## Table of Contents
23+
- [Installation](#installation)
24+
- [Code Architecture](#code-architecture)
25+
- [Contribution Guidelines](#contribution-guidelines)
26+
- [Develop with AI Assistance](#develop-with-ai-assistance)
27+
- [Documentation](#documentation)
2428

2529
## Installation
30+
![Supported python versions](https://img.shields.io/badge/python-3.7%20|%203.8%20|%203.9%20|%203.10-blue.svg)
2631

27-
Prerequisite: Install pip
28-
29-
`pip` is a package manager for Python. **On macOS**, you can set it up to use the default python3 install via -
30-
31-
```
32-
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
33-
python3 get-pip.py
34-
```
35-
36-
If the installation completes with a warning re: pip not being in your path, you'll need to add it by modifying your shell config (`.zshrc`, `.bashrc` or similar). You might have to modify the command below depending on the version of python3 on your machine.
32+
Welcome to the quick start guide for integrating Labelbox into your Python projects. Whether you're looking to incorporate advanced data labeling into your workflow or simply explore the capabilities of the Labelbox Python SDK, this guide will walk you through the two main methods of setting up Labelbox in your environment: via a package manager and by building it locally.
3733

38-
```
39-
export PATH=/Users/<your-macOS-username>/Library/Python/3.8/bin:$PATH
40-
```
34+
### Install using pip
4135

42-
Install SDK locally, using Python's Pip manager
36+
To get started with the least amount of hassle, follow these simple steps to install the Labelbox Python SDK using pip, Python's package manager.
4337

44-
```
45-
pip3 install -e .
46-
```
38+
1. **Ensure pip is installed:** First, make sure you have `pip` installed on your system. It's the tool we'll use to install the SDK.
39+
40+
2. **Sign up for Labelbox:** If you haven't already, create a free account at [Labelbox](http://app.labelbox.com/) to access its features.
4741

48-
Install dependencies
42+
3. **Generate your API key:** Log into Labelbox and navigate to [Account > API Keys](https://docs.labelbox.com/docs/create-an-api-key) to generate an API key. You'll need this for programmatic access to Labelbox.
4943

50-
```
51-
pip3 install -r requirements.txt
52-
```
44+
4. **Install the SDK:** Open your terminal or command prompt and run the following command to install the Labelbox Python SDK:
45+
46+
```bash
47+
pip install labelbox
48+
```
5349

54-
To install dependencies required for data processing modules use:
50+
5. **Install optional dependencies:** For enhanced functionality, such as data processing, you can install additional dependencies with:
51+
52+
```bash
53+
pip install "labelbox[data]"
54+
```
5555

56-
```
57-
pip install "labelbox[data]"
58-
```
56+
This includes essential libraries like Shapely, GeoJSON, NumPy, Pillow, and OpenCV-Python, enabling you to handle a wide range of data types and perform complex operations.
5957

60-
## Documentation
61-
62-
- [Visit our docs](https://docs.labelbox.com/reference) to learn how the SDK works
63-
- Checkout our [notebook examples](examples/) to follow along with interactive tutorials
64-
- view our [API reference](https://labelbox-python.readthedocs.io/en/latest/index.html).
65-
66-
## Authentication
58+
### Building and installing locally
6759

68-
Labelbox uses API keys to validate requests. You can create and manage API keys on [Labelbox](https://app.labelbox.com/account/api-keys). Pass your API key as an environment variable. Then, import and initialize the API Client.
60+
For those who prefer or require a more hands-on approach, such as contributing to the SDK or integrating it into a complex project, building the SDK locally is the way to go.
6961

70-
```
71-
user@machine:~$ export LABELBOX_API_KEY="<your local api key here>"
72-
user@machine:~$ python3
7362

74-
from labelbox import Client
75-
client = Client()
76-
```
63+
#### Steps for local installation
7764

78-
- Update api_key and endpoint if not using the production cloud deployment
65+
1. **Clone the SDK repository:** First, clone the Labelbox SDK repository from GitHub to your local machine.
7966

80-
```
81-
# On prem
82-
client = Client( endpoint = "<local deployment>")
67+
2. **Install required dependencies:** To ensure all dependencies are met, run:
8368

84-
# Local
85-
client = Client(api_key=os.environ['LABELBOX_TEST_API_KEY_LOCAL'], endpoint="http://localhost:8080/graphql")
69+
```bash
70+
pip install -r requirements.txt
71+
```
8672

87-
# Staging
88-
client = Client(api_key=os.environ['LABELBOX_TEST_API_KEY_LOCAL'], endpoint="https://api.lb-stage.xyz/graphql")
89-
```
73+
3. **Install the SDK locally:** Navigate to the root directory of the cloned repository and run:
9074

91-
## Contribution
75+
```bash
76+
pip install -e .
77+
```
9278

93-
Please consult `CONTRIB.md`
79+
For additional data processing capabilities, remember to install the `data` extra as mentioned in the easy installation section.
9480

95-
## Testing
9681

97-
1. Update the `Makefile` with your `local`, `staging`, `prod` API key. Ensure that docker has been installed on your system. Make sure the key is not from a free tier account.
98-
2. To test on `local`:
82+
## Code architecture
83+
The Labelbox Python SDK is designed to provide a clean and intuitive interface for interacting with the Labelbox API. It primarily uses GraphQL for communication, with some REST API calls for specific functionalities. The SDK wraps the GraphQL API calls and provides object-oriented representations of Labelbox entities like projects, datasets, and labels. This allows developers to interact with Labelbox in a more Pythonic way, making code easier to read and maintain.
9984

100-
```
101-
user@machine:~$ export LABELBOX_TEST_API_KEY_LOCAL="<your local api key here>"
102-
make test-local # with an optional flag: PATH_TO_TEST=tests/integration/...etc LABELBOX_TEST_API_KEY_LOCAL=specify_here_or_export_me
103-
```
85+
Key files and classes include:
10486

105-
3. To test on `staging`:
87+
- **`labelbox/client.py`:** Contains the `Client` class, which provides methods for interacting with the Labelbox API.
88+
- **`labelbox/orm/model.py`:** Defines the data model for Labelbox entities like projects, datasets, and labels.
89+
- **`labelbox/schema/*.py`:** Contains classes representing specific Labelbox entities and their attributes.
90+
- **`labelbox/data/annotation_types/*.py`:** Defines classes for different annotation types, such as bounding boxes, polygons, and classifications.
91+
- **`labelbox/data/serialization/*.py`:** Provides converters for different data formats.
10692

107-
```
108-
user@machine:~$ export LABELBOX_TEST_API_KEY_STAGING="<your staging api key here>"
109-
make test-staging # with an optional flag: PATH_TO_TEST=tests/integration/...etc LABELBOX_TEST_API_KEY_STAGING=specify_here_or_export_me
110-
```
93+
The SDK wraps the GraphQL APIs and provides a Pythonic interface for interacting with Labelbox.
11194

112-
4. To test on `prod`:
95+
## Contribution guidelines
96+
We encourage developers to contribute to the Labelbox Python SDK and help improve its functionality and usability. Please refer to the [CONTRIB.md](CONTRIB.md) file in the root folder of the repository for detailed information on how to contribute.
11397

114-
```
115-
user@machine:~$ export LABELBOX_TEST_API_KEY_PROD="<your prod api key here>"
116-
make test-prod # with an optional flag: PATH_TO_TEST=tests/integration/...etc LABELBOX_TEST_API_KEY_PROD=specify_here_or_export_me
117-
```
98+
## Develop with AI assistance
99+
### Use the codebase as context for large language models
100+
Using the [GPT repository loader](https://github.com/mpoon/gpt-repository-loader), we have created `lbx_prompt.txt` that contains data from all `.py` and `.md` files. The file has about 730k tokens. We recommend using Gemini 1.5 Pro with 1 million context length window.
118101

119-
5. If you make any changes and need to rebuild the image used for testing, force a rebuild with the `-B` flag
120-
121-
```
122-
make -B {build|test-staging|test-prod}
123-
```
102+
## Documentation
103+
The Labelbox Python SDK is well-documented to help developers get started quickly and use the SDK effectively. Here are some resources:
124104

125-
6. Testing against Delegated Access will be skipped unless the local env contains the key:
126-
DA_GCP_LABELBOX_API_KEY. These tests will be included when run against a PR. If you would like to test it manually, please reach out to the Devops team for information on the key.
105+
- [Official documentation](https://docs.labelbox.com/docs/overview)
106+
- [Notebook examples](https://github.com/Labelbox/labelbox-python/tree/master/examples)
107+
- [Python SDK reference docs](https://labelbox-python.readthedocs.io/en/latest/)

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
copyright = '2021, Labelbox'
2222
author = 'Labelbox'
2323

24-
release = '3.65.0'
24+
release = '3.66.0'
2525

2626
# -- General configuration ---------------------------------------------------
2727

0 commit comments

Comments
 (0)