tablemate

Prettify your tabular data, either on the command line or in Python code.


Keywords
hosted, by, github, tables, console, color, unicode, csv, prettyprint, prettify
License
Apache-2.0
Install
pip install tablemate==0.1.0.dev2

Documentation

Tablemate

Logo Prettify your tabular data using the shell or Python code.
Project  License Development Status
QA  Travis CI Coveralls GitHub Issues
Release  Latest Version Download format

Overview

Introduction

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.

Requirements (draft)

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).

Installation

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"

Usage

…

Contributing

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.

Similar Projects

References

Tools

Packages

Acknowledgements

…