Skip to main content

A clean and simple TUI table generator with auto-alignment

Project description

lb-pretty-table: lib for lazy

© Copyright logic-break 2026

https://logic-break.github.io

lib made for lazy, by lazy

installation:

pip install lb-pretty-table

NOTE: in code, you must import lb-pretty-table

Usage:

The library is "omnivore" — it accepts data in three different formats:

A. Dictionary Mode (Column-based)

Best for merging separate lists. It automatically handles different list lengths by adding a - placeholder.

from lb_pretty_table import PrettyTable

data = {
    "Users": ["logic-break", "abobus", "admin"],
    "Status": ["Coding", "Offline"], # Shorter list
    "Balance": [1000]                 # Only one item
}
PrettyTable.show(data)

B. Matrix Mode (Row-based)

Perfect for structured data. The first row is always treated as the header.

matrix = [
    ["ID", "Task", "Priority"],
    ["1", "Initial Commit", "Low"],
    ["2", "Fix UI Bugs", "High"]
]
PrettyTable.show(matrix)

C. API/JSON Mode (List of Dicts)

Commonly used when fetching data from databases or web APIs.

json_data = [
    {"Service": "Web-Server", "Health": "OK"},
    {"Service": "Database", "Health": "Warning"}
]
PrettyTable.show(json_data)

Example:

from lb_pretty_table import PrettyTable

  

# --- FUNCTIONS AND USAGE EXAMPLES ---

  

# 1. Automatic Mode (Static Method .show)

# Ideal for quick data printing without manual object creation.

# It automatically detects format and renders the table.

  

print("--- Example 1: Smart Dict (Automatic Alignment) ---")

# If lists have different lengths, the library automatically adds "-"

developers = ["logic-break",  "abobus"]

ranks = ["God",  "Junior",  "Newbie"]  # This list is longer

status = ["Online"]

  

# Simply pass a dictionary: {Header: List}

PrettyTable.show({

"Developer": developers,

"Rank": ranks,

"Status": status

})

  
  

print("\n--- Example 2: Matrix (List of Lists) ---")

# The first row is automatically treated as the header.

matrix_data = [

["Project",  "Language",  "Version"],

["lb-auto-tk",  "Python",  "0.0.5"],

["lb-pretty-table",  "Python",  "0.0.1"],

["server-controller",  "Python",  "1.0.0"]

]

PrettyTable.show(matrix_data)

  
  

print("\n--- Example 3: List of Dictionaries (API Style) ---")

# If data comes from a database or API as a list of dictionaries.

json_data = [

{"Name":  "North-Server",  "Uptime":  "99.9%"},

{"Name":  "South-Server",  "Uptime":  "85.0%"}

]

PrettyTable.show(json_data)

  
  

print("\n--- Example 4: Manual Object Control ---")

# Useful for building tables dynamically during program execution.

# Create a table object with specific headers

table = PrettyTable(["Command",  "Description"])

  

# Add rows one by one

table.add_row(["/start",  "Launch the system"])

table.add_row(["/stop",  "Shutdown all modules"])

  

# The .render() method returns a string for printing or writing to a file

rendered_string = table.render()

print(rendered_string)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lb_pretty_table-0.0.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lb_pretty_table-0.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file lb_pretty_table-0.0.2.tar.gz.

File metadata

  • Download URL: lb_pretty_table-0.0.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for lb_pretty_table-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d52383a21e16b62a17acc010c6e88fe4d5f672ba837c0fcc0ff590c4cdc3a2e4
MD5 568ec095502cfa19d69b95ed8ef7376c
BLAKE2b-256 85066f1ffc27a2b88ac05009409d49623042fd8586f5afd329f5455df6fe7283

See more details on using hashes here.

File details

Details for the file lb_pretty_table-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for lb_pretty_table-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 47c1268f518e967b7282d9676c82045d6cfa8886de41734005c30563dd81e7eb
MD5 14924ca3d35896cac6ef32597fd92ee1
BLAKE2b-256 4bf1d7500b4f6a8ae4fce3d0e4f97c75a31ecd8dd25880330bf6c3238bce7d1f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page