Professional TUI table generator with auto-alignment
Project description
lb-pretty-table: lib for lazy
© Copyright logic-break 2026
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lb_pretty_table-0.0.1.tar.gz.
File metadata
- Download URL: lb_pretty_table-0.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ebd339eddcd52e3e9ccec70ae836dcc6a9d7a3d4caa8d3a4580c691040ec778
|
|
| MD5 |
3c9032159111bd60a9b31a7598c99c79
|
|
| BLAKE2b-256 |
9c847129deb62babc70af4c8d31cd9417b95e9bb79bd8de971771ca87339a04f
|
File details
Details for the file lb_pretty_table-0.0.1-py3-none-any.whl.
File metadata
- Download URL: lb_pretty_table-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22d00435f75de1c34e58d0c8310e6ba9c0cbfa566e1aa6eca9ac05beefd062c6
|
|
| MD5 |
51635b4b832f01944f70e1e3c5e28329
|
|
| BLAKE2b-256 |
4e4b4cfc9890e971129deedeecb1d655807560bb67b48e37941d0464a5004c64
|