Registry / serialization / simple-ascii-tables

simple-ascii-tables

JSON →
library1.0.1pypypi✓ verified 84d ago

A simple, minimal, and dependency-free Python package for generating ASCII tables. It is a simplified fork of the unmaintained `terminaltables` library, focusing on basic usage without the complexity or external dependencies of other table formatting solutions. The current version is 1.0.1, released on January 23, 2025.

pip install simple-ascii-tables
INSTALL
IMPORT
SIG · SIMPLE-ASCII-TABLE
S
simple-ascii-tables
serializationpythonv1.0.1
Install
1.5s avg
Import
17ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.019s · 17.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.016s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AsciiTable
from simple_ascii_tables import AsciiTable

This quickstart demonstrates how to create a basic ASCII table using `AsciiTable`. Provide your data as a list of lists of strings. The outer list represents the table, and each inner list represents a row. The first inner list typically serves as the header. You can optionally set a title and customize various border elements.

from simple_ascii_tables import AsciiTable table_data = [ ['Heading 1', 'Heading 2', 'Heading 3'], ['Row 1, Col 1', 'Row 1, Col 2', 'Row 1, Col 3'], ['Row 2, Col 1', 'Row 2, Col 2', 'Row 2, Col 3 that is very long and wraps'], ['Short', 'Medium Text', 'Longer Text Here'] ] table = AsciiTable(table_data) # Optional: Set a title table.title = "My Simple Table" # Optional: Customize borders (inherits from terminaltables) # table.inner_column_border = False # table.outer_border = False print(table.table)
Debug
Known issues
gotchaThis library is a simplified fork of `terminaltables` and aims for minimalism. It may not support all advanced features found in `terminaltables` (e.g., different border styles like single or double lines using Unicode box-drawing characters, which were available in `SingleTable` or `DoubleTable` in the original library).
fix
Review the source code or experiment to confirm feature availability if migrating from `terminaltables` or requiring specific advanced formatting.
affects: All versions
gotchaAs a purely ASCII-based table generator, `simple-ascii-tables` may have limited or no robust support for wide Unicode characters (e.g., emojis, CJK characters) or ANSI escape codes for coloring. Such characters often have a display width greater than one, which can cause misalignments in fixed-width ASCII tables.
fix
For tables requiring rich text, colors, or accurate rendering of wide Unicode characters, consider libraries like `Rich` or `prettytable` which are designed for more advanced terminal output. Test thoroughly with diverse character sets if using this library for non-basic ASCII content.
affects: All versions
gotchaThe library is designed to be dependency-free. While beneficial for light-weight applications, this means it explicitly does not include features often found in larger table-generation libraries, such as automatic data type handling, sorting, HTML/JSON output, or complex cell styling. Data should be pre-formatted as strings.
fix
Pre-process data into lists of strings before passing to `AsciiTable`. If advanced data manipulation, formatting, or export options are needed, consider a more feature-rich library.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'simple_ascii_tables'
The 'simple-ascii-tables' package has not been installed, or the import statement uses an incorrect package name (dashes vs. underscores).
fix
Install the package using pip: `pip install simple-ascii-tables`. Then, ensure your import statement is `from simple_ascii_tables import AsciiTable`.
AttributeError: 'AsciiTable' object has no attribute 'table'
Unlike its predecessor 'terminaltables', the 'simple-ascii-tables' library does not expose the generated table string via a '.table' property.
fix
The 'AsciiTable' object is designed to be directly printable. Use `print(table)` or convert it to a string with `str(table)`.
```python
from simple_ascii_tables import AsciiTable
data = [['Header'], ['Row 1']]
table = AsciiTable(data)
print(table)
```
SyntaxError: invalid character in identifier
Python import statements require package names to be valid identifiers, meaning hyphens (-) are not allowed; they must be replaced with underscores (_).
fix
Change the import statement from `from simple-ascii-tables import AsciiTable` to `from simple_ascii_tables import AsciiTable`.
TypeError: 'str' object is not iterable
The 'AsciiTable' constructor expects its primary argument to be an iterable of iterables (e.g., a list of lists) representing the table data, but received a non-iterable type like a string or integer.
fix
Provide the table data as a list of lists, where each inner list represents a row and contains strings for cells.
```python
from simple_ascii_tables import AsciiTable
table_data = [
    ['Header 1', 'Header 2'],
    ['Row 1 Col 1', 'Row 1 Col 2']
]
table = AsciiTable(table_data)
```
Upgrade
Version history
1.0.1latest on PyPI · released Jan 23, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
simple-ascii-tables — pip install simple-ascii-tables · libregistry