0.1.dev2192+g7c539c3.d20250403

flytekit.models.literals

Directory

Classes

Class Description
Binary
Binding
BindingData
BindingDataCollection
BindingDataMap
Blob
BlobMetadata This is metadata for the Blob literal.
Literal
LiteralCollection
LiteralMap
LiteralOffloadedMetadata
Primitive
RetryStrategy
Scalar
Schema
StructuredDataset
StructuredDatasetMetadata
Union
Void

flytekit.models.literals.Binary

class Binary(
    value,
    tag,
)
Parameter Type
value
tag

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: Binary
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.Binary

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
tag
:rtype: Text
value
:rtype: bytes

flytekit.models.literals.Binding

class Binding(
    var,
    binding,
)

An input/output binding of a variable to either static value or a node output.

Parameter Type
var
binding

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: flytekit.core.models.literals.Binding
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.Binding

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
binding
Data to use to bind this variable.
:rtype: BindingData
is_empty
var
A variable name, must match an input or output variable of the node.
:rtype: Text

flytekit.models.literals.BindingData

class BindingData(
    scalar,
    collection,
    promise,
    map,
)

Specifies either a simple value or a reference to another output. Only one of the input arguments may be specified.

Parameter Type
scalar
collection
promise
map

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
to_literal_model() Converts current binding data into a Literal asserting that there are no promises in the bindings.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> n: BindingData
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.BindingData

to_literal_model()

def to_literal_model()

Converts current binding data into a Literal asserting that there are no promises in the bindings. :rtype: Literal

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
collection
[Optional] A collection of binding data. This allows nesting of binding data to any number of levels.
:rtype: BindingDataCollection
is_empty
map
[Optional] A map of bindings. The key is always a string.
:rtype: BindingDataMap
promise
[Optional] References an output promised by another node.
:rtype: flytekit.models.types.OutputReference
scalar
A simple scalar value.
:rtype: Scalar
value
Returns whichever value is set
:rtype: T

flytekit.models.literals.BindingDataCollection

class BindingDataCollection(
    bindings,
)

A list of BindingData items.

Parameter Type
bindings

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: flytekit.models.literals.BindingDataCollection
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.BindingDataCollection

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
bindings
:rtype: list[BindingData]
is_empty

flytekit.models.literals.BindingDataMap

class BindingDataMap(
    bindings,
)

A map of BindingData items. Can be a recursive structure

Parameter Type
bindings

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: flytekit.models.literals.BindingDataMap
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.BindingDataMap

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
bindings
Map of strings to Bindings
:rtype: dict[string, BindingData]
is_empty

flytekit.models.literals.Blob

class Blob(
    metadata,
    uri,
)

This literal model is used to represent binary data offloaded to some storage location which is identifiable with a unique string. See :py:class:flytekit.FlyteFile as an example.

Parameter Type
metadata
uri

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    proto,
) -> e: Blob
Parameter Type
proto

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.Blob

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
metadata
:rtype: BlobMetadata
uri
:rtype: Text

flytekit.models.literals.BlobMetadata

This is metadata for the Blob literal.

class BlobMetadata(
    type,
)
Parameter Type
type

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    proto,
) -> e: BlobMetadata
Parameter Type
proto

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.BlobMetadata

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
type
:rtype: flytekit.models.core.types.BlobType

flytekit.models.literals.Literal

class Literal(
    scalar: typing.Optional[flytekit.models.literals.Scalar],
    collection: typing.Optional[flytekit.models.literals.LiteralCollection],
    map: typing.Optional[flytekit.models.literals.LiteralMap],
    hash: typing.Optional[str],
    metadata: typing.Optional[typing.Dict[str, str]],
    offloaded_metadata: typing.Optional[flytekit.models.literals.LiteralOffloadedMetadata],
)

This IDL message represents a literal value in the Flyte ecosystem.

