All Projects → nschloe → termtables

nschloe / termtables

Licence: GPL-3.0 license
🖥️ Pretty tables in the terminal

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to termtables

cibuildwheel
🎡 Build Python wheels for all the platforms on CI with minimal configuration.
Stars: ✭ 1,350 (+1488.24%)
Mutual labels:  pypi
medium-toc
Easily create a table of contents for your Medium articles in just one click. ✨
Stars: ✭ 33 (-61.18%)
Mutual labels:  table
react-tisch
Table component for React and Bootstrap with real React components as cells
Stars: ✭ 17 (-80%)
Mutual labels:  table
dpytools
Collection of easy to use, beginner friendly but powerful, orthogonal tools to speed up discord bots development (discord.py)
Stars: ✭ 23 (-72.94%)
Mutual labels:  pypi
caipyra
import caipyra module code
Stars: ✭ 25 (-70.59%)
Mutual labels:  pypi
ios2androidres
Copy iOS image resources to their appropriate Android directory
Stars: ✭ 20 (-76.47%)
Mutual labels:  pypi
terraform-aws-dynamodb-autoscaler
Terraform module to provision DynamoDB autoscaler
Stars: ✭ 21 (-75.29%)
Mutual labels:  table
numpy-html
Render NumPy arrays as HTML tables
Stars: ✭ 38 (-55.29%)
Mutual labels:  table
pypi-command-line
A powerful, colorful, beautiful command-line-interface for pypi.org
Stars: ✭ 32 (-62.35%)
Mutual labels:  pypi
react-loading-placeholder
Loading placeholer, inspired by Facebook
Stars: ✭ 17 (-80%)
Mutual labels:  table
markdown-it-multimd-table
Multimarkdown table syntax plugin for markdown-it markdown parser
Stars: ✭ 104 (+22.35%)
Mutual labels:  table
DTE
Generate C# class from database table
Stars: ✭ 26 (-69.41%)
Mutual labels:  table
pypi-simple
PyPI Simple Repository API client library
Stars: ✭ 21 (-75.29%)
Mutual labels:  pypi
template
Svelte starter template with HMR, code splitting, datatable & modular ui-kit
Stars: ✭ 16 (-81.18%)
Mutual labels:  table
ediTable
Manipulation of table (sort, add, edit, remove, etc... - rows | valid cells, type, require, etc... cells )
Stars: ✭ 14 (-83.53%)
Mutual labels:  table
domnibus
Access domain information via python and command line.
Stars: ✭ 16 (-81.18%)
Mutual labels:  pypi
pygitrepo-project
A simplified, minimal but powerful Python Git Project development workflow CLI tools.
Stars: ✭ 32 (-62.35%)
Mutual labels:  pypi
jh-weapp-demo
微信小程序项目- 实现一些常用效果、封装通用组件和工具类
Stars: ✭ 60 (-29.41%)
Mutual labels:  table
habitipy
Command-line interface to Habitica
Stars: ✭ 47 (-44.71%)
Mutual labels:  pypi
editable-react-table
React table built to resemble a database.
Stars: ✭ 519 (+510.59%)
Mutual labels:  table

termtables

The tables have termed.

PyPi Version PyPI pyversions GitHub stars PyPi downloads

gh-actions codecov LGTM Code style: black

termtables is a lightweight Python 3 package for pretty-printing tables on the command line. Install with

pip install termtables

The code

import termtables as tt
import numpy

numpy.random.seed(0)
data = numpy.random.rand(5, 2)

tt.print(data)
# tt.to_string(data) returns the string

produces

table1

You can control border style, padding, alignment, and various other attributes. For example,

import termtables as tt

header = ["a", "bb", "ccc"]
data = [
    [1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]
]

tt.print(
    data,
    header=header,
    style=tt.styles.markdown,
    padding=(0, 1),
    alignment="lcr"
)

produces

| a               |       bb        |             ccc |
|-----------------|-----------------|-----------------|
| 1               |        2        |               3 |
| 613.23236243236 | 613.23236243236 | 613.23236243236 |

which is useful for copy-pasting into websites that support Markdown (like GitHub).

See test/test_termtables.py for more examples.

If the styles in termtables.styles

thin
thin_thick
thin_double
rounded
rounded_thick
rounded_double
thick
thick_thin
double
double_thin
booktabs

ascii_thin
ascii_thin_double
ascii_double
ascii_double_thin
ascii_booktabs

markdown

aren't good enough for you, simply provide your own style as a string of length 11 or 15 (the extra 4 including header-separating characters). For example

import termtables as tt

header = ["a", "bb", "ccc"]
data = [
    [1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]
]

tt.print(
    data,
    header=header,
    style="x0123456789abcd"
)

produces

1xxxxxxxxxxxxxxxxx7xxxxxxxxxxxxxxxxx7xxxxxxxxxxxxxxxxx2
0 a               0 bb              0 ccc             0
abbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbd
0 1               0 2               0 3               0
5xxxxxxxxxxxxxxxxx9xxxxxxxxxxxxxxxxx9xxxxxxxxxxxxxxxxx6
0 613.23236243236 0 613.23236243236 0 613.23236243236 0
3xxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxx4

Testing

To run the termtables unit tests, check out this repository and type

tox

Other software for terminal tables

License

This software is published under the GPL-3.0 license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].