diff --git a/features/activity/cancel_try_cancel/feature.py b/features/activity/cancel_try_cancel/feature.py index 603ffcb7..0c67d514 100644 --- a/features/activity/cancel_try_cancel/feature.py +++ b/features/activity/cancel_try_cancel/feature.py @@ -66,9 +66,9 @@ async def cancellable_activity() -> None: result = "cancelled" # Send result as signal to workflow - await client.get_workflow_handle_for( - Workflow.run, activity.info().workflow_id or "" - ).signal(Workflow.activity_result, result) + await client.get_workflow_handle(activity.info().workflow_id or "").signal( + Workflow.activity_result, result + ) async def start(runner: Runner) -> WorkflowHandle: diff --git a/features/continue_as_new/continue_as_same/feature.py b/features/continue_as_new/continue_as_same/feature.py index 86cead00..78e42314 100644 --- a/features/continue_as_new/continue_as_same/feature.py +++ b/features/continue_as_new/continue_as_same/feature.py @@ -22,9 +22,9 @@ async def run(self, input: str) -> str: async def start(runner: Runner) -> WorkflowHandle: return await runner.client.start_workflow( - Workflow, + Workflow.run, + INPUT_DATA, id=WORKFLOW_ID, - arg=INPUT_DATA, memo={ MEMO_KEY: MEMO_VALUE, }, diff --git a/features/signal/basic/feature.py b/features/signal/basic/feature.py index 13b2d6df..2a6ed2e4 100644 --- a/features/signal/basic/feature.py +++ b/features/signal/basic/feature.py @@ -22,8 +22,8 @@ async def my_signal(self, arg: str): async def start(runner: Runner) -> WorkflowHandle: - handle: WorkflowHandle = await runner.client.start_workflow( - Workflow, + handle = await runner.client.start_workflow( + Workflow.run, id="workflow-id", task_queue=runner.task_queue, execution_timeout=timedelta(minutes=1), diff --git a/sdkbuild/python.go b/sdkbuild/python.go index 7dc03296..6a2b2675 100644 --- a/sdkbuild/python.go +++ b/sdkbuild/python.go @@ -114,6 +114,19 @@ requires-python = "~=3.10" if err := executeCommand("uv", "sync"); err != nil { return nil, fmt.Errorf("failed installing: %w", err) } + // Install mypy for type checking + if err := executeCommand("uv", "add", "--dev", "mypy"); err != nil { + return nil, fmt.Errorf("failed installing mypy: %w", err) + } + + // Create __init__.py files in feature directories to make them proper Python packages + if err := executeCommand("find", "../features", "-type", "d", "-exec", "touch", "{}/__init__.py", ";"); err != nil { + return nil, fmt.Errorf("failed creating __init__.py files: %w", err) + } + + if err := executeCommand("uv", "run", "mypy", "--explicit-package-bases", "../features"); err != nil { + return nil, fmt.Errorf("failed type checking: %w", err) + } success = true return &PythonProgram{dir}, nil