flytekit.extend.TypeTransformer#

class flytekit.extend.TypeTransformer(name, t, enable_type_assertions=True)[source]#

Base transformer type that should be implemented for every python native type that can be handled by flytekit

Parameters
  • name (str) –

  • t (Type[T]) –

  • enable_type_assertions (bool) –

__init__(name, t, enable_type_assertions=True)[source]#
Parameters
  • name (str) –

  • t (Type[flytekit.core.type_engine.T]) –

  • enable_type_assertions (bool) –

Methods

__init__(name, t[, enable_type_assertions])

assert_type(t, v)

get_literal_type(t)

Converts the python type to a Flyte LiteralType

guess_python_type(literal_type)

Converts the Flyte LiteralType to a python object type.

to_html(ctx, python_val, expected_python_type)

Converts any python val (dataframe, int, float) to a html string, and it will be wrapped in the HTML div

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

Converts a given python_val to a Flyte Literal, assuming the given python_val matches the declared python_type.

to_python_value(ctx, lv, expected_python_type)

Converts the given Literal to a Python Type.

Attributes

name

python_type

This returns the python type

type_assertions_enabled

Indicates if the transformer wants type assertions to be enabled at the core type engine layer