Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Prepares the Python SDK for v2.0.0 by introducing new, more consistent execution APIs and adding deprecations for soon-to-be-removed behaviors (no-wait methods, string durations, non-async durable tasks, and internal Context/client accessors).
Changes:
- Add
wait_for_resultto workflow/taskrun*andaio_run*APIs, deprecating the*_no_waitvariants. - Add deprecation warnings for string duration inputs and non-async durable tasks.
- Deprecate internal
Context/RunsClientproperties via private fields + warning-emitting accessors; bump version and changelog.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| sdks/python/pyproject.toml | Bumps SDK version to 1.29.0. |
| sdks/python/hatchet_sdk/utils/timedelta_to_expression.py | Adds helper to warn on deprecated string durations. |
| sdks/python/hatchet_sdk/utils/aio.py | Extends gather_max_concurrency typing/behavior to support return_exceptions. |
| sdks/python/hatchet_sdk/runnables/workflow.py | Adds wait_for_result across run APIs; deprecates no-wait methods; updates async bulk result collection. |
| sdks/python/hatchet_sdk/runnables/task.py | Warns on deprecated non-async durable tasks. |
| sdks/python/hatchet_sdk/hatchet.py | Deprecates debug/client ctor params and adjusts config/debug handling. |
| sdks/python/hatchet_sdk/features/runs.py | Converts internal dependencies to private fields and adds warning properties for internal access. |
| sdks/python/hatchet_sdk/context/context.py | Deprecates internal Context fields via warning properties; adds new cancellation and async helper methods. |
| sdks/python/hatchet_sdk/config.py | Adds debug to ClientConfig settings. |
| sdks/python/hatchet_sdk/conditions.py | Warns when SleepCondition is constructed with string duration. |
| sdks/python/CHANGELOG.md | Documents 1.29.0 additions/deprecations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def run_many( | ||
| self, | ||
| workflows: list[WorkflowRunTriggerConfig], | ||
| return_exceptions: bool = False, |
There was a problem hiding this comment.
The overload for run_many(..., *, wait_for_result: Literal[False]) makes wait_for_result keyword-only, but the implementation allows it positionally (def run_many(..., return_exceptions=False, wait_for_result=True)). Align the implementation signature with the overload (e.g., make wait_for_result keyword-only) to avoid type-checker/runtime inconsistencies.
| return_exceptions: bool = False, | |
| return_exceptions: bool = False, | |
| *, |
| ) -> list[R] | list[R | BaseException]: | ||
| self, | ||
| workflows: list[WorkflowRunTriggerConfig], | ||
| return_exceptions: bool = False, |
There was a problem hiding this comment.
The overload for run_many(..., *, wait_for_result: Literal[False]) makes wait_for_result keyword-only, but the implementation allows it positionally. Adjust the implementation signature to match the overload to keep typing consistent for Standalone.run_many.
| return_exceptions: bool = False, | |
| return_exceptions: bool = False, | |
| *, |
| async def aio_run_many( | ||
| self, workflows: list[WorkflowRunTriggerConfig], return_exceptions: bool = False | ||
| ) -> list[R] | list[R | BaseException]: | ||
| self, | ||
| workflows: list[WorkflowRunTriggerConfig], | ||
| return_exceptions: bool = False, | ||
| wait_for_result: bool = True, | ||
| ) -> list[R] | list[R | BaseException] | list[TaskRunRef[TWorkflowInput, R]]: |
There was a problem hiding this comment.
The overload for aio_run_many(..., *, wait_for_result: Literal[False]) makes wait_for_result keyword-only, but the implementation allows it positionally. Update the implementation signature (keyword-only) or the overload so type checkers and runtime calls agree for Standalone.aio_run_many.
| async def aio_run_many( | ||
| self, | ||
| workflows: list[WorkflowRunTriggerConfig], | ||
| return_exceptions: bool = False, | ||
| ) -> list[dict[str, Any]] | list[dict[str, Any] | BaseException]: | ||
| wait_for_result: bool = True, | ||
| ) -> ( |
There was a problem hiding this comment.
The overload for aio_run_many(..., *, wait_for_result: Literal[False]) makes wait_for_result keyword-only, but the implementation allows it positionally. Make wait_for_result keyword-only in the implementation (or remove the * from the overload) so the type hints match actual call semantics.
|
📝 Documentation updates detected! New suggestion: Document Python SDK v2.0.0 deprecations and new Context API Tip: Sort by Shortest Review in the Dashboard to find quick wins ⚡ |
|
📝 Documentation updates detected! New suggestion: Document Python SDK v2.0.0 deprecations and new Context API Tip: Use Vale? Add your vale.ini when setting up your Docs Collection. |
6ab9b38 to
528dc3b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 252 out of 252 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
sdks/python/hatchet_sdk/clients/dispatcher/dispatcher.py:247
async_upsert_worker_labelsstill accepts adict[str, str | int]and manually buildsWorkerLabels, whileupsert_worker_labelswas changed to acceptlist[WorkerLabel]. This inconsistency makes the API confusing and undermines the new label type; consider updating the async method to acceptlist[WorkerLabel](or deprecate/remove it) and share the same conversion logic.
Description
[1.29.0] - 2026-03-16
Added
wait_for_resultparameter torun(),aio_run(),run_many(), andaio_run_many()on bothWorkflowandStandalone. Passingwait_for_result=Falsereplaces therun_no_wait/aio_run_no_wait/run_many_no_wait/aio_run_many_no_waitmethods.WorkerLabelfrom the top-levelhatchet_sdkpackage, alongside the existingDesiredWorkerLabelandWorkerLabelComparator.Priority,ConcurrencyExpression,ConcurrencyLimitStrategy,RateLimit,RateLimitDuration,StickyStrategy,SlotType,BulkPushEventOptions,BulkPushEventWithMetadata,PushEventOptions, andWorkflowRunTriggerConfigfrom the top-levelhatchet_sdkpackage.current_contextproperty toHatchetas a replacement for the deprecatedget_current_context()method.Changed
worker_labelsanddesired_worker_labelsare now stored internally aslist[WorkerLabel]/list[DesiredWorkerLabel]and converted to the protobuf representation at the last moment, rather than eagerly at construction time.Deprecated
run_no_wait(),aio_run_no_wait(),run_many_no_wait(), andaio_run_many_no_wait()are deprecated in favor ofrun(wait_for_result=False),aio_run(wait_for_result=False),run_many(wait_for_result=False), andaio_run_many(wait_for_result=False)respectively.schedule_timeout,execution_timeout) as strings is deprecated. Usetimedeltaobjects instead.worker_labelsas adicttohatchet.worker()is deprecated. Use alist[WorkerLabel]with thekeyfield set instead.desired_worker_labelsas adictto task decorators (@workflow.task,@hatchet.task, etc.) is deprecated. Use alist[DesiredWorkerLabel]with thekeyfield set instead.desired_worker_labelas adicttoTriggerWorkflowOptionsis deprecated. Use alist[DesiredWorkerLabel]with thekeyfield set instead.priorityas anintto task and workflow decorators is deprecated. UsePriority.LOW,Priority.MEDIUM, orPriority.HIGHinstead.comparatoras aninttoDesiredWorkerLabelis deprecated. UseWorkerLabelComparatorenum values instead.debugparameter onHatchet()is deprecated. Set debug mode via theHATCHET_CLIENT_DEBUGenvironment variable instead.clientparameter onHatchet()is deprecated and will be removed in v2.0.0.Hatchet.get_current_context()is deprecated. Use theHatchet.current_contextproperty instead.Context.step_run_idis deprecated. UseContext.task_run_idinstead.Context.workflow_inputandContext.inputare deprecated. Use the input argument passed directly to the task function instead.Context.aio_task_output()is deprecated. UseContext.task_output()instead.Context.doneis deprecated. UseContext.is_cancelledinstead.Context.fetch_task_run_error()is deprecated. UseContext.get_task_run_error()instead.WorkerandContextthat are not intended for public use. These will be removed in v2.0.0.Type of change