Prettify your tabular data using the shell or Python code. | |
---|---|
Project | |
QA | |
Release |
To get that out of the way… Why another table prettifier library? Well, I wanted one that fulfilled my requirements, was actively maintained, and fully tested plus Py2/3 portable.
General
- Ease of use.
- Strict division between data and style.
- Support for parsing data from common formats (via
tablib
and others). - Serializing the data to a large choice of output formats (again mostly via
tablib
). - Output to markup languages (
.rst
,.md
, …).
API
- Streaming (with fixed column widths, and wrapping or cuts).
- A
.lines()
generator. - Fluent API? (
table().headers(…).repeat(24).…
)
Styling
- Unicode borders, with a configurable fallback to ASCII only.
- Table titles (above column headers).
- Table footer with stats (sum, avg, …).
- Terminal colors (via
colorama
). - Auto-mode for terminal size.
- Compact style (no borders).
- Repeat column headers (use terminal rows as a default).
Tablemate can be installed via pip install tablemate
as usual,
see releases for an overview of available versions.
To get a bleeding-edge version from source, use these commands:
repo="jhermann/tablemate"
pip install -r "https://raw.githubusercontent.com/$repo/master/requirements.txt"
pip install -UI -e "git+https://github.com/$repo.git#egg=${repo#*/}"
See Contributing on how to create a full development environment.
To add bash completion, read the Click docs about it, or just follow these instructions:
cmdname=tbm
mkdir -p ~/.bash_completion.d
( export _$(tr a-z- A-Z_ <<<"$cmdname")_COMPLETE=source ; \
$cmdname >~/.bash_completion.d/$cmdname.sh )
grep /.bash_completion.d/$cmdname.sh ~/.bash_completion >/dev/null \
|| echo >>~/.bash_completion ". ~/.bash_completion.d/$cmdname.sh"
. "/etc/bash_completion"
…
To create a working directory for this project, call these commands:
git clone "https://github.com/jhermann/tablemate.git"
cd "tablemate"
. .env --yes --develop
invoke build --docs test check
See CONTRIBUTING for more.
-
prettytable – Represent tabular data in visually appealing ASCII tables.
- https://github.com/kxxoling/PrettyTable (in sync)
- https://github.com/adamlamers/prettytable (in sync, with a formatted README)
- https://github.com/dprince/python-prettytable (outdated fork)
Tools
Packages
…