{"id":3934,"library":"columnar","title":"Columnar","description":"Columnar is a Python library for pretty-printing tabular data in a well-formatted columnar output string. It offers features like customizable headers, column justification (left, center, right), and the ability to apply styling patterns using regular expressions. Its primary use case is enhancing the readability of data for command-line interfaces or logs. The current version is 1.4.1, released in December 2021, indicating a stable and mature utility rather than a rapidly evolving project.","status":"active","version":"1.4.1","language":"en","source_language":"en","source_url":"https://github.com/acksmaggart/columnar","tags":["text formatting","cli","table","display","output","pretty-print"],"install":[{"cmd":"pip install columnar","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for accurate calculation of character widths in different locales, ensuring correct table rendering.","package":"wcwidth","optional":false}],"imports":[{"symbol":"columnar","correct":"from columnar import columnar"}],"quickstart":{"code":"from columnar import columnar\n\ndata = [\n    ['busybox', 'c3c37d5d', 'linuxnode-1', 'Test server.'],\n    ['alpine-python', '6bb77855', 'linuxnode-2', 'The one that runs python.'],\n    ['redis', 'afb648ba', 'linuxnode-3', 'For queues and stuff.']\n]\n\nheaders = ['Name', 'ID', 'Host', 'Notes']\n\n# Basic table\ntable_basic = columnar(data, headers=headers)\nprint('--- Basic Table ---\\n')\nprint(table_basic)\n\n# Table with no borders and custom justification\ntable_no_borders = columnar(data, headers=headers, no_borders=True, justify=['l', 'c', 'r', 'l'])\nprint('\\n--- No Borders, Custom Justification ---\\n')\nprint(table_no_borders)","lang":"python","description":"This quickstart demonstrates the basic usage of the `columnar` function to format a list of lists into a readable table. It shows how to define headers and how to apply the `no_borders` option along with custom column justification."},"warnings":[{"fix":"Ensure you are using `from columnar import columnar` for text formatting, and explore libraries like `pyarrow` or `polars` for analytical columnar data processing.","message":"Be aware that this `columnar` library is for pretty-printing text tables, not for in-memory columnar data storage/processing (like Apache Arrow, Polars, or database-related columnar stores). Searching for 'columnar python' often yields results for those other, distinct, technologies.","severity":"gotcha","affected_versions":"All"},{"fix":"Upgrade your Python environment to 3.6 or newer. (e.g., `python -m pip install --upgrade python`)","message":"The library explicitly states compatibility only with Python 3.6+ due to its reliance on f-strings. Usage with older Python versions will result in syntax errors.","severity":"breaking","affected_versions":"<3.6"},{"fix":"If you use `no_borders=True` and need specific header casing, you must reformat the header strings *after* `columnar` has processed them, or avoid `no_borders=True`.","message":"When `no_borders=True` is passed to the `columnar` function, the table headers will be automatically converted to all uppercase characters. This is a stylistic side-effect of disabling borders.","severity":"gotcha","affected_versions":"All"},{"fix":"Always provide non-empty lists for `data` and `headers` when calling `columnar`, or handle empty input gracefully in your application logic.","message":"Passing empty lists for data or headers might lead to unexpected output or error messages. The project history mentions fixes related to error messages for empty input lists.","severity":"gotcha","affected_versions":"<1.4.1 (improved error messages, but core behavior may still be unexpected)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}