flytekit.extend.TypeEngine#
- class flytekit.extend.TypeEngine[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[, type_hints])Given a dictionary mapping string keys to python values and a dictionary containing guessed types for such string keys, convert to a LiteralMap.
dict_to_literal_map_pb
(ctx, d[, type_hints])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.lazy_import_transformers
()Only load the transformers if needed.
literal_map_to_kwargs
(ctx, lm[, ...])Given a
LiteralMap
(usually an input into a task - intermediate), convert to kwargs for the tasknamed_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_additional_type
(transformer, ...[, ...])register_restricted_type
(name, type)to_html
(ctx, python_val, expected_python_type)to_literal
(ctx, python_val, python_type, ...)Converts a python value of a given type and expected
LiteralType
into a resolvedLiteral
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.
Attributes
has_lazy_import