flytekit.extend.TypeEngine

class flytekit.extend.TypeEngine(*args, **kwds)[source]

Core Extensible TypeEngine of Flytekit. This should be used to extend the capabilities of FlyteKits type system. Users can implement their own TypeTransformers and register them with the TypeEngine. This will allow special handling of user objects

__init__()

Methods

__init__()

dict_to_literal_map(ctx, d[, ...])

Given a dictionary mapping string keys to python values and a dictionary containing guessed types for such string keys, convert to a LiteralMap.

get_available_transformers()

Returns all python types for which transformers are available

get_transformer(python_type)

The TypeEngine hierarchy for flyteKit.

guess_python_type(flyte_type)

Transforms a flyte-specific LiteralType to a regular python value.

guess_python_types(flyte_variable_dict)

Transforms a dictionary of flyte-specific Variable objects to a dictionary of regular python values.

literal_map_to_kwargs(ctx, lm, python_types)

Given a LiteralMap (usually an input into a task - intermediate), convert to kwargs for the task

named_tuple_to_variable_map(t)

Converts a python-native NamedTuple to a flyte-specific VariableMap of named literals.

register(transformer[, additional_types])

This should be used for all types that respond with the right type annotation when you use type(...) function

register_restricted_type(name, type)

to_literal(ctx, python_val, python_type, ...)

Converts a python value of a given type and expected LiteralType into a resolved Literal value.

to_literal_type(python_type)

Converts a python type into a flyte specific LiteralType

to_python_value(ctx, lv, expected_python_type)

Converts a Literal value with an expected python type into a python value.