Input Output ============ Code generated from the input- and output-definitions of a Studio workflow function. For a dataset input and an output the code editor would add: .. code-block:: python @dataclass(kw_only=True) class Inputs(BaseInputs): dsi: In.Dataset # "dsi" @dataclass(kw_only=True) class Outputs(BaseOutputs): dso: Out.Dataset # "dso" The Inputs and Outputs classes will have all the inputs and outputs defined as attributes. The commented strings show the original names of the inputs and outputs as defined in the workflow function. An example of a function using these generated classes: .. code-block:: python def f(inputs: Inputs) -> Outputs: arrow_table = inputs.dsi.arrow() outputs = Outputs( dso = Out.Dataset(arrow_table) ) return outputs Here the input ``dsi`` is to create a ``pyarrow.Table`` using the ``.arrow()`` method and output ``dso`` is returned as a Studio Dataset using the ``Out.Dataset`` class. The dataset input and output have an attribute ``multiple``. Enabling this would generate ``In.`` and ``Out.Datasets``: .. code-block:: python @dataclass(kw_only=True) class Inputs(BaseInputs): mdsi: In.Datasets # "mdsi" @dataclass(kw_only=True) class Outputs(BaseOutputs): mdso: Out.Datasets # "mdso" Multi-input and outputs (also called ``Packages``) can be used when a function need to produce or consume several files or datasets. An example of a function using these generated classes: .. code-block:: python def f(inputs: Inputs) -> Outputs: tables = [] for item in inputs.mdsi.iter(): inp = item.load() tables.append(inp.arrow()) outputs = Outputs( mdso = tables ) return outputs .. automodule:: workflow_utils.input_output :members: :undoc-members: :show-inheritance: :exclude-members: BaseInputs, BaseOutputs, collect_inputs, get_base_model_type