flytekit.extend.Interface#

class flytekit.extend.Interface(inputs=None, outputs=None, output_tuple_name=None, docstring=None)[source]#

A Python native interface object, like inspect.signature but simpler.

Parameters
  • inputs (Union[Optional[Dict[str, Type]], Optional[Dict[str, Tuple[Type, Any]]]]) –

  • outputs (Union[Optional[Dict[str, Type]], Optional[Dict[str, Optional[Type]]]]) –

  • output_tuple_name (Optional[str]) –

  • docstring (Optional[Docstring]) –

__init__(inputs=None, outputs=None, output_tuple_name=None, docstring=None)[source]#
Parameters
  • outputs (Union[Dict[str, Type], None, Dict[str, Optional[Type]]]) – Output variables and their types as a dictionary

  • inputs (Union[Dict[str, Type], None, Dict[str, Tuple[Type, Any]]]) – Map of input name to either a tuple where the first element is the python type, and the second value is the default, or just a single value which is the python type. The latter case is used by tasks for which perhaps a default value does not make sense. For consistency, we turn it into a tuple.

  • output_tuple_name (Optional[str]) – This is used to store the name of a typing.NamedTuple when the task or workflow returns one. This is also used as a proxy for better or for worse for the presence of a tuple return type, primarily used when handling one-element NamedTuples.

  • docstring (Optional[flytekit.core.docstring.Docstring]) – Docstring of the annotated @task or @workflow from which the interface derives from.

Methods

__init__([inputs, outputs, ...])

param outputs

Output variables and their types as a dictionary

remove_inputs(vars)

This method is useful in removing some variables from the Flyte backend inputs specification, as these are implicit local only inputs or will be supplied by the library at runtime.

with_inputs(extra_inputs)

Use this to add additional inputs to the interface.

with_outputs(extra_outputs)

This method allows addition of extra outputs are expected from a task specification

Attributes

default_inputs_as_kwargs

docstring

inputs

inputs_with_defaults

output_names

output_tuple

output_tuple_name

outputs