CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-tabulate

tessl install tessl/pypi-tabulate@0.9.0

Pretty-print tabular data in Python with extensive formatting options and output format support.

Agent Success

Agent success rate when using this tile

69%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.9x

Baseline

Agent success rate without this tile

77%

task.mdevals/scenario-7/

Multi-Format Report Generator

Build a report generation system that produces sales data reports in multiple output formats.

Requirements

Your system should accept sales data containing product names, quantities sold, revenue, and profit margins. It should generate formatted reports in different styles depending on the target audience and platform.

Core Functionality

Implement a ReportGenerator class with the following capabilities:

  1. Format Selection: Generate reports in 4 different output formats:

    • 'github' - GitHub Flavored Markdown tables
    • 'psql' - PostgreSQL-style console output
    • 'html' - HTML table markup
    • 'latex' - LaTeX tabular format
  2. Data Input: Accept sales data as a list of dictionaries where each dictionary has keys: product (string), quantity (int), revenue (float), margin (float)

  3. Column Headers: Extract column headers from the dictionary keys

  4. Return Value: The generate_report(data, format_type) method must return a formatted string representation of the table

Test Cases

  • Given sales data with 3 products, generating a report with format 'github' produces a GitHub-flavored markdown table with pipes and headers @test
  • Given the same data, generating a report with format 'psql' produces PostgreSQL-style console output @test
  • Given the same data, generating a report with format 'html' produces HTML table markup @test
  • Given the same data, generating a report with format 'latex' produces LaTeX tabular environment code @test

Implementation

@generates

API

class ReportGenerator:
    """
    Generates formatted reports from sales data in multiple output formats.
    """

    def generate_report(self, data, format_type):
        """
        Generate a formatted report from sales data.

        Args:
            data: List of dictionaries containing product sales information.
                  Each dict has keys: product, quantity, revenue, margin
            format_type: String indicating desired format
                        ('markdown', 'psql', 'html', 'latex')

        Returns:
            String containing the formatted report
        """
        pass

Dependencies { .dependencies }

tabulate { .dependency }

Provides table formatting support.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/tabulate@0.9.x
tile.json