From 9b6ab391ba95828e400ad64655e34f81d86ed271 Mon Sep 17 00:00:00 2001 From: seanmcculloch Date: Fri, 13 Mar 2026 12:12:41 -0700 Subject: [PATCH 1/3] feat: sync-app-panel workflow --- .../sync_app_panel.properties.json | 11 ++++ workflow-templates/sync_app_panel.yml | 57 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 workflow-templates/sync_app_panel.properties.json create mode 100644 workflow-templates/sync_app_panel.yml diff --git a/workflow-templates/sync_app_panel.properties.json b/workflow-templates/sync_app_panel.properties.json new file mode 100644 index 0000000..697fd98 --- /dev/null +++ b/workflow-templates/sync_app_panel.properties.json @@ -0,0 +1,11 @@ +{ + "name": "Sync App Panel", + "description": "Auto-generate CodeOcean app-panel.json from a library's BaseSettings or argparse class using auto-app-panel", + "iconName": "mouse_robot", + "categories": [ + "Python", "CodeOcean", "CI" + ], + "filePatterns": [ + ".codeocean/app-panel.json" + ] +} \ No newline at end of file diff --git a/workflow-templates/sync_app_panel.yml b/workflow-templates/sync_app_panel.yml new file mode 100644 index 0000000..916c835 --- /dev/null +++ b/workflow-templates/sync_app_panel.yml @@ -0,0 +1,57 @@ +name: Sync App Panel + +on: + push: + branches: + - $default-branch + workflow_dispatch: + +jobs: + sync-app-panel: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout capsule repo + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install library from environment.json + run: | + pip install auto-app-panel + pip install $(python -c " + import json + env = json.load(open('.codeocean/environment.json')) + for pkg in env['installers']['pip']['packages']: + print(f\"{pkg['name']}=={pkg['version']}\") + ") + + # Configure: set path relative to site-packages to the python module with arg definitions + # e.g. "$SITE/aind_metadata_manager/metadata_manager.py" + # --strategy [overwrite|preserve] - Merge strategy (default: preserve) + # overwrite: Updates parameter values from code, preserves existing descriptions + # preserve: Keeps all existing values, only adds new parameters + # --no-backup - Skip creating timestamped backup of existing file + # https://pypi.org/project/auto-app-panel/ + - name: Run auto-app-panel + run: | + SITE=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))") + auto-app-panel \ + "$SITE/your_package/your_module.py" \ + .codeocean/app-panel.json \ + --strategy preserve \ + --no-backup + + - name: Commit changes (if any) + run: | + git diff --quiet .codeocean/app-panel.json && exit 0 + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add .codeocean/app-panel.json + git commit -m "ci: sync app-panel.json [skip actions]" + git push From d2a5cb959fa5476eb41c7a7b0fe3f9f9fb3985b3 Mon Sep 17 00:00:00 2001 From: seanmcculloch Date: Fri, 13 Mar 2026 12:26:13 -0700 Subject: [PATCH 2/3] support local and 3rd party module source --- workflow-templates/sync_app_panel.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/workflow-templates/sync_app_panel.yml b/workflow-templates/sync_app_panel.yml index 916c835..7e8c6ee 100644 --- a/workflow-templates/sync_app_panel.yml +++ b/workflow-templates/sync_app_panel.yml @@ -31,8 +31,9 @@ jobs: print(f\"{pkg['name']}=={pkg['version']}\") ") - # Configure: set path relative to site-packages to the python module with arg definitions - # e.g. "$SITE/aind_metadata_manager/metadata_manager.py" + # Configure: set SOURCE to the module containing your BaseSettings/argparse class + # local file: "code/run_capsule.py" + # installed package: "my_package/settings.py" (resolved from site-packages) # --strategy [overwrite|preserve] - Merge strategy (default: preserve) # overwrite: Updates parameter values from code, preserves existing descriptions # preserve: Keeps all existing values, only adds new parameters @@ -40,9 +41,15 @@ jobs: # https://pypi.org/project/auto-app-panel/ - name: Run auto-app-panel run: | - SITE=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))") + SOURCE="your_package/your_module.py" + if [ -f "$SOURCE" ]; then + TARGET="$SOURCE" + else + SITE=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))") + TARGET="$SITE/$SOURCE" + fi auto-app-panel \ - "$SITE/your_package/your_module.py" \ + "$TARGET" \ .codeocean/app-panel.json \ --strategy preserve \ --no-backup From 4dc995264b6bf1fe3f5954ac685e8713ebc7f27b Mon Sep 17 00:00:00 2001 From: seanmcculloch Date: Fri, 13 Mar 2026 12:27:38 -0700 Subject: [PATCH 3/3] docs: update comment --- workflow-templates/sync_app_panel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow-templates/sync_app_panel.yml b/workflow-templates/sync_app_panel.yml index 7e8c6ee..30ed3ad 100644 --- a/workflow-templates/sync_app_panel.yml +++ b/workflow-templates/sync_app_panel.yml @@ -32,8 +32,8 @@ jobs: ") # Configure: set SOURCE to the module containing your BaseSettings/argparse class - # local file: "code/run_capsule.py" - # installed package: "my_package/settings.py" (resolved from site-packages) + # EG: local file: "code/run_capsule.py" + # EG: installed package: "my_package/settings.py" (gets resolved from site-packages) # --strategy [overwrite|preserve] - Merge strategy (default: preserve) # overwrite: Updates parameter values from code, preserves existing descriptions # preserve: Keeps all existing values, only adds new parameters