Registry / serialization / terminaltables

terminaltables

JSON →
library3.1.10pypypi✓ verified 25d ago

terminaltables is a Python library designed to easily draw tables in terminal/console applications from a nested list of strings. It supports multi-line rows and various table styles like ASCII, single-line, double-line, and GitHub Flavored Markdown. The current version is 3.1.10, but the project is no longer actively maintained.

pip install terminaltables
INSTALL
IMPORT
SIG · TERMINALTABLES
T
terminaltables
serializationpythonv3.1.10
Install
1.5s avg
Import
18ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.1.10 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.014s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.022s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

AsciiTable
from terminaltables import AsciiTable
SingleTable
from terminaltables import SingleTable
from terminaltables import UnixTable
UnixTable was renamed to SingleTable in v2.0.0.
DoubleTable
from terminaltables import DoubleTable
from terminaltables import WindowsTable
WindowsTable (and WindowsTableDouble) were renamed to DoubleTable in v2.0.0.
GithubFlavoredMarkdownTable
from terminaltables import GithubFlavoredMarkdownTable

This quickstart demonstrates how to create a basic ASCII table using `AsciiTable` by providing a list of lists. It also shows how to set a table title. Other table types like `SingleTable` and `DoubleTable` are used similarly.

from terminaltables import AsciiTable table_data = [ ['Heading1', 'Heading2', 'Heading3'], ['Row1 Col1', 'Row1 Col2', 'Row1 Col3'], ['Row2 Col1', 'Row2 Col2 with a long text that wraps', 'Row2 Col3'], ['Row3 Col1', 'Row3 Col2', 'Row3 Col3'] ] table = AsciiTable(table_data) # You can also set a title table.title = 'My Awesome Table' # Adjust column alignment (l=left, c=center, r=right) # table.justify_columns = {'Heading1': 'left', 'Heading2': 'center'} print(table.table)
Debug
Known issues
breakingThe `terminaltables` project (version 3.1.10 and earlier) is no longer actively maintained since December 2021. Users are strongly encouraged to consider using `terminaltables3` (`pip install terminaltables3`), which is a maintained fork designed to be a drop-in replacement.
fix
Migrate to `terminaltables3` by installing it and replacing `from terminaltables import ...` with `from terminaltables3 import ...`.
affects: <=3.1.10
breakingClasses `UnixTable`, `WindowsTable`, and `WindowsTableDouble` were removed and replaced.
fix
Use `SingleTable` instead of `UnixTable`. Use `DoubleTable` instead of `WindowsTable` or `WindowsTableDouble`.
affects: >=2.0.0
breakingThe `padded_table_data` property and `join_row()` method were removed.
fix
Review your code for direct usage of these properties/methods and adapt to the current API, which handles internal data formatting differently. The `table` property should be used to retrieve the rendered table string.
affects: >=3.0.0
breakingPython 2.6 support was removed.
fix
Ensure your project runs on Python 2.7+ or Python 3.3+. Modern usage should target Python 3.
affects: >=3.1.0
gotchaWhen generating multiple tables in a loop, a common mistake is to create a new `table_data` list and `AsciiTable` object in each iteration. This results in separate, small tables being printed.
fix
Aggregate all data into a single `table_data` list (or similar structure) first, then create and print a single `AsciiTable` instance outside the loop to produce one continuous table.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'terminaltables'
The terminaltables library has not been installed in the current Python environment.
fix
pip install terminaltables
ModuleNotFoundError: No module named 'terminal_tables'
The library name is `terminaltables` (no underscore), but it was incorrectly spelled with an underscore.
fix
from terminaltables import AsciiTable
TypeError: 'str' object is not iterable
The table data provided to terminaltables is a flat list of strings, but it expects a list of lists of strings (a 2D list).
fix
table_data = [['Header1', 'Header2'], ['Data1', 'Data2']]
TypeError: 'list' object is not callable
The `table_data` attribute of a terminaltables object is a list property, but it's being incorrectly called as if it were a method.
fix
print(table.table_data)
Upgrade
Version history
3.1.10latest on PyPI · released Dec 7, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
10
Bingbot
1
OpenAI (training)
1
Resources
terminaltables — pip install terminaltables · libregistry