tessl install tessl/pypi-tabulate@0.9.0Pretty-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%
Build a product catalog formatter that displays product information in a formatted table, with proper support for product names and descriptions in multiple languages including Chinese, Japanese, and Korean.
Create a Python script that reads product data and formats it into a well-aligned table that correctly handles wide characters (CJK characters). The formatter must:
Accept a list of product dictionaries, each containing:
id: Product ID (integer)name: Product name (may contain CJK characters)price: Price as a floatdescription: Short description (may contain CJK characters)Display the data in a grid-style table format with proper borders
Correctly calculate character widths for alignment purposes:
Handle text wrapping for long descriptions:
@generates
Create a module with a format_catalog function that takes a list of product dictionaries and returns a formatted table string.
def format_catalog(products: list[dict]) -> str:
"""
Format a product catalog with proper wide character support.
Args:
products: List of product dictionaries with keys: id, name, price, description
Returns:
A formatted table string with proper alignment for wide characters
"""
passInput:
products = [
{"id": 1, "name": "智能手机", "price": 599.99, "description": "高性能处理器"},
{"id": 2, "name": "Laptop", "price": 899.99, "description": "Powerful computing"}
]Expected: A properly aligned table where the Chinese characters don't cause misalignment
Input:
products = [
{"id": 10, "name": "ノートパソコン", "price": 1200.50, "description": "最新モデル"},
{"id": 11, "name": "Mouse", "price": 25.99, "description": "Wireless"}
]Expected: Proper alignment despite different character widths
Input:
products = [
{"id": 20, "name": "스마트워치", "price": 299.99, "description": "건강 추적 기능이 있는 최신 스마트워치"}
]Expected: Description wraps correctly, respecting Korean character boundaries
Provides table formatting with wide character support.
Required for proper wide character width calculation.