{"id":960,"library":"texttable","title":"Texttable","description":"Texttable is a Python module to create simple ASCII tables. It provides an easy-to-use API for formatting data into human-readable text tables, supporting various alignments, data types, and decorative options. The current version is 1.7.0, and it is actively maintained with regular updates.","status":"active","version":"1.7.0","language":"python","source_language":"en","source_url":"https://github.com/foutaise/texttable/","tags":["table","ascii","formatting","cli","text"],"install":[{"cmd":"pip install texttable","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for better wrapping of CJK text.","package":"cjkwrap","optional":true},{"reason":"Used for better rendering, including basic emoji support.","package":"wcwidth","optional":true}],"imports":[{"symbol":"Texttable","correct":"from texttable import Texttable"}],"quickstart":{"code":"from texttable import Texttable\n\ntable = Texttable()\n\n# Set column alignments (left, right, center)\ntable.set_cols_align([\"l\", \"r\", \"c\"])\n\n# Set column data types (text, float, integer)\ntable.set_cols_dtype([\"t\", \"f\", \"i\"])\n\n# Add a header row\ntable.header([\"Name\", \"Score\", \"Rank\"])\n\n# Add rows of data\ntable.add_row([\"Alice\", 95.5, 1])\ntable.add_row([\"Bob\", 88.0, 2])\ntable.add_row([\"Charlie\", 72.3, 3])\n\n# Draw and print the table\nprint(table.draw())","lang":"python","description":"This quickstart demonstrates how to create a basic ASCII table, set column alignments and data types, add a header, and populate it with data before printing."},"warnings":[{"fix":"Call `table.set_cols_dtype(['t', 'f', 'i', 'a'])` before adding rows to define how each column's data should be handled (text, float, integer, auto).","message":"Automatic column data type detection can lead to unexpected formatting, especially for numbers like `1.0` or `0.0` which might be converted to integers instead of floats. Always explicitly set column data types using `set_cols_dtype()` if precise formatting is needed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Initialize `Texttable` with `table = Texttable(max_width=0)` for a dynamically sized table, or carefully manage `max_width` if wrapping is desired.","message":"The `max_width` parameter in the `Texttable` constructor can cause cell content to wrap if the content exceeds the calculated column width. Setting `max_width=0` allows the table to self-adjust and prevents wrapping, ensuring all content appears on a single line where possible.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to version 1.6.6 or later, which includes a fix for this regression.","message":"Version 1.6.5 introduced a regression where stub files were missing in the wheel package, potentially causing import or packaging issues for some users.","severity":"breaking","affected_versions":"1.6.5"},{"fix":"Upgrade to version 1.7.0 or newer to leverage the enhanced boolean formatting capabilities.","message":"The behavior of boolean values in table cells was improved with a dedicated formatting option in version 1.7.0. Older versions might not format booleans as intuitively or consistently.","severity":"deprecated","affected_versions":"<1.7.0"}],"env_vars":null,"last_verified":"2026-05-12T21:44:55.257Z","next_check":"2026-06-27T00:00:00.000Z","problems":[{"fix":"Ensure each list passed to `add_row()` contains the same number of elements as the table's total column count, which is often determined by the first row added or methods like `set_cols_align`.","cause":"This error occurs when `add_row()` is called with a number of cells that does not match the implicitly or explicitly defined number of columns for the table.","error":"IndexError: list index out of range"},{"fix":"Pass a list or tuple of type codes to `set_cols_dtype`, even if defining the type for only one column, e.g., `table.set_cols_dtype(['t', 'f'])`.","cause":"The `set_cols_dtype` method expects a single iterable (list or tuple) containing type codes as its `dtypes` argument, not separate arguments for each column.","error":"TypeError: set_cols_dtype() takes 2 positional arguments but X were given"},{"fix":"Use one of the supported type codes: 't' (text), 'f' (float), 'e' (scientific), 'i' (integer), 'a' (auto), 'd' (date).","cause":"An invalid character or unsupported type code was provided in the list of data types for the `set_cols_dtype` method.","error":"ValueError: Unknown type specified for column"},{"fix":"Correct the capitalization in the import statement: `from texttable import Texttable`.","cause":"The main class in the `texttable` library is named `Texttable` (with a capital 'T'), but the import statement attempted to use a lowercase 't'.","error":"ImportError: cannot import name 'texttable' from 'texttable'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.7.0","cli_name":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"17.8M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"17.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.4,"import_time_s":0,"mem_mb":0.1,"disk_size":"18M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"18M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"19.7M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"19.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.6,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"20M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"20M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"11.6M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"11.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.4,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"12M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"12M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.3,"disk_size":"11.3M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.3,"disk_size":"11.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.4,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"12M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.01,"mem_mb":0.1,"disk_size":"12M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"17.3M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"17.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":"wheel","failure_reason":null,"install_time_s":1.7,"import_time_s":0,"mem_mb":0.1,"disk_size":"18M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0,"mem_mb":0.1,"disk_size":"18M"}]},"quickstart_checks":{"last_tested":"2026-04-24","tag":null,"tag_description":null,"results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}