From a98c61718250a224c350091d9b0ab78b25986c6a Mon Sep 17 00:00:00 2001 From: Chad Dombrova Date: Fri, 13 Jun 2025 21:32:14 -0700 Subject: [PATCH 1/4] ci: Automatically push updates to stubs to the current branch Signed-off-by: Chad Dombrova --- .github/workflows/wheel.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index 759312d956..51a99b25bb 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -82,6 +82,10 @@ jobs: if: | github.event_name != 'schedule' || github.repository == 'AcademySoftwareFoundation/OpenImageIO' + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write strategy: matrix: include: @@ -169,6 +173,10 @@ jobs: # if stub validation fails we want to upload the stubs for users to review if: success() || failure() + # Commit all changed files back to the repository + - uses: stefanzweifel/git-auto-commit-action@v6 + commit_message: "Automatic update to python stubs" + # --------------------------------------------------------------------------- # Linux ARM Wheels # --------------------------------------------------------------------------- From 6ebf3e7fa3340084ee1a2f79706ae2170c8a18ef Mon Sep 17 00:00:00 2001 From: Chad Dombrova Date: Fri, 13 Jun 2025 21:35:19 -0700 Subject: [PATCH 2/4] Temp change to trigger update Signed-off-by: Chad Dombrova --- src/python/stubs/generate_stubs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/stubs/generate_stubs.py b/src/python/stubs/generate_stubs.py index 37826c1b52..68e6e5c303 100644 --- a/src/python/stubs/generate_stubs.py +++ b/src/python/stubs/generate_stubs.py @@ -30,8 +30,8 @@ class OIIOSignatureGenerator(AdvancedSignatureGenerator): sig_matcher = AdvancedSigMatcher( signature_overrides={ # signatures for these special methods include many inaccurate overloads - "*.__ne__": "(self, other: object) -> bool", - "*.__eq__": "(self, other: object) -> bool", + # "*.__ne__": "(self, other: object) -> bool", + # "*.__eq__": "(self, other: object) -> bool", }, arg_type_overrides={ # FIXME: Buffer may in fact be more accurate here From 88a34252efcc9fa98d2f212abf186a2bbf9bcdaf Mon Sep 17 00:00:00 2001 From: Chad Dombrova Date: Fri, 13 Jun 2025 21:39:11 -0700 Subject: [PATCH 3/4] fix Signed-off-by: Chad Dombrova --- .github/workflows/wheel.yml | 26 +++++++++++++++++++++----- src/python/stubs/generate_stubs.py | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index 51a99b25bb..da99182b52 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -147,6 +147,9 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Install Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 @@ -171,11 +174,24 @@ jobs: ./wheelhouse/*.whl ./wheelhouse/OpenImageIO/__init__.pyi # if stub validation fails we want to upload the stubs for users to review - if: success() || failure() - - # Commit all changed files back to the repository - - uses: stefanzweifel/git-auto-commit-action@v6 - commit_message: "Automatic update to python stubs" +# if: success() || failure() + + - name: Copy stubs to repo + run: | + pwd + ls -la . + ls -la ./wheelhouse/ + if [ -f ./wheelhouse/OpenImageIO/__init__.pyi ]; then + echo "Copying stubs into repo" + cp ./wheelhouse/OpenImageIO/__init__.pyi ./src/python/stubs/OpenImageIO/__init__.pyi + fi +# if: failure() + + - name: Commit changed stubs back to the repository + uses: stefanzweifel/git-auto-commit-action@v6 + with: + commit_message: "Automatic update to python stubs" +# if: failure() # --------------------------------------------------------------------------- # Linux ARM Wheels diff --git a/src/python/stubs/generate_stubs.py b/src/python/stubs/generate_stubs.py index 68e6e5c303..62fd2a8369 100644 --- a/src/python/stubs/generate_stubs.py +++ b/src/python/stubs/generate_stubs.py @@ -209,7 +209,7 @@ def main() -> None: print(get_colored_diff(old_text, new_text)) print("Run `make pystubs` locally and commit the results for review.") print("The resulting __init__.pyi file will be uploaded as an artifact on this job.") - sys.exit(2) + # sys.exit(2) if __name__ == "__main__": From 656869b0092cb585bf5027b5a2f29a22437def89 Mon Sep 17 00:00:00 2001 From: Chad Dombrova Date: Thu, 19 Jun 2025 20:52:33 -0700 Subject: [PATCH 4/4] Try a workflow using suggested changes Signed-off-by: Chad Dombrova --- .github/workflows/wheel.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index da99182b52..7fcddc97d6 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -9,7 +9,7 @@ name: Wheel permissions: contents: read - id-token: write + pull-requests: write on: push: @@ -82,10 +82,6 @@ jobs: if: | github.event_name != 'schedule' || github.repository == 'AcademySoftwareFoundation/OpenImageIO' - permissions: - # Give the default GITHUB_TOKEN write permission to commit and push the - # added or changed files to the repository. - contents: write strategy: matrix: include: @@ -147,9 +143,9 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} +# with: +# ref: ${{ github.event.pull_request.head.ref }} +# repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Install Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 @@ -179,19 +175,23 @@ jobs: - name: Copy stubs to repo run: | pwd - ls -la . - ls -la ./wheelhouse/ if [ -f ./wheelhouse/OpenImageIO/__init__.pyi ]; then echo "Copying stubs into repo" cp ./wheelhouse/OpenImageIO/__init__.pyi ./src/python/stubs/OpenImageIO/__init__.pyi + git diff fi # if: failure() - - name: Commit changed stubs back to the repository - uses: stefanzweifel/git-auto-commit-action@v6 +# - name: Commit changed stubs back to the repository +# uses: stefanzweifel/git-auto-commit-action@v6 +# with: +# commit_message: "Automatic update to python stubs" +# # if: failure() + + - uses: parkerbxyz/suggest-changes@v2.0.1 with: - commit_message: "Automatic update to python stubs" -# if: failure() + comment: 'Please commit the suggested changes from the python stub generator.' + event: 'REQUEST_CHANGES' # --------------------------------------------------------------------------- # Linux ARM Wheels