Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SN-0] Switched notebooks to RYE for better management cleaned up everything #1619

Merged
merged 93 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
9d2e6ef
started rye conversion
Gabefire May 19, 2024
1dd2d74
removed unneeded files
Gabefire May 19, 2024
f956e3e
worked on format file script
Gabefire May 19, 2024
062b536
added workflows finished everything up
Gabefire May 20, 2024
0dfabb4
moved workflow around
Gabefire May 20, 2024
4917afc
added some notebooks to trigger
Gabefire May 20, 2024
9fe622b
fixed conditional
Gabefire May 20, 2024
32c6766
fixed conditional
Gabefire May 20, 2024
b2c755c
fixed conditional
Gabefire May 20, 2024
e03c049
fixed conditional
Gabefire May 20, 2024
242ed0d
fixed action
Gabefire May 20, 2024
39e8423
added back composite
Gabefire May 20, 2024
70f1baa
:memo: README updated
github-actions[bot] May 20, 2024
7f92bf8
combined workflows
Gabefire May 20, 2024
a35429a
gMerge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-py…
Gabefire May 20, 2024
eaad2ec
:art: Cleaned
github-actions[bot] May 20, 2024
87d71ea
testing if readme is created
Gabefire May 20, 2024
542c358
Merge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-pyt…
Gabefire May 20, 2024
f1ef2b6
:art: Cleaned
github-actions[bot] May 20, 2024
4b523e3
modified readme create to trigger
Gabefire May 20, 2024
43b7aa1
:memo: README updated
github-actions[bot] May 20, 2024
f9ac196
removed test file to test
Gabefire May 20, 2024
62780c5
:memo: README updated
github-actions[bot] May 20, 2024
dc72142
added test file
Gabefire May 20, 2024
8183898
Merge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-pyt…
Gabefire May 20, 2024
881445f
:art: Cleaned
github-actions[bot] May 20, 2024
0c1d403
switched it to one conditional
Gabefire May 20, 2024
223e63a
deleted test
Gabefire May 20, 2024
e29f223
merged
Gabefire May 20, 2024
ca0180e
added test
Gabefire May 20, 2024
0ef466d
:art: Cleaned
github-actions[bot] May 20, 2024
ec4b69a
:memo: README updated
github-actions[bot] May 20, 2024
c5217ca
removed test
Gabefire May 20, 2024
f98b31d
testing name change
Gabefire May 20, 2024
3788a25
:art: Cleaned
github-actions[bot] May 20, 2024
b241637
maded small change
Gabefire May 20, 2024
6cc6fb8
:art: Cleaned
github-actions[bot] May 20, 2024
7052c04
:memo: README updated
github-actions[bot] May 20, 2024
d500372
modified file back
Gabefire May 20, 2024
77757bd
:art: Cleaned
github-actions[bot] May 20, 2024
053a104
:memo: README updated
github-actions[bot] May 20, 2024
8f64d92
modified scripts to ignore certain files
Gabefire May 20, 2024
a5ee97b
renamed notebook workflow to original name
Gabefire May 20, 2024
71e2962
:art: Cleaned
github-actions[bot] May 20, 2024
94c0951
removed template for now
Gabefire May 20, 2024
2c9ccdb
made scripts quieter
Gabefire May 20, 2024
e801da6
made contributing md
Gabefire May 20, 2024
9a12e2c
:art: Cleaned
github-actions[bot] May 20, 2024
d9f9ae7
:memo: README updated
github-actions[bot] May 20, 2024
1c3d428
modifed readme language
Gabefire May 20, 2024
8ecc605
Merge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-pyt…
Gabefire May 20, 2024
cf8391b
modifed contrubuting guide
Gabefire May 20, 2024
f7a9e50
added important section
Gabefire May 20, 2024
fb8f7d2
:art: Cleaned
github-actions[bot] May 20, 2024
30077c7
added emphasis on readme
Gabefire May 20, 2024
b7878bc
Merge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-pyt…
Gabefire May 20, 2024
ec6d088
fixed typos
Gabefire May 20, 2024
529fb11
added readme workflow
Gabefire May 21, 2024
af92ebf
:art: Cleaned
github-actions[bot] May 21, 2024
b296197
fixed workflow
Gabefire May 21, 2024
03bd6d1
Merge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-pyt…
Gabefire May 21, 2024
568f741
:memo: README updated
github-actions[bot] May 21, 2024
ea2db31
fix generator
Gabefire May 21, 2024
f8f9dba
Merge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-pyt…
Gabefire May 21, 2024
9acf6cb
set workflow to merge on pr close
Gabefire May 21, 2024
d9678df
modified format notebook
Gabefire May 22, 2024
06f2aaf
modified files again
Gabefire May 22, 2024
0d3acd0
modified files again
Gabefire May 22, 2024
2878c3a
added conditional to workflow to not run on pr merge
Gabefire May 22, 2024
c3e739a
:art: Cleaned
github-actions[bot] May 22, 2024
afb3dbc
modified contributing md from feedback
Gabefire May 22, 2024
c37fd0c
Merge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-pyt…
Gabefire May 22, 2024
88a6561
removed python version file and changed email for authors
Gabefire May 22, 2024
0224bfe
added comments to workflow to show what they do
Gabefire May 22, 2024
7c259f4
added more info on contributing md from feedback
Gabefire May 22, 2024
526845f
reverted to org workflow to test
Gabefire May 23, 2024
5bb7a9f
testing bug
Gabefire May 23, 2024
404db42
moved migration guide to somewhere that makes sense
Gabefire May 23, 2024
8e67bb2
:art: Cleaned
github-actions[bot] May 23, 2024
395681d
:memo: README updated
github-actions[bot] May 23, 2024
5456cfc
tested bug
Gabefire May 23, 2024
b5b0f12
Merge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-pyt…
Gabefire May 23, 2024
0eca7a3
testing removing pandas fixes bug
Gabefire May 23, 2024
040ab0c
switched to var rye version bug was fixed
Gabefire May 23, 2024
10a8c58
remove python version file in example notebooks not needed
Gabefire May 23, 2024
e487a71
removed broken notebook until reworked
Gabefire May 23, 2024
b31c8e4
Merge branch 'develop' into gu/added_formattor
Gabefire May 23, 2024
4e451b6
fixed merge conflict
Gabefire May 23, 2024
914d820
squashed custom
Gabefire May 22, 2024
5231a40
Merge branch 'gu/added_formattor' of github.com:Labelbox/labelbox-pyt…
Gabefire May 23, 2024
9a0e086
added generate readme
Gabefire May 23, 2024
5337e09
:memo: README updated
github-actions[bot] May 23, 2024
94649ad
Merge branch 'develop' into gu/added_formattor
Gabefire May 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 58 additions & 11 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Labelbox Python SDK Notebooks (Develop)
name: Labelbox Example Notebook Workflow

on:
push:
Expand All @@ -13,25 +13,72 @@ on:
permissions:
contents: write
pull-requests: write

jobs:
update:
# Get installs from rye and run rye run clean to format
format:
if: github.event.pull_request.merged == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Install databooks
run: pip install databooks
- name: Remove notebook metadata
run: echo "y" | databooks meta examples/. --rm-outs
- uses: ./.github/actions/python-package-shared-setup
with:
rye-version: ${{ vars.RYE_VERSION }}
python-version: 3.12
- name: Format
working-directory: examples
run: rye run clean
- name: Commit changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add examples/.
git commit -m ":art: Cleaned" || exit 0
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
# See if notebooks were added or deleted (name change counts as both)
changes:
needs: format
if: github.event.pull_request.merged == false
runs-on: ubuntu-latest
outputs:
addedOrModified: ${{ steps.filter.outputs.addedOrModified }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
addedOrModified:
- added|deleted: 'examples/**/*.ipynb'
# Create readme if the above job shows true using rye run create-readme
create:
needs: changes
if: ${{ needs.changes.outputs.addedOrModified == 'true' }} && github.event.pull_request.merged == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: ./.github/actions/python-package-shared-setup
with:
rye-version: ${{ vars.RYE_VERSION }}
python-version: 3.12
- name: Create readme
working-directory: examples
run: rye run create-readme
- name: Commit changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add examples/.
git commit -m "Removed metadata" || exit 0
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add examples/.
git commit -m ":memo: README updated" || exit 0
- name: Push changes
uses: ad-m/github-push-action@master
with:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/rdme-custompages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: ReadMe GitHub Action 🦉

on:
pull_request:
branches: [develop]
types:
- closed
paths:
- examples/README.md

jobs:
custompages:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/python-package-shared-setup
with:
rye-version: ${{ vars.RYE_VERSION }}
python-version: 3.12
- name: Create readme
working-directory: examples
run: rye run create-doc-readme
- name: Run `custompages` command
uses: readmeio/rdme@v8
with:
rdme: custompages examples/tutorials.html --key=${{ secrets.README_API_KEY }}
52 changes: 52 additions & 0 deletions examples/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contribution Guide

Thank you for contributing to our notebook examples! To ensure that your contribution aligns with our guidelines, please carefully review the following guide.

## Table of Contents

- [General Notebook Requirements](#general-notebook-requirements)
- [Branches and Tags](#branches-and-tags)
- [Github Workflows](#github-workflows)
- [General Prerequisites](#general-prerequisites)
- [Styling Tools](#styling-tools)

## General Notebook Requirements

Review our [template notebook](template.ipynbs) for general overview on how notebooks should be structure. This notebook and section just serves as a guide and exceptions can be made. Here are our general requirements:

1. Ensure that any modified notebooks run when edited.
2. Ensure that you update any relevant headers and comments within the code block you may add or change.
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.
4. Use "labelbox[data]" over labelbox for installs to ensure you have the correct dependencies.
5. Imports and installs should come after the main header under a **Setup** section.
6. Labelbox and other platforms with clients and API keys should be specified under a single section.
7. Subsections need a second level header **##** and an overview of the section.
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.
9. Notebook github action [workflows](#github-workflows) are required to run successfully before merging.

> [!IMPORTANT]
> Please make sure to remove any API keys before pushing changes

## Branches and Tags

- All development happens in feature branches ideally prefixed by contributor's initials. For example `fs/feature_name`.
- Approved PRs are merged to the `develop` branch.
- All releases align to a git tag.

## Github Workflows

- Github Branch Workflow
- 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.
- If your push contains new notebooks or modifies the names of notebooks the readme will be updated to reflect the change with updated links.

## General Prerequisites

[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.

## Styling Tools

Rye is setup in this directory to use a customs script that will run the notebooks through our formatting tools and create readmes.

- `rye sync` in the examples folder to install the correct dev dependencies.
- `rye run clean` runs a series of formatting tools.
- `rye run create-readme` creates a readme based off our notebooks.
3 changes: 0 additions & 3 deletions examples/Makefile

This file was deleted.

Loading
Loading