Skip to content

Commit fd28389

Browse files
committed
moved over files
1 parent 9c2c61e commit fd28389

Some content is hidden

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

56 files changed

+15454
-1
lines changed

.github/workflows/notebooks.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Labelbox Example Notebook Workflow
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
pull_request:
7+
branches: [develop]
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
# Get installs from rye and run rye run clean to format
15+
format:
16+
if: github.event.pull_request.merged == false
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.head_ref }}
22+
fetch-depth: 0
23+
- uses: ./.github/actions/python-package-shared-setup
24+
with:
25+
rye-version: ${{ vars.RYE_VERSION }}
26+
python-version: 3.12
27+
- name: Format
28+
working-directory: examples
29+
run: rye run clean
30+
- name: Commit changes
31+
run: |
32+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
33+
git config --local user.name "github-actions[bot]"
34+
git add examples/.
35+
git commit -m ":art: Cleaned" || exit 0
36+
- name: Push changes
37+
uses: ad-m/github-push-action@master
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
branch: ${{ github.head_ref }}
41+
# See if notebooks were added or deleted (name change counts as both)
42+
changes:
43+
needs: format
44+
if: github.event.pull_request.merged == false
45+
runs-on: ubuntu-latest
46+
outputs:
47+
addedOrModified: ${{ steps.filter.outputs.addedOrModified }}
48+
steps:
49+
- uses: dorny/paths-filter@v3
50+
id: filter
51+
with:
52+
filters: |
53+
addedOrModified:
54+
- added|deleted: 'examples/**/*.ipynb'
55+
# Create readme if the above job shows true using rye run create-readme
56+
create:
57+
needs: changes
58+
if: ${{ needs.changes.outputs.addedOrModified == 'true' }} && github.event.pull_request.merged == false
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
ref: ${{ github.head_ref }}
64+
fetch-depth: 0
65+
- uses: ./.github/actions/python-package-shared-setup
66+
with:
67+
rye-version: ${{ vars.RYE_VERSION }}
68+
python-version: 3.12
69+
- name: Create readme
70+
working-directory: examples
71+
run: rye run create-readme
72+
- name: Commit changes
73+
run: |
74+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
75+
git config --local user.name "github-actions[bot]"
76+
git add examples/.
77+
git commit -m ":memo: README updated" || exit 0
78+
- name: Push changes
79+
uses: ad-m/github-push-action@master
80+
with:
81+
github_token: ${{ secrets.GITHUB_TOKEN }}
82+
branch: ${{ github.head_ref }}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Labelbox Python SDK Shared
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: true
8+
type: string
9+
api-key:
10+
required: true
11+
type: string
12+
da-test-key:
13+
required: true
14+
type: string
15+
test-env:
16+
required: true
17+
type: string
18+
fixture-profile:
19+
required: true
20+
type: boolean
21+
22+
jobs:
23+
lint:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.head_ref }}
29+
- uses: ./.github/actions/python-package-shared-setup
30+
with:
31+
rye-version: ${{ vars.RYE_VERSION }}
32+
python-version: ${{ inputs.python-version }}
33+
- name: Linting
34+
working-directory: libs/labelbox
35+
run: rye run lint
36+
integration:
37+
runs-on: ubuntu-latest
38+
concurrency:
39+
group: labelbox-python-${{ inputs.test-env }}-${{ inputs.python-version }}-integration
40+
cancel-in-progress: false
41+
steps:
42+
- uses: actions/checkout@v4
43+
with:
44+
ref: ${{ github.head_ref }}
45+
- uses: ./.github/actions/python-package-shared-setup
46+
with:
47+
rye-version: ${{ vars.RYE_VERSION }}
48+
python-version: ${{ inputs.python-version }}
49+
- name: Integration Testing
50+
env:
51+
LABELBOX_TEST_API_KEY: ${{ secrets[inputs.api-key] }}
52+
DA_GCP_LABELBOX_API_KEY: ${{ secrets[inputs.da-test-key] }}
53+
LABELBOX_TEST_ENVIRON: ${{ inputs.test-env }}
54+
working-directory: libs/labelbox
55+
run: rye run integration -n 32
56+
unit-data:
57+
runs-on: ubuntu-latest
58+
concurrency:
59+
group: labelbox-python-${{ inputs.test-env }}-${{ inputs.python-version }}-unit-data
60+
cancel-in-progress: false
61+
steps:
62+
- uses: actions/checkout@v4
63+
with:
64+
ref: ${{ github.head_ref }}
65+
- uses: ./.github/actions/python-package-shared-setup
66+
with:
67+
rye-version: ${{ vars.RYE_VERSION }}
68+
python-version: ${{ inputs.python-version }}
69+
- name: Unit && Data Testing
70+
env:
71+
LABELBOX_TEST_API_KEY: ${{ secrets[inputs.api-key] }}
72+
DA_GCP_LABELBOX_API_KEY: ${{ secrets[inputs.da-test-key] }}
73+
LABELBOX_TEST_ENVIRON: ${{ inputs.test-env }}
74+
working-directory: libs/labelbox
75+
run: |
76+
rye sync -f --features labelbox/data
77+
rye run unit -n 32
78+
rye run data -n 32
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: ReadMe GitHub Action 🦉
2+
3+
on:
4+
pull_request:
5+
branches: [develop]
6+
types:
7+
- closed
8+
paths:
9+
- README.md
10+
11+
jobs:
12+
custompages:
13+
if: github.event.pull_request.merged == true
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: ./.github/actions/python-package-shared-setup
18+
with:
19+
rye-version: ${{ vars.RYE_VERSION }}
20+
python-version: 3.12
21+
- name: Create readme
22+
working-directory: examples
23+
run: rye run create-doc-readme
24+
- name: Run `custompages` command
25+
uses: readmeio/rdme@v8
26+
with:
27+
rdme: custompages examples/tutorials.html --key=${{ secrets.README_API_KEY }}