Parameter Type
scalar typing.Optional[flytekit.models.literals.Scalar]
collection typing.Optional[flytekit.models.literals.LiteralCollection]
map typing.Optional[flytekit.models.literals.LiteralMap]
hash typing.Optional[str]
metadata typing.Optional[typing.Dict[str, str]]
offloaded_metadata typing.Optional[flytekit.models.literals.LiteralOffloadedMetadata]

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
set_metadata() Note: This is a mutation on the literal.
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object: flyteidl.core.literals_pb2.Literal,
) -> e: Literal
Parameter Type
pb2_object flyteidl.core.literals_pb2.Literal

serialize_to_string()

def serialize_to_string()

set_metadata()

def set_metadata(
    metadata: typing.Dict[str, str],
)

Note: This is a mutation on the literal

Parameter Type
metadata typing.Dict[str, str]

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.Literal

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
collection
If not None, this value holds a collection of Literal values which can be further unpacked.
:rtype: LiteralCollection
hash
If not None, this value holds a hash that represents the literal for caching purposes.
:rtype: str
is_empty
map
If not None, this value holds a map of Literal values which can be further unpacked.
:rtype: LiteralMap
metadata
This value holds metadata about the literal.
offloaded_metadata
This value holds metadata about the offloaded literal.
scalar
If not None, this value holds a scalar value which can be further unpacked.
:rtype: Scalar
value
Returns one of the scalar, collection, or map properties based on which one is set.
:rtype: T

flytekit.models.literals.LiteralCollection

class LiteralCollection(
    literals,
)
Parameter Type
literals

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: LiteralCollection
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.LiteralCollection

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
literals
:rtype: list[Literal]

flytekit.models.literals.LiteralMap

class LiteralMap(
    literals,
)
Parameter Type
literals

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: LiteralMap
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.LiteralMap

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
literals
A dictionary mapping Text key names to Literal objects.
:rtype: dict[Text, Literal]

flytekit.models.literals.LiteralOffloadedMetadata

class LiteralOffloadedMetadata(
    uri: typing.Optional[str],
    size_bytes: typing.Optional[int],
    inferred_type: typing.Optional[flytekit.models.types.LiteralType],
)
Parameter Type
uri typing.Optional[str]
size_bytes typing.Optional[int]
inferred_type typing.Optional[flytekit.models.types.LiteralType]

Methods

Method Description
from_flyte_idl()
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl()
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
)
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
inferred_type
is_empty
size_bytes
uri

flytekit.models.literals.Primitive

class Primitive(
    integer: typing.Optional[int],
    float_value: typing.Optional[float],
    string_value: typing.Optional[str],
    boolean: typing.Optional[bool],
    datetime: typing.Optional[datetime.datetime],
    duration: typing.Optional[datetime.timedelta],
)

This object proxies the primitives supported by the Flyte IDL system. Only one value can be set.

Parameter Type
integer typing.Optional[int]
float_value typing.Optional[float]
string_value typing.Optional[str]
boolean typing.Optional[bool]
datetime typing.Optional[datetime.datetime]
duration typing.Optional[datetime.timedelta]

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    proto,
) -> e: Primitive
Parameter Type
proto

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.Primitive

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
boolean
:rtype: bool
datetime
:rtype: datetime.datetime
duration
:rtype: datetime.timedelta
float_value
:rtype: float
integer
:rtype: int
is_empty
string_value
:rtype: Text
value
This returns whichever field is set.
:rtype: T

flytekit.models.literals.RetryStrategy

class RetryStrategy(
    retries: int,
)
Parameter Type
retries int

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: RetryStrategy
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.RetryStrategy

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
retries
Number of retries to attempt on recoverable failures. If retries is 0, then only one attempt will be made.
:rtype: int

flytekit.models.literals.Scalar

class Scalar(
    primitive: typing.Optional[flytekit.models.literals.Primitive],
    blob: typing.Optional[flytekit.models.literals.Blob],
    binary: typing.Optional[flytekit.models.literals.Binary],
    schema: typing.Optional[flytekit.models.literals.Schema],
    union: typing.Optional[flytekit.models.literals.Union],
    none_type: typing.Optional[flytekit.models.literals.Void],
    error: typing.Optional[flytekit.models.types.Error],
    generic: typing.Optional[google.protobuf.struct_pb2.Struct],
    structured_dataset: typing.Optional[flytekit.models.literals.StructuredDataset],
)

Scalar wrapper around Flyte types. Only one can be specified.

Parameter Type
primitive typing.Optional[flytekit.models.literals.Primitive]
blob typing.Optional[flytekit.models.literals.Blob]
binary typing.Optional[flytekit.models.literals.Binary]
schema typing.Optional[flytekit.models.literals.Schema]
union typing.Optional[flytekit.models.literals.Union]
none_type typing.Optional[flytekit.models.literals.Void]
error typing.Optional[flytekit.models.types.Error]
generic typing.Optional[google.protobuf.struct_pb2.Struct]
structured_dataset typing.Optional[flytekit.models.literals.StructuredDataset]

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: flytekit.models.literals.Scalar
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.Scalar

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
binary
:rtype: Binary
blob
:rtype: Blob
error
:rtype: Error
generic
:rtype: google.protobuf.struct_pb2.Struct
is_empty
none_type
:rtype: Void
primitive
:rtype: Primitive
schema
:rtype: Schema
structured_dataset
union
:rtype: Union
value
Returns whichever value is set
:rtype: T

flytekit.models.literals.Schema

class Schema(
    uri,
    type,
)

A strongly typed schema that defines the interface of data retrieved from the underlying storage medium.

Parameter Type
uri
type

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: Schema
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.Schema

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
type
:rtype: flytekit.models.types.SchemaType
uri
:rtype: Text

flytekit.models.literals.StructuredDataset

class StructuredDataset(
    uri: str,
    metadata: typing.Optional[flytekit.models.literals.StructuredDatasetMetadata],
)

A strongly typed schema that defines the interface of data retrieved from the underlying storage medium.

Parameter Type
uri str
metadata typing.Optional[flytekit.models.literals.StructuredDatasetMetadata]

Methods

Method Description
from_flyte_idl()
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl()
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object: flyteidl.core.literals_pb2.StructuredDataset,
) -> StructuredDataset
Parameter Type
pb2_object flyteidl.core.literals_pb2.StructuredDataset

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
metadata
uri

flytekit.models.literals.StructuredDatasetMetadata

class StructuredDatasetMetadata(
    structured_dataset_type: typing.Optional[flytekit.models.types.StructuredDatasetType],
)
Parameter Type
structured_dataset_type typing.Optional[flytekit.models.types.StructuredDatasetType]

Methods

Method Description
from_flyte_idl()
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl()
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object: flyteidl.core.literals_pb2.StructuredDatasetMetadata,
) -> StructuredDatasetMetadata
Parameter Type
pb2_object flyteidl.core.literals_pb2.StructuredDatasetMetadata

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
structured_dataset_type

flytekit.models.literals.Union

class Union(
    value,
    stored_type,
)

The runtime representation of a tagged union value. See UnionType for more details.

Parameter Type
value
stored_type

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    pb2_object,
) -> e: Schema
Parameter Type
pb2_object

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.Union

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty
stored_type
:rtype: flytekit.models.types.LiteralType
value
:rtype: flytekit.models.literals.Literal

flytekit.models.literals.Void

Methods

Method Description
from_flyte_idl() .
serialize_to_string()
short_string() :rtype: Text.
to_flyte_idl() :rtype: flyteidl.
verbose_string() :rtype: Text.

from_flyte_idl()

def from_flyte_idl(
    proto,
) -> e: Void
Parameter Type
proto

serialize_to_string()

def serialize_to_string()

short_string()

def short_string()

:rtype: Text

to_flyte_idl()

def to_flyte_idl()

:rtype: flyteidl.core.literals_pb2.Void

verbose_string()

def verbose_string()

:rtype: Text

Properties

Property Type Description
is_empty