Skip to content

Commit

Permalink
Remove RunnerInput/RunnerOutput types aliases to Input/Output (
Browse files Browse the repository at this point in the history
…#1207)

**Description of PR**
We renamed `RunnerInput` and `RunnerOutput` to `Input`/`Output` to
streamline terminology for the new decorators. As the
`script_pydantic_io` is an experimental feature, and the only change is
to rename references to the types, we are making a breaking change to
remove the type aliases. Users can do `import hera.workflows.io.Input as
RunnerInput` if they want to avoid code changes elsewhere in their
codebase.

Signed-off-by: Elliot Gunton <[email protected]>
  • Loading branch information
elliotgunton authored Sep 18, 2024
1 parent 8cb375a commit a787965
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
4 changes: 0 additions & 4 deletions docs/user-guides/script-runner-io.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Script Runner IO

> ⚠️ The `RunnerInput` and `RunnerOutput` classes have been renamed to align on the [decorators](decorators.md) feature
> and are deprecated since `v5.16.0`, please use `Input` and `Output` for equivalent functionality. The "Runner*" type
> aliases will be removed in `v5.17.0`.
Hera provides the `Input` and `Output` Pydantic classes which can be used to more succinctly write your
script function inputs and outputs, and requires use of the Hera Runner. Use of these classes also requires the
`"script_pydantic_io"` experimental feature flag to be enabled:
Expand Down
4 changes: 1 addition & 3 deletions src/hera/workflows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
TemplateNameConflict,
)
from hera.workflows.http_template import HTTP
from hera.workflows.io import Input, Output, RunnerInput, RunnerOutput
from hera.workflows.io import Input, Output
from hera.workflows.metrics import Counter, Gauge, Histogram, Label, Metric, Metrics
from hera.workflows.operator import Operator
from hera.workflows.parameter import Parameter
Expand Down Expand Up @@ -159,8 +159,6 @@
"Resources",
"RetryPolicy",
"RetryStrategy",
"RunnerInput",
"RunnerOutput",
"RunnerScriptConstructor",
"S3Artifact",
"ScaleIOVolume",
Expand Down
2 changes: 1 addition & 1 deletion src/hera/workflows/_runner/script_annotations_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def map_field(
kwargs: Dict[str, str],
) -> Any:
annotation = runner_input_annotations.get(field)
assert annotation is not None, "RunnerInput fields must be type-annotated"
assert annotation is not None, "Input fields must be type-annotated" # Note: not necessarily with `Annotated`
ann_type = unwrap_annotation(annotation)

if param_or_artifact := get_workflow_annotation(annotation):
Expand Down
8 changes: 0 additions & 8 deletions src/hera/workflows/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
"""Hera IO models."""

from typing import Type

from pydantic import VERSION

if VERSION.split(".")[0] == "2":
from hera.workflows.io.v2 import Input, Output

RunnerInput: Type = Input
RunnerOutput: Type = Output
else:
from hera.workflows.io.v1 import Input, Output # type: ignore

RunnerInput: Type = Input # type: ignore
RunnerOutput: Type = Output # type: ignore

__all__ = [
"Input",
"Output",
"RunnerInput",
"RunnerOutput",
]

0 comments on commit a787965

Please sign in to comment.