RowDump
A modern, structured, no-dependency Python library for formatted table output with support for custom formatting, ASCII box drawing, and flexible column definitions.
Features
- Structured table output with customizable column definitions
- ASCII box drawing for beautiful table borders
- Header separators with optional line between header and data
- Custom formatters for data transformation
- Automatic text truncation with configurable suffixes
- DateTime formatting with RFC3339 support
- Custom delimiters and output functions
- Empty value handling with custom placeholders
- Multiple table support with automatic table management
Installation
pip install rowdump
Requirements: Python 3.10+
Quick Start
from datetime import datetime
from rowdump import Column, Dump
# Create a dump instance
dump = Dump()
# Define columns
columns = [
Column("id", "ID", int, 5),
Column("name", "Name", str, 15),
Column("age", "Age", int, 3),
Column("city", "City", str, 12),
]
# Set columns and print header
dump.cols(columns)
# Add rows
dump.row({"id": 1, "name": "Alice", "age": 30, "city": "New York"})
dump.row({"id": 2, "name": "Bob", "age": 25, "city": "San Francisco"})
dump.row({"id": 3, "name": "Charlie", "age": 35, "city": "Los Angeles"})
# Close table and print summary
dump.close()
Output:
ID Name Age City
1 Alice 30 New York
2 Bob 25 San Franc...
3 Charlie 35 Los Angeles
Total rows: 3
ASCII Box Formatting
dump = Dump(ascii_box=True)
columns = [
Column("product", "Product", str, 20),
Column("price", "Price", float, 10),
Column("stock", "Stock", int, 8),
]
dump.cols(columns)
dump.row({"product": "Laptop", "price": 999.99, "stock": 15})
dump.row({"product": "Mouse", "price": 25.50, "stock": 100})
dump.close()
Output:
┌────────────────────┬──────────┬────────┐
│Product │Price │Stock │
├────────────────────┼──────────┼────────┤
│Laptop │999.99 │15 │
│Mouse │25.5 │100 │
└────────────────────┴──────────┴────────┘
Total rows: 2
Custom Formatters
def currency_formatter(value):
if value is None:
return "$0.00"
return f"${value:.2f}"
dump = Dump(ascii_box=True)
columns = [
Column("item", "Item", str, 12),
Column("price", "Price", float, 10, formatter=currency_formatter),
Column("quantity", "Qty", int, 5),
]
dump.cols(columns)
dump.row({"item": "Coffee", "price": 4.50, "quantity": 2})
dump.row({"item": "Water", "price": None, "quantity": 3})
dump.close()
DateTime Formatting
dump = Dump(delimiter=" | ")
columns = [
Column("event", "Event", str, 15),
Column("timestamp", "Timestamp", datetime, 20),
Column("status", "Status", str, 10),
]
dump.cols(columns)
dump.row({
"event": "User Login",
"timestamp": datetime(2024, 1, 15, 10, 30, 0),
"status": "Success"
})
dump.close()
Output:
Event | Timestamp | Status
--------------- | -------------------- | ----------
User Login | 2024-01-15T10:30:00Z | Success
Total rows: 1
Header Separators
# With separator (default)
dump = Dump()
columns = [Column("name", "Name", str, 10), Column("status", "Status", str, 8)]
dump.cols(columns)
dump.row({"name": "Alice", "status": "Active"})
dump.close()
# Without separator
dump = Dump(header_separator=False)
dump.cols(columns)
dump.row({"name": "Bob", "status": "Inactive"})
dump.close()
Output:
Name Status
---------- --------
Alice Active
Total rows: 1
Name Status
Bob Inactive
Total rows: 1
API Reference
Column Class
Column(
name: str,
display_name: str | None = None,
type: type = str,
width: int = 20,
empty_value: str = "",
truncate_suffix: str = "...",
formatter: Callable[[Any], str] | None = None,
)
name: Column name (used as dictionary key)display_name: Header display name (defaults to name)type: Data type (used for default formatting)width: Maximum column widthempty_value: Value to display for None/empty valuestruncate_suffix: Suffix for truncated valuesformatter: Custom formatting function
Dump Class
Dump(
delimiter: str = " ",
ascii_box: bool = False,
output_fn: Callable[[str], None] | None = None,
header_separator: bool = True,
)
delimiter: Separator between columnsascii_box: Enable ASCII box drawingoutput_fn: Custom output function (defaults to print)header_separator: Print separator line between header and data rows
Methods
cols(columns: Sequence[Column]): Set columns and print headerrow(data: dict[str, Any]): Print a data rowclose(summary: bool = True): Close table and optionally print summary
License
MIT License
Metadata
Release files for rowdump 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rowdump-0.1.0.tar.gz | 22.3 kB | With provenance | Details for rowdump-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rowdump-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for rowdump-0.1.0-py3-none-any.whl |
Total release size: 28.5 kB
Release files / rowdump-0.1.0.tar.gz
| Download URL | rowdump-0.1.0.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62cdb83ab7f67f6dffb58cbe8ca772ad76a968fc6c5c01a8fc66829f475a6bc3
|
|
BLAKE2b-256 checksum How to use checksums |
921350f8f750d61e620dbfbbfd603b0c2e498f6f8c435ed158b66d48b8698d66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 11, 2025.
Transparency logRelease files / rowdump-0.1.0-py3-none-any.whl
| Download URL | rowdump-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c565802e5900b514dffdd4d9e09212ecaa738c91a0402e763bec0b16d8b7fd2
|
|
BLAKE2b-256 checksum How to use checksums |
c71d8c89926d510d0b9ffbb9fd8ce254c41909d9f19dcf627b8725f3c13ad198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 11, 2025.
Transparency logSecurity for rowdump 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for rowdump-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 11, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.