Registry / serialization / ptable

ptable

JSON →
library0.9.2pypypi✓ verified 87d ago

PTable is a simple Python library designed to make it quick and easy to represent tabular data in visually appealing ASCII tables. It was originally forked from PrettyTable and maintains API compatibility. The current version is 0.9.2, with its last release in 2015, indicating a largely inactive or maintenance-only development cadence.

pip install PTable
INSTALL
IMPORT
SIG · PTABLE
P
ptable
serializationpythonv0.9.2
Install
2.5s avg
Import
48ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.2 · 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.048s · 19.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.5s · import 0.048s · 20MB
17MB installed
● package 17MB
Code
Verified usage

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

PrettyTable
from prettytable import PrettyTable
from ptable import PTable
Despite the package name `PTable`, the main class is `PrettyTable` and is imported from the `prettytable` namespace due to its origin as a fork.

This quickstart demonstrates creating a PrettyTable instance, defining column headers using `field_names`, adding data row by row with `add_row`, and then printing the table to the console. It also shows how to get an HTML string representation.

from prettytable import PrettyTable # Create a new table x = PrettyTable() # Set field names x.field_names = ["City name", "Area", "Population", "Annual Rainfall"] # Add rows x.add_row(["Adelaide", 1295, 1158259, 600.5]) x.add_row(["Brisbane", 5905, 1857594, 1146.4]) x.add_row(["Darwin", 112, 120900, 1714.7]) # Print the table (implicitly calls __str__ for ASCII representation) print(x) # Get HTML string representation html_table = x.get_html_string() # print(html_table) # Uncomment to see HTML output
Debug
Known issues
breakingThe `x.printt()` method, available in versions 0.5 and earlier, has been removed.
fix
Use `print(x)` for direct output or `x.get_string()` to obtain the ASCII table as a string.
affects: <=0.5
gotchaPTable uses the `prettytable` namespace for its imports (`from prettytable import PrettyTable`), which can lead to conflicts or unexpected behavior if the original `prettytable` library is also installed in the same environment.
fix
Avoid installing both `PTable` and `prettytable` simultaneously. If you need functionality from `PTable`, ensure only it is installed, or manage environments carefully.
affects: All versions
deprecatedThe library has not been updated since version 0.9.2 in May 2015. This indicates a lack of active maintenance and may lead to compatibility issues with newer Python versions or unaddressed bugs.
fix
Consider alternatives like the actively maintained `PrettyTable` if long-term support and modern Python compatibility are critical. Otherwise, be aware that future Python updates might break functionality.
affects: 0.9.2 and earlier
Errors
Common errors & fixes
ImportError: cannot import name 'PTable' from 'ptable'
The main class is named `PrettyTable` and is imported from the `prettytable` module, even when the package installed is `PTable`.
fix
Use `from prettytable import PrettyTable` instead of `from ptable import PTable`.
AttributeError: 'PrettyTable' object has no attribute 'printt'
You are attempting to use the deprecated `printt()` method, which was removed in versions 0.6 and later.
fix
Replace `x.printt()` with `print(x)` or `print(x.get_string())`.
Unexpected table formatting or missing features when both PTable and prettytable are installed.
Due to `PTable` being a fork of `PrettyTable` and using the same internal `prettytable` namespace, having both packages installed can cause Python to load an unpredictable version of the library, leading to inconsistent behavior.
fix
Uninstall one of the packages. If you intend to use the `PTable` fork, ensure only `pip uninstall prettytable` is performed, then `pip install PTable`. Vice-versa if you prefer the original `prettytable`.
Upgrade
Version history
0.9.2latest on PyPI · released May 28, 2015
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
14
Resources
ptable — pip install ptable · libregistry