From 558f3cabfa181aa51abc845b9092b4080c6f3fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= Date: Mon, 18 Sep 2023 13:42:58 +0200 Subject: [PATCH] fix schema generation, rename automate sdk to automation context --- .github/workflows/main.yml | 4 ++-- automate_sdk.py => automation_context.py | 0 main.py | 7 ++----- obj_res.py | 10 ---------- tests/test_function.py | 2 +- 5 files changed, 5 insertions(+), 18 deletions(-) rename automate_sdk.py => automation_context.py (100%) delete mode 100644 obj_res.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 642803f..0b32173 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: - name: Extract functionInputSchema id: extract_schema run: | - echo $(python schema_generation.py) > ${HOME}/${{ env.FUNCTION_SCHEMA_FILE_NAME }} + python main.py generate_schema ${HOME}/${{ env.FUNCTION_SCHEMA_FILE_NAME }} - name: Speckle Automate Function - Build and Publish uses: specklesystems/speckle-automate-github-composite-action@0.4.2 with: @@ -36,4 +36,4 @@ jobs: speckle_token: ${{ secrets.SPECKLE_FUNCTION_TOKEN }} speckle_function_id: ${{ secrets.SPECKLE_FUNCTION_ID }} speckle_function_input_schema_file_path: ${{ env.FUNCTION_SCHEMA_FILE_NAME }} - speckle_function_command: 'python main.py' + speckle_function_command: 'python main.py run' diff --git a/automate_sdk.py b/automation_context.py similarity index 100% rename from automate_sdk.py rename to automation_context.py diff --git a/main.py b/main.py index 0a420b4..76b4e3c 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,8 @@ """This module contains the business logic of the function. -Make sure that this module exposes a `FunctionInputs` class -and an `automate_function` function definition. +use the automation_context module to wrap your function in an Autamate context helper """ -from specklepy.objects.geometry import Mesh - -from automate_sdk import ( +from automation_context import ( AutomateBase, AutomationContext, execute_automate_function, diff --git a/obj_res.py b/obj_res.py deleted file mode 100644 index fa0436a..0000000 --- a/obj_res.py +++ /dev/null @@ -1,10 +0,0 @@ -from automate_sdk import AutomationResult, ObjectResult, ObjectResultLevel - -res = AutomationResult() - - -res.object_results["foobar"].append( - ObjectResult(level=ObjectResultLevel.ERROR, status_message="foobar") -) - -print(res.model_dump(by_alias=True)) diff --git a/tests/test_function.py b/tests/test_function.py index cfea74d..ba21721 100644 --- a/tests/test_function.py +++ b/tests/test_function.py @@ -11,7 +11,7 @@ from specklepy.api.client import SpeckleClient from specklepy.objects.base import Base from specklepy.transports.server import ServerTransport -from automate_sdk import ( +from automation_context import ( AutomationContext, AutomationRunData, AutomationStatus,