.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

CONTRIBUTING.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Contribution guide
2+
3+
Thank you for contributing to our notebook examples! To ensure that your contribution aligns with our guidelines, please carefully review the following guide.
4+
5+
## Table of contents
6+
7+
- [General notebook requirements](#general-notebook-requirements)
8+
- [Branches and tags](#branches-and-tags)
9+
- [Github workflows](#github-workflows)
10+
- [General prerequisites](#general-prerequisites)
11+
- [Styling tools](#styling-tools)
12+
13+
## General notebook requirements
14+
15+
Review our [template notebook](template.ipynbs) for general overview on how notebooks should be structure. The template notebook and this section just serves as a guide and exceptions can be made. Here are our general requirements:
16+
17+
1. Ensure that any modified notebooks run when edited.
18+
2. Ensure that you update any relevant headers and comments within the code block you may add or change.
19+
3. Notebooks should start with a top header below the Labelbox and link icons with the title of the notebook as a main header **#** and a overview of what the notebook shows.
20+
4. Use "labelbox[data]" over labelbox for installs to ensure you have the correct dependencies.
21+
5. Imports and installs should come after the main header under a **Setup** section.
22+
6. Labelbox and other platforms with clients and API keys should be specified under a single section.
23+
7. Subsections need a second level header **##** and an overview of the section.
24+
8. The last cell should be a clean up section to delete any labelbox objects created and commented out to prevent accidentally running code blocks.
25+
9. Notebook github action [workflows](#github-workflows) are required to run successfully before merging.
26+
27+
> [!IMPORTANT]
28+
> Please make sure to remove any API keys before pushing changes
29+
30+
## Branches and tags
31+
32+
- All development happens in feature branches ideally prefixed by contributor's initials. For example `fs/feature_name`.
33+
- Approved PRs are merged to the `develop` branch.
34+
- All releases align to a git tag.
35+
36+
## Github workflows
37+
38+
- Github Branch Workflow
39+
- When you push to a branch that contains files inside the examples directory, it will automatically reformat your notebook to match our given style and provide appropriate headers. Once this workflow is completed it will commit back to your branch which then you can pull.
40+
- If your push contains new notebooks or modifies the names of notebooks the readme will be updated to reflect the change with updated links.
41+
42+
## General prerequisites
43+
44+
[Rye](https://rye-up.com/) may be installed before contributing to the repository as it is the tool used to style our example notebooks. This could be used to avoid the github styling workflow. This is also the packaging tool used for the main SDK. The pyproject used for the example notebooks is a virtual package and does not get published.
45+
46+
## Styling tools
47+
48+
Rye is setup in this directory to use a customs script that will run the notebooks through our formatting tools and create readmes.
49+
50+
- `rye sync` in the examples folder to install the correct dev dependencies.
51+
- `rye run clean` runs a series of formatting tools.
52+
- `rye run create-readme` creates a readme based off our notebooks.

0 commit comments

Comments
 (0)