Flyte Deck#
Contains Deck renderers provided by Flytekit.
- class flytekit.deck.Deck(name, html='', auto_add_to_deck=True)#
Deck enable users to get customizable and default visibility into their tasks.
Deck contains a list of renderers (FrameRenderer, MarkdownRenderer) that can generate a html file. For example, FrameRenderer can render a DataFrame as an HTML table, MarkdownRenderer can convert Markdown string to HTML
Flyte context saves a list of deck objects, and we use renderers in those decks to render the data and create an HTML file when those tasks are executed
Each task has a least three decks (input, output, default). Input/output decks are used to render tasks’ input/output data, and the default deck is used to render line plots, scatter plots or Markdown text. In addition, users can create new decks to render their data with custom renderers.
Warning
This feature is in beta.
iris_df = px.data.iris() @task() def t1() -> str: md_text = '#Hello Flyte##Hello Flyte###Hello Flyte' m = MarkdownRenderer() s = BoxRenderer("sepal_length") deck = flytekit.Deck("demo", s.to_html(iris_df)) deck.append(m.to_html(md_text)) default_deck = flytekit.current_context().default_deck default_deck.append(m.to_html(md_text)) return md_text # Use Annotated to override default renderer @task() def t2() -> Annotated[pd.DataFrame, TopFrameRenderer(10)]: return iris_df
- Parameters:
name (str)
html (str | None)
auto_add_to_deck (bool)
- class flytekit.deck.TopFrameRenderer(max_rows=10, max_cols=100)#
Render a DataFrame as an HTML table.
- Parameters:
max_rows (int)
max_cols (int)
- class flytekit.deck.MarkdownRenderer#
Convert a markdown string to HTML and return HTML as a unicode string.
- class flytekit.deck.SourceCodeRenderer(title='Source Code')#
Convert Python source code to HTML, and return HTML as a unicode string.
- Parameters:
title (str)
- to_html(source_code)#
Convert the provided Python source code into HTML format using Pygments library.
This method applies a colorful style and replaces the color “#fff0f0” with “#ffffff” in CSS.
- Args:
source_code (str): The Python source code to be converted.
- Returns:
str: The resulting HTML as a string, including CSS and highlighted source code.
- Parameters:
source_code (str)
- Return type:
str