tablate.api.modules package#

Submodules#

tablate.api.modules.Grid module#

class tablate.api.modules.Grid.Grid(columns, name=None, frame_divider=None, background=None, background_padding=None, multiline=None, max_lines=None, column_divider=None, column_padding=None, text_style=None, text_align=None, text_color=None, html_px_multiplier=None, html_styles=None, html_default_colors=None, container_border=None, container_padding=None, container_width=None, html_container_styles=None)[source]#

Bases: TablateApiItem

Create a TablateItem grid frame (single row of multiple columns) to Tablate instance.

Parameters:
  • columns (List[Union[str, GridColumnInput]]) – Either a list of contents (str, int, float) for columns or a list of column dicts containing contents and styles for columns. [required]

  • name (Optional[str]) – Frame name (to prevent duplicate entries). [default: None]

  • frame_divider (Optional[Literal['none', 'blank', 'thin', 'thick', 'double']]) – Dividing line at the bottom of the frame. [default: ‘thick’]

  • background (Optional[Literal['white', 'grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'dark_red', 'dark_green', 'dark_yellow', 'dark_blue', 'dark_magenta', 'dark_cyan', 'dark_grey', 'black']]) – Background color for the grig frame. [default: None]

  • background_padding (Optional[int]) – Additional padding applied to text if background color set (ASCII only). [default: 1]

  • multiline (Optional[bool]) – Whether the text may wrap to multiple lines. [default: True]

  • max_lines (Optional[int]) – Maximum number of lines to which the text may wrap. [default: None]

  • column_divider (Optional[Literal['blank', 'thin', 'thick', 'double']]) – Dividing line between columns. [default: ‘thin’]

  • column_padding (Optional[int]) – Text padding within each column. [default: 1]

  • text_style (Optional[Literal['normal', 'bold', 'underlined', 'bold_underlined']]) – Text style for grid frame. [default: ‘normal’]

  • text_align (Optional[Literal['left', 'center', 'right']]) – Text alignment for grid frame. [default: ‘left’]

  • text_color (Optional[Literal['white', 'grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'dark_red', 'dark_green', 'dark_yellow', 'dark_blue', 'dark_magenta', 'dark_cyan', 'dark_grey', 'black']]) – Text color for grid frame. [default: ‘None’]

  • html_px_multiplier (Optional[int]) – Multiplier applied to HTML px properties. [default: 1]

  • html_styles (Optional[HtmlStylesInput]) – HTML specific styles for grid frame. [default: { “html_frame_styles”: {“html_frame_divider_style”: “thick”, “html_frame_divider_weight: 1, “html_frame_divider_color”: ‘black’, “html_multiline”: True (False for Table frames), “html_max_lines”: None, “html_background”: None }, “html_column_styles”: {“html_column_divider_style”: “thin”, “html_column_divider_weight”: 1, “html_column_divider_color”: “black”, “html_padding”: “6px”} “html_text_styles”: {“html_text_style”: ‘normal’, “html_text_align”: ‘left’, “html_text_color”: None, “html_text_size”: 16 } }]

  • container_border (Optional[Literal['blank', 'thin', 'thick', 'double']]) – outer border style for the Tablate container instance. [default: ‘thick’]

  • container_padding (Optional[int]) – outer padding (in Unicode character width) for the Tablate container instance. [default: 1]

  • container_width (Optional[int]) – outer width (in Unicode character width) for the Tablate container instance. [default: 120 or terminal width]

  • html_container_styles (Optional[HtmlContainerStylesInput]) – style dictionary for HTML specific styles for Tablate container instance. [default: None]

tablate.api.modules.Table module#

class tablate.api.modules.Table.Table(columns, rows, name=None, frame_divider=None, multiline=None, max_lines=None, background=None, background_padding=None, multiline_header=None, max_lines_header=None, hide_header=None, column_divider=None, column_padding=None, header_base_divider=None, row_line_divider=None, odd_row_background=None, even_row_background=None, text_style=None, text_align=None, text_color=None, header_styles=None, html_default_colors=None, html_px_multiplier=None, html_styles=None, html_header_styles=None, container_border=None, container_padding=None, container_width=None, html_container_styles=None)[source]#

Bases: TablateApiItem

Create a TablateItem table frame (multiple rows of multiple columns) to Tablate instance.

Parameters:
  • columns (List[TableColumnInput]) – List of column dicts containing a required column key and optional (str, int, float) to display, as well as column specific styling options. [required]

  • rows (List[Dict[str, Union[str, int, float]]]) – List of row dicts containing the (str, int, float) values for each column key. [required]

  • name (Optional[str]) – Frame name (to prevent duplicate entries). [default: None]

  • frame_divider (Optional[Literal['none', 'blank', 'thin', 'thick', 'double']]) – Dividing line at the bottom of the frame. [default: ‘thick’]

  • background (Optional[Literal['white', 'grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'dark_red', 'dark_green', 'dark_yellow', 'dark_blue', 'dark_magenta', 'dark_cyan', 'dark_grey', 'black']]) – Background color for the table frame. [default: None]

  • background_padding (Optional[int]) – Additional padding applied to text if background color set (ASCII only). [default: 1]

  • multiline (Optional[bool]) – Whether the text may wrap to multiple lines. [default: False]

  • max_lines (Optional[int]) – Maximum number of lines to which the text may wrap. [default: None]

  • multiline_header (Optional[bool]) – Whether the header text may wrap to multiple lines. [default: False]

  • max_lines_header (Optional[int]) – Maximum number of lines to which the header text may wrap. [default: None]

  • hide_header (Optional[bool]) – Whether to not render the header. [default: False]

  • column_divider (Optional[Literal['blank', 'thin', 'thick', 'double']]) – Dividing line between columns. [default: ‘thin’]

  • column_padding (Optional[int]) – Text padding within each column. [default: 1]

  • header_base_divider (Optional[Literal['none', 'blank', 'thin', 'thick', 'double']]) – Dividing line at the bottom of the table header frame. [default: ‘thick’]

  • row_line_divider (Optional[Literal['none', 'blank', 'thin', 'thick', 'double']]) – Dividing line between each row of the table frame. [default: ‘thin’]

  • odd_row_background (Optional[Literal['white', 'grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'dark_red', 'dark_green', 'dark_yellow', 'dark_blue', 'dark_magenta', 'dark_cyan', 'dark_grey', 'black']]) – Background color for odd rows of table frame. [default: None]

  • even_row_background (Optional[Literal['white', 'grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'dark_red', 'dark_green', 'dark_yellow', 'dark_blue', 'dark_magenta', 'dark_cyan', 'dark_grey', 'black']]) – Background color for even rows of table frame. [default: None]

  • text_style (Optional[Literal['normal', 'bold', 'underlined', 'bold_underlined']]) – Text style for table frame. [default: ‘normal’]

  • text_align (Optional[Literal['left', 'center', 'right']]) – Text alignment for table frame. [default: ‘left’]

  • text_color (Optional[Literal['white', 'grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'dark_red', 'dark_green', 'dark_yellow', 'dark_blue', 'dark_magenta', 'dark_cyan', 'dark_grey', 'black']]) – Text color for grid frame. [default: None]

  • header_styles (Optional[BaseStylesInput]) – Specific styles to apply to the table header frame. [default: None (inherits table styles)]

  • html_px_multiplier (Optional[int]) – Multiplier applied to HTML px properties. [default: 1]

  • html_styles (Optional[HtmlTableFrameStylesInput]) – HTML specific styles for table frame. [default: { “html_frame_styles”: {“html_frame_divider_style”: “thick”, “html_frame_divider_weight: 1, “html_frame_divider_color”: ‘black’, “html_multiline”: True (False for Table frames), “html_max_lines”: None, “html_background”: None }, “html_column_styles”: {“html_column_divider_style”: “thin”, “html_column_divider_weight”: 1, “html_column_divider_color”: “black”, “html_padding”: “6px”}, “html_text_styles”: {“html_text_style”: ‘normal’, “html_text_align”: ‘left’, “html_text_color”: None, “html_text_size”: 16 }, “html_row_styles”: {“html_row_line_divider_weight”: 1, “html_row_line_divider_style”: “thin”, “html_row_line_divider_color”: None, “html_odds_background”: None, “html_evens_background”: None} }] (Tablate constructor option html_default_colors applies styles to table headers and even rows, separately from, but overwritten by, this html_styles dict)

  • html_header_styles (Optional[HtmlStylesInput]) – HTML specific styles for table header frame. [default: None (inherits table styles)]

  • container_border (Optional[Literal['blank', 'thin', 'thick', 'double']]) – outer border style for the Tablate container instance. [default: ‘thick’]

  • container_padding (Optional[int]) – outer padding (in Unicode character width) for the Tablate container instance. [default: 1]

  • container_width (Optional[int]) – outer width (in Unicode character width) for the Tablate container instance. [default: 120 or terminal width]

  • html_container_styles (Optional[HtmlContainerStylesInput]) – style dictionary for HTML specific styles for Tablate container instance. [default: None]

tablate.api.modules.Text module#

class tablate.api.modules.Text.Text(text, name=None, text_style=None, text_align=None, text_color=None, frame_padding=None, frame_divider=None, background=None, background_padding=None, multiline=None, max_lines=None, html_default_colors=None, html_px_multiplier=None, html_styles=None, container_border=None, container_padding=None, container_width=None, html_container_styles=None)[source]#

Bases: TablateApiItem

Create a TablateItem text frame (single row, single column) to Tablate container instance.

Parameters:
  • text (Union[str, int, float]) – Text frame content. [required]

  • name (Optional[str]) – Frame name (to prevent duplicate entries). [default: None]

  • text_style (Optional[Literal['normal', 'bold', 'underlined', 'bold_underlined']]) – Text style for text frame. [default: ‘normal’]

  • text_align (Optional[Literal['left', 'center', 'right']]) – Text alignment for text frame. [default: ‘left’]

  • text_color (Optional[Literal['white', 'grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'dark_red', 'dark_green', 'dark_yellow', 'dark_blue', 'dark_magenta', 'dark_cyan', 'dark_grey', 'black']]) – Text color for text frame. [default: ‘None’]

  • frame_divider (Optional[Literal['none', 'blank', 'thin', 'thick', 'double']]) – Dividing line at the bottom of the frame. [default: ‘thick’]

  • frame_padding (Optional[int]) – Text padding within text frame. [default: 1]

  • background (Optional[Literal['white', 'grey', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'dark_red', 'dark_green', 'dark_yellow', 'dark_blue', 'dark_magenta', 'dark_cyan', 'dark_grey', 'black']]) – Background color for the text frame. [default: None]

  • background_padding (Optional[int]) – Additional padding applied to text if background color set (ASCII only). [default: 1]

  • multiline (Optional[bool]) – Whether the text may wrap to multiple lines. [default: True]

  • max_lines (Optional[int]) – Maximum number of lines to which the text may wrap. [default: None]

  • html_px_multiplier (Optional[int]) – Multiplier applied to HTML px properties. [default: 1]

  • html_styles (Optional[HtmlTextFrameStylesInput]) – HTML specific styles for text frame. [default: { “html_frame_styles”: {“html_frame_divider_style”: “thick”, “html_frame_divider_weight: 1, “html_frame_divider_color”: ‘black’, “html_multiline”: True (False for Table frames), “html_max_lines”: None, “html_background”: None }, “html_text_styles”: {“html_text_style”: ‘normal’, “html_text_align”: ‘left’, “html_text_color”: None, “html_text_size”: 16 } }]

  • container_border (Optional[Literal['blank', 'thin', 'thick', 'double']]) – outer border style for the Tablate container instance. [default: ‘thick’]

  • container_padding (Optional[int]) – outer padding (in Unicode character width) for the Tablate container instance. [default: 1]

  • container_width (Optional[int]) – outer width (in Unicode character width) for the Tablate container instance. [default: 120 or terminal width]

  • html_container_styles (Optional[HtmlContainerStylesInput]) – style dictionary for HTML specific styles for Tablate container instance. [default: None]

Module contents#