Typeshed stubs for prettytable

raw JSON →
3.4.2.6 verified Fri May 01 auth: no python

Typing stubs for prettytable, providing type annotations for the prettytable library. Current version 3.4.2.6. Updated frequently alongside typeshed.

pip install types-prettytable
error No module named 'types_prettytable'
cause Trying to import from types_prettytable instead of prettytable.
fix
Remove the incorrect import and use 'from prettytable import PrettyTable'
error Cannot find reference 'PrettyTable' in 'types_prettytable'
cause IDE or type checker looking for stubs in the wrong package.
fix
Ensure types-prettytable is installed and import from prettytable, not types_prettytable.
gotcha types-prettytable only provides stubs; do not import from types_prettytable. Import from prettytable directly.
fix Use 'from prettytable import PrettyTable'
deprecated Some methods like 'printt' (deprecated since prettytable 3.0) have no stub support. Use 'print' or str(table).
fix Use print(table) instead of table.printt()

Basic usage of PrettyTable with type stubs.

from prettytable import PrettyTable
table = PrettyTable()
table.field_names = ["City", "Population"]
table.add_row(["New York", 8419000])
print(table